summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/default.css420
-rw-r--r--admin/inc/auth.inc.php4
-rwxr-xr-xadmin/index.php272
-rw-r--r--app/classes/Planet.class.php288
-rw-r--r--app/lib/Cache.php32
-rw-r--r--app/lib/lib.opml.php218
-rw-r--r--cron.php16
-rw-r--r--custom/style/default.css190
-rw-r--r--custom/views/archive/index.tpl.php68
-rw-r--r--custom/views/atom10/index.tpl.php58
-rw-r--r--custom/views/default/index.tpl.php102
-rw-r--r--custom/views/rss10/index.tpl.php90
-rw-r--r--index.php34
-rw-r--r--postload.php32
14 files changed, 912 insertions, 912 deletions
diff --git a/admin/default.css b/admin/default.css
index ea2fe59..2b662e0 100644
--- a/admin/default.css
+++ b/admin/default.css
@@ -1,214 +1,214 @@
-html, body{
- margin: 0;
- padding: 0;
-}
-html{
- font-size: 62.5%;
-}
-body{
- background: #FFF;
- color: #333;
- font: 1.1em/1.6em "Lucida Grande", Tahoma, Arial, sans-serif;
-}
-
-
-fieldset{
- border: 0;
- padding: 0;
- margin: 1em 0;
-}
-input.text{
- border: 1px solid #BBB;
- padding: 4px;
-}
-input.submit{
- font-size: 1em;
- padding: 4px;
- background: #D1D1D1 url(img/button.png) repeat-x left center;
- border: 1px solid #FFF;
- border-bottom: 1px solid #CECECE;
+html, body{
+ margin: 0;
+ padding: 0;
+}
+html{
+ font-size: 62.5%;
+}
+body{
+ background: #FFF;
+ color: #333;
+ font: 1.1em/1.6em "Lucida Grande", Tahoma, Arial, sans-serif;
+}
+
+
+fieldset{
+ border: 0;
+ padding: 0;
+ margin: 1em 0;
+}
+input.text{
+ border: 1px solid #BBB;
+ padding: 4px;
+}
+input.submit{
+ font-size: 1em;
+ padding: 4px;
+ background: #D1D1D1 url(img/button.png) repeat-x left center;
+ border: 1px solid #FFF;
+ border-bottom: 1px solid #CECECE;
border-right: 1px solid #CECECE;
- cursor: pointer;
-}
-input.submit:hover{
- background: #D1D1D1 url(img/button-h.png) repeat-x left center;
- color: #000;
- border: 1px solid #FFF;
- border-bottom: 1px solid #C6C6C6;
- border-right: 1px solid #C6C6C6;
-}
-input.delete{
- margin-left: 1em;
-}
-input.delete:hover{
- background: #ffabab url(img/button-delete.png) repeat-x left center;
- color: #C00;
- border: 1px solid #FCC;
- border-bottom: 1px solid #F99;
- border-right: 1px solid #F99;
-}
-input.add{
- font-weight: bold;
-}
-input.add:hover{
- background: #65a5e1 url(img/button-add.png) repeat-x left center;
- color: #20466a;
- border: 1px solid #a6c7e5;
- border-bottom: 1px solid #4f90cd;
- border-right: 1px solid #4f90cd;
-}
-p.help{
- font-size: 0.8em;
- color: #999;
- margin: 0;
-}
-
-#page{
-}
-
- #header{
- background: #E0E0E0 url(img/moonmoon.png) no-repeat right center;
- border-top: 5px solid #D0D0D0;
- margin: 0;
- padding: 10px;
- }
- #header h1{
- display: none;
- margin: 0 0 0 20px;
- padding: 0;
- height: 14px;
- width: 95px;
- background: transparent url(img/moonmoon.png) no-repeat left center;
-
- overflow: hidden;
- text-indent: -1000em;
- }
- #header p{
- margin: 0 0 0 20px;
- padding: 0;
- }
- #header p a{
- color: #AAA;
- }
- #header p a:hover{
- color: #111;
- }
-
-
- ul#nav{
- margin: 20px 30px;
- padding: 0;
- list-style: none;
- }
- ul#nav:after {content: "."; display: block; height: 0; clear: both; visibility: hidden; }
- ul#nav {display: inline-table;}
- /* Hides from IE-mac \*/
- * html ul#nav {height: 1%;}
- ul#nav {display: block;}
- /* End hide from IE-mac */
-
- ul#nav li{
- display: block;
- float: left;
- }
- ul#nav li a{
- display: block;
- border: 1px solid #DDD;
- padding: 8px 8px 8px 36px;
- margin-right: 8px;
- text-decoration: none;
- color: #666;
- background-repeat: no-repeat;
- background-position: 6px center;
- }
- ul#nav li a:hover,
- body#admin-feed #nav-feed a,
- body#admin-admin #nav-admin a {
- background-color: #f0f2f6;
- border-color: #AAA;
- color: #111;
- }
- #nav-feed a{
- background-image: url(img/nav-feed.png);
- }
- #nav-admin a{
- background-image: url(img/nav-admin.png);
- }
-
- #content{
- margin: 20px 30px;
- }
-
- .widget{
- margin: 20px 0;
- }
- .widget h3{
- background: #3e4350 url(img/h3.png) repeat-x left center;
- color: #FFF;
- text-transform: uppercase;
- margin: 0;
- padding: 10px;
- }
- .widget form{
- padding: 10px;
- border: 1px solid #EEE;
- border-top: 0;
- }
-
- #feedmanage p.select{
- margin: 3px 0;
- }
- #feedmanage p.action span.count{
- float: right;
- padding-right: 10px;
- font-size: 1.3em;
- }
- #feedmanage table{
- width: 99%;
- border-collapse: collapse;
- border: 1px solid #f0f2f6;
- }
- #feedmanage thead th{
- background: #f0f2f6;
- text-align: left;
- padding: 6px;
- }
- #feedmanage thead span{
- display: none;
- }
- #feedmanage tr{
- border-bottom: 1px solid #e8ebf1;
- }
- #feedmanage tr.even td{
- background: #f0f2f6;
- width: auto;
- }
- #feedmanage .text{
- background: transparent;
- border: 1px solid #FFF;
- width: 90%;
- }
- #feedmanage tr.even td .text{
- border: 1px solid #f0f2f6;
- }
- #feedmanage tr td input.text:focus{
- background: #FFF;
- border: 1px solid #4392b7;
- }
-
- #feedmanage tr.selected td{
- background: #ffabab;
- background: #4392b7;
- color: #FFF;
- }
- #feedmanage tr.selected td .text{
- color: #FFF;
- border: 1px solid #4392b7;
- }
- #feedmanage tr td input.text:focus{
- background: #FFF;
- color: #000;
- border: 1px solid #4392b7;
+ cursor: pointer;
+}
+input.submit:hover{
+ background: #D1D1D1 url(img/button-h.png) repeat-x left center;
+ color: #000;
+ border: 1px solid #FFF;
+ border-bottom: 1px solid #C6C6C6;
+ border-right: 1px solid #C6C6C6;
+}
+input.delete{
+ margin-left: 1em;
+}
+input.delete:hover{
+ background: #ffabab url(img/button-delete.png) repeat-x left center;
+ color: #C00;
+ border: 1px solid #FCC;
+ border-bottom: 1px solid #F99;
+ border-right: 1px solid #F99;
+}
+input.add{
+ font-weight: bold;
+}
+input.add:hover{
+ background: #65a5e1 url(img/button-add.png) repeat-x left center;
+ color: #20466a;
+ border: 1px solid #a6c7e5;
+ border-bottom: 1px solid #4f90cd;
+ border-right: 1px solid #4f90cd;
+}
+p.help{
+ font-size: 0.8em;
+ color: #999;
+ margin: 0;
+}
+
+#page{
+}
+
+ #header{
+ background: #E0E0E0 url(img/moonmoon.png) no-repeat right center;
+ border-top: 5px solid #D0D0D0;
+ margin: 0;
+ padding: 10px;
+ }
+ #header h1{
+ display: none;
+ margin: 0 0 0 20px;
+ padding: 0;
+ height: 14px;
+ width: 95px;
+ background: transparent url(img/moonmoon.png) no-repeat left center;
+
+ overflow: hidden;
+ text-indent: -1000em;
+ }
+ #header p{
+ margin: 0 0 0 20px;
+ padding: 0;
+ }
+ #header p a{
+ color: #AAA;
+ }
+ #header p a:hover{
+ color: #111;
+ }
+
+
+ ul#nav{
+ margin: 20px 30px;
+ padding: 0;
+ list-style: none;
+ }
+ ul#nav:after {content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+ ul#nav {display: inline-table;}
+ /* Hides from IE-mac \*/
+ * html ul#nav {height: 1%;}
+ ul#nav {display: block;}
+ /* End hide from IE-mac */
+
+ ul#nav li{
+ display: block;
+ float: left;
+ }
+ ul#nav li a{
+ display: block;
+ border: 1px solid #DDD;
+ padding: 8px 8px 8px 36px;
+ margin-right: 8px;
+ text-decoration: none;
+ color: #666;
+ background-repeat: no-repeat;
+ background-position: 6px center;
+ }
+ ul#nav li a:hover,
+ body#admin-feed #nav-feed a,
+ body#admin-admin #nav-admin a {
+ background-color: #f0f2f6;
+ border-color: #AAA;
+ color: #111;
+ }
+ #nav-feed a{
+ background-image: url(img/nav-feed.png);
+ }
+ #nav-admin a{
+ background-image: url(img/nav-admin.png);
+ }
+
+ #content{
+ margin: 20px 30px;
+ }
+
+ .widget{
+ margin: 20px 0;
+ }
+ .widget h3{
+ background: #3e4350 url(img/h3.png) repeat-x left center;
+ color: #FFF;
+ text-transform: uppercase;
+ margin: 0;
+ padding: 10px;
+ }
+ .widget form{
+ padding: 10px;
+ border: 1px solid #EEE;
+ border-top: 0;
+ }
+
+ #feedmanage p.select{
+ margin: 3px 0;
+ }
+ #feedmanage p.action span.count{
+ float: right;
+ padding-right: 10px;
+ font-size: 1.3em;
+ }
+ #feedmanage table{
+ width: 99%;
+ border-collapse: collapse;
+ border: 1px solid #f0f2f6;
+ }
+ #feedmanage thead th{
+ background: #f0f2f6;
+ text-align: left;
+ padding: 6px;
+ }
+ #feedmanage thead span{
+ display: none;
+ }
+ #feedmanage tr{
+ border-bottom: 1px solid #e8ebf1;
+ }
+ #feedmanage tr.even td{
+ background: #f0f2f6;
+ width: auto;
+ }
+ #feedmanage .text{
+ background: transparent;
+ border: 1px solid #FFF;
+ width: 90%;
+ }
+ #feedmanage tr.even td .text{
+ border: 1px solid #f0f2f6;
+ }
+ #feedmanage tr td input.text:focus{
+ background: #FFF;
+ border: 1px solid #4392b7;
+ }
+
+ #feedmanage tr.selected td{
+ background: #ffabab;
+ background: #4392b7;
+ color: #FFF;
+ }
+ #feedmanage tr.selected td .text{
+ color: #FFF;
+ border: 1px solid #4392b7;
+ }
+ #feedmanage tr td input.text:focus{
+ background: #FFF;
+ color: #000;
+ border: 1px solid #4392b7;
}
/* Login form
diff --git a/admin/inc/auth.inc.php b/admin/inc/auth.inc.php
index 0b70d05..d21467b 100644
--- a/admin/inc/auth.inc.php
+++ b/admin/inc/auth.inc.php
@@ -1,4 +1,4 @@
-<?php
+<?php
include (dirname(__FILE__).'/pwd.inc.php');
if ( isset($_COOKIE['auth']) && $_COOKIE['auth'] == $password ) {
@@ -7,5 +7,5 @@ if ( isset($_COOKIE['auth']) && $_COOKIE['auth'] == $password ) {
setcookie('auth','', time()-3600);
header('Location: login.php');
die;
-}
+}
?> \ No newline at end of file
diff --git a/admin/index.php b/admin/index.php
index 1a43020..4bffb15 100755
--- a/admin/index.php
+++ b/admin/index.php
@@ -1,136 +1,136 @@
-<?php
-
-require_once dirname(__FILE__) . '/inc/auth.inc.php';
-require_once dirname(__FILE__) . '/../app/app.php';
-
-//Load configuration
-$config_file = dirname(__FILE__) . '/../custom/config.yml';
-
-if (is_file($config_file)){
- $conf = Spyc::YAMLLoad($config_file);
- $PlanetConfig = new PlanetConfig($conf);
-} else {
- die('Config file (custom/config.yml) is missing.');
-}
-
-//Instantiate app
-$Planet = new Planet($PlanetConfig);
-
-//Load
-if (0 < $Planet->loadOpml(dirname(__FILE__) . '/../custom/people.opml')) {
- $Planet->loadFeeds();
- $items = $Planet->getItems();
-}
-
-$everyone = $Planet->getPeople();
-$count_feeds = count($everyone);
-$page_id = 'admin-feed';
-$footer_extra = <<<FRAGMENT
- <script>
- var allCheckboxes = function(status){
- var form = document.getElementById('feedmanage');
- var selectboxes = form.getElementsByTagName('input');
- for (var i=0; i<selectboxes.length; i++){
- if ('checkbox' == selectboxes[i].type){
- selectboxes[i].checked = status;
- }
- }
- }
-
- window.onload = function(){
- //Select/unselect rows
- var form = document.getElementById('feedmanage');
- var selectboxes = form.getElementsByTagName('input');
- for (var i=0; i<selectboxes.length; i++){
- if ('checkbox' == selectboxes[i].type) {
- selectboxes[i].onchange = function() {
- var tr = this.parentNode.parentNode;
- if (this.checked) {
- tr.className += ' selected';
- } else {
- tr.className = tr.className.replace('selected','');
- }
- }
- }
- }
-
- var btSelectall = document.getElementById('selectall');
- btSelectall.onclick = function(){
- allCheckboxes('checked');
- }
-
- var btSelectnone = document.getElementById('selectnone');
- btSelectnone.onclick = function(){
- allCheckboxes('');
- }
- }
- </script>
-FRAGMENT;
-
-ob_start();
-?>
-
- <div class="widget">
- <h3>Add a new feed</h3>
- <form action="subscriptions.php" method="post" id="feedimport">
- <fieldset>
- <label for="url">Link:</label>
- <input type="text" class="text" name="url" id="url" value="http://" class="text" size="50" />
- <input type="submit" class="submit add" name="add" value="Add feed" />
- </fieldset>
- <p class="help">Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed.</p>
- </form>
- </div>
-
- <div class="widget">
- <h3>Manage existing feeds</h3>
- <form action="subscriptions.php" method="post" id="feedmanage">
- <p class="action">
- <span class="count">Number of feeds: <?=$count_feeds?></span>
- <input type="submit" class="submit save" name="save" id="save" value="Save changes" />
- <input type="submit" class="submit delete" name="delete" id="delete" value="Delete selected" />
- </p>
- <p class="select">Select : <a href="javascript:void(0);" id="selectall">All</a>, <a href="javascript:void(0);" id="selectnone">None</a></p>
- <table>
- <thead>
- <tr>
- <th><span>Selection</span></th>
- <th>Name</th>
- <th>Last entry</th>
- <th>Website link</th>
- <th>Feed link</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $i = 0;
- foreach ($everyone as $opml_person){
- $i++;
- ?>
- <tr class="<?=($i%2)?'odd':'even'; ?>">
- <td><input type="checkbox" class="checkbox" name="opml[<?=$i; ?>][delete]" /></td>
- <td><input type="text" size="10" class="text" name="opml[<?=$i; ?>][name]" value="<?=$opml_person->getName(); ?>" /></td>
- <td>
- <?php
- $items = $opml_person->get_items();
- if (count($items) > 0) {
- echo $items[0]->get_date();
- } else {
- echo "Not in cache";
- }
- ?>
- </td>
- <td><input type="text" size="30" class="text" name="opml[<?=$i; ?>][website]" value="<?=$opml_person->getWebsite(); ?>" /></td>
- <td><input type="text" size="30" class="text" name="opml[<?=$i; ?>][feed]" value="<?=$opml_person->getFeed(); ?>" /></td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- </form>
- </div>
-<?php
-$page_content = ob_get_contents();
-ob_end_clean();
-
-$admin_access = 1;
-require_once dirname(__FILE__) . '/template.php';
+<?php
+
+require_once dirname(__FILE__) . '/inc/auth.inc.php';
+require_once dirname(__FILE__) . '/../app/app.php';
+
+//Load configuration
+$config_file = dirname(__FILE__) . '/../custom/config.yml';
+
+if (is_file($config_file)){
+ $conf = Spyc::YAMLLoad($config_file);
+ $PlanetConfig = new PlanetConfig($conf);
+} else {
+ die('Config file (custom/config.yml) is missing.');
+}
+
+//Instantiate app
+$Planet = new Planet($PlanetConfig);
+
+//Load
+if (0 < $Planet->loadOpml(dirname(__FILE__) . '/../custom/people.opml')) {
+ $Planet->loadFeeds();
+ $items = $Planet->getItems();
+}
+
+$everyone = $Planet->getPeople();
+$count_feeds = count($everyone);
+$page_id = 'admin-feed';
+$footer_extra = <<<FRAGMENT
+ <script>
+ var allCheckboxes = function(status){
+ var form = document.getElementById('feedmanage');
+ var selectboxes = form.getElementsByTagName('input');
+ for (var i=0; i<selectboxes.length; i++){
+ if ('checkbox' == selectboxes[i].type){
+ selectboxes[i].checked = status;
+ }
+ }
+ }
+
+ window.onload = function(){
+ //Select/unselect rows
+ var form = document.getElementById('feedmanage');
+ var selectboxes = form.getElementsByTagName('input');
+ for (var i=0; i<selectboxes.length; i++){
+ if ('checkbox' == selectboxes[i].type) {
+ selectboxes[i].onchange = function() {
+ var tr = this.parentNode.parentNode;
+ if (this.checked) {
+ tr.className += ' selected';
+ } else {
+ tr.className = tr.className.replace('selected','');
+ }
+ }
+ }
+ }
+
+ var btSelectall = document.getElementById('selectall');
+ btSelectall.onclick = function(){
+ allCheckboxes('checked');
+ }
+
+ var btSelectnone = document.getElementById('selectnone');
+ btSelectnone.onclick = function(){
+ allCheckboxes('');
+ }
+ }
+ </script>
+FRAGMENT;
+
+ob_start();
+?>
+
+ <div class="widget">
+ <h3>Add a new feed</h3>
+ <form action="subscriptions.php" method="post" id="feedimport">
+ <fieldset>
+ <label for="url">Link:</label>
+ <input type="text" class="text" name="url" id="url" value="http://" class="text" size="50" />
+ <input type="submit" class="submit add" name="add" value="Add feed" />
+ </fieldset>
+ <p class="help">Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed.</p>
+ </form>
+ </div>
+
+ <div class="widget">
+ <h3>Manage existing feeds</h3>
+ <form action="subscriptions.php" method="post" id="feedmanage">
+ <p class="action">
+ <span class="count">Number of feeds: <?=$count_feeds?></span>
+ <input type="submit" class="submit save" name="save" id="save" value="Save changes" />
+ <input type="submit" class="submit delete" name="delete" id="delete" value="Delete selected" />
+ </p>
+ <p class="select">Select : <a href="javascript:void(0);" id="selectall">All</a>, <a href="javascript:void(0);" id="selectnone">None</a></p>
+ <table>
+ <thead>
+ <tr>
+ <th><span>Selection</span></th>
+ <th>Name</th>
+ <th>Last entry</th>
+ <th>Website link</th>
+ <th>Feed link</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php
+ $i = 0;
+ foreach ($everyone as $opml_person){
+ $i++;
+ ?>
+ <tr class="<?=($i%2)?'odd':'even'; ?>">
+ <td><input type="checkbox" class="checkbox" name="opml[<?=$i; ?>][delete]" /></td>
+ <td><input type="text" size="10" class="text" name="opml[<?=$i; ?>][name]" value="<?=$opml_person->getName(); ?>" /></td>
+ <td>
+ <?php
+ $items = $opml_person->get_items();
+ if (count($items) > 0) {
+ echo $items[0]->get_date();
+ } else {
+ echo "Not in cache";
+ }
+ ?>
+ </td>
+ <td><input type="text" size="30" class="text" name="opml[<?=$i; ?>][website]" value="<?=$opml_person->getWebsite(); ?>" /></td>
+ <td><input type="text" size="30" class="text" name="opml[<?=$i; ?>][feed]" value="<?=$opml_person->getFeed(); ?>" /></td>
+ </tr>
+ <?php } ?>
+ </tbody>
+ </table>
+ </form>
+ </div>
+<?php
+$page_content = ob_get_contents();
+ob_end_clean();
+
+$admin_access = 1;
+require_once dirname(__FILE__) . '/template.php';
diff --git a/app/classes/Planet.class.php b/app/classes/Planet.class.php
index f327fd9..45264b2 100644
--- a/app/classes/Planet.class.php
+++ b/app/classes/Planet.class.php
@@ -1,144 +1,144 @@
-<?php
-/*
-Copyright (c) 2006, Maurice Svay
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-* Neither the name of Maurice Svay nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/**
- * Planet, main app class
- */
-class Planet{
- var $config;
- var $items;
- var $people;
-
- var $errors;
-
- function Planet($config=null) {
- if ($config == null){
- $this->config = new PlanetConfig(array());
- }
- else{
- $this->config = $config;
- }
- $this->items = array();
- $this->people = array();
- $this->errors = array();
- }
-
- /**
- * Getters
- */
- function getItems() {
- return $this->items;
- }
- function getPeople() {
- return $this->people;
- }
-
- /**
- * Adds a feed to the planet
- * @param PlanetFeed feed
- */
- function addPerson(&$feed) {
- $this->people[] = $feed;
- }
-
- /**
- * Load people from an OPML
- * @return integer Number of people loaded
- */
- function loadOpml($file) {
- if (!is_file($file)){
- $this->errors[] = new PlanetError(3, $file.' is missing.');
- return 0;
- }
- $opml = OpmlManager::load($file);
- $opml_people = $opml->getPeople();
- foreach ($opml_people as $opml_person){
- $this->addPerson(
- new PlanetFeed(
- $opml_person['name'],
- $opml_person['feed'],
- $opml_person['website']
- )
- );
- }
- return count($opml_people);
- }
-
- /**
- * Load feeds
- */
- function loadFeeds() {
- foreach ($this->people as $person) {
- $person->set_timeout(-1);
- $person->init();
- $this->items = array_merge($this->items, $person->get_items());
- }
- $this->sort();
- }
-
- /**
- * Download
- * @var $max_load percentage of feeds to load
- */
- function download($max_load=0.1){
-
- $max_load_feeds = ceil(count($this->people) * $max_load);
-
- foreach ($this->people as $person) {
- //Avoid mass loading with variable cache duration
- //$person->set_cache_duration($this->config->getCacheTimeout()+rand(0,30));
- $person->set_cache_duration($this->config->getCacheTimeout());
-
- //Load only a few feeds, force other to fetch from the cache
- if (0 > $max_load_feeds--) {
- $person->set_timeout(-1);
- $this->errors[] = new PlanetError(1, 'Forced from cache : '.$person->getFeed());
- }
-
- //Load feed
- $person->init();
-
- // http://simplepie.org/wiki/reference/simplepie/merge_items ?
- //Add items to index
- if (($person->data) && ($person->get_item_quantity() > 0)){
- $items = $person->get_items();
- $this->items = array_merge($this->items, $items);
- } else {
- $this->errors[] = new PlanetError(1, 'No items : '.$person->getFeed());
- }
- }
- }
-
- function sort() {
- usort($this->items, array('PlanetItem','compare'));
- }
-}
-?>
+<?php
+/*
+Copyright (c) 2006, Maurice Svay
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of Maurice Svay nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/**
+ * Planet, main app class
+ */
+class Planet{
+ var $config;
+ var $items;
+ var $people;
+
+ var $errors;
+
+ function Planet($config=null) {
+ if ($config == null){
+ $this->config = new PlanetConfig(array());
+ }
+ else{
+ $this->config = $config;
+ }
+ $this->items = array();
+ $this->people = array();
+ $this->errors = array();
+ }
+
+ /**
+ * Getters
+ */
+ function getItems() {
+ return $this->items;
+ }
+ function getPeople() {
+ return $this->people;
+ }
+
+ /**
+ * Adds a feed to the planet
+ * @param PlanetFeed feed
+ */
+ function addPerson(&$feed) {
+ $this->people[] = $feed;
+ }
+
+ /**
+ * Load people from an OPML
+ * @return integer Number of people loaded
+ */
+ function loadOpml($file) {
+ if (!is_file($file)){
+ $this->errors[] = new PlanetError(3, $file.' is missing.');
+ return 0;
+ }
+ $opml = OpmlManager::load($file);
+ $opml_people = $opml->getPeople();
+ foreach ($opml_people as $opml_person){
+ $this->addPerson(
+ new PlanetFeed(
+ $opml_person['name'],
+ $opml_person['feed'],
+ $opml_person['website']
+ )
+ );
+ }
+ return count($opml_people);
+ }
+
+ /**
+ * Load feeds
+ */
+ function loadFeeds() {
+ foreach ($this->people as $person) {
+ $person->set_timeout(-1);
+ $person->init();
+ $this->items = array_merge($this->items, $person->get_items());
+ }
+ $this->sort();
+ }
+
+ /**
+ * Download
+ * @var $max_load percentage of feeds to load
+ */
+ function download($max_load=0.1){
+
+ $max_load_feeds = ceil(count($this->people) * $max_load);
+
+ foreach ($this->people as $person) {
+ //Avoid mass loading with variable cache duration
+ //$person->set_cache_duration($this->config->getCacheTimeout()+rand(0,30));
+ $person->set_cache_duration($this->config->getCacheTimeout());
+
+ //Load only a few feeds, force other to fetch from the cache
+ if (0 > $max_load_feeds--) {
+ $person->set_timeout(-1);
+ $this->errors[] = new PlanetError(1, 'Forced from cache : '.$person->getFeed());
+ }
+
+ //Load feed
+ $person->init();
+
+ // http://simplepie.org/wiki/reference/simplepie/merge_items ?
+ //Add items to index
+ if (($person->data) && ($person->get_item_quantity() > 0)){
+ $items = $person->get_items();
+ $this->items = array_merge($this->items, $items);
+ } else {
+ $this->errors[] = new PlanetError(1, 'No items : '.$person->getFeed());
+ }
+ }
+ }
+
+ function sort() {
+ usort($this->items, array('PlanetItem','compare'));
+ }
+}
+?>
diff --git a/app/lib/Cache.php b/app/lib/Cache.php
index 9425de3..c028110 100644
--- a/app/lib/Cache.php
+++ b/app/lib/Cache.php
@@ -1,20 +1,20 @@
<?php
-/**
-* This library is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this software; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*
-* © Copyright 2005 Richard Heyes
+/**
+* This library is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this software; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*
+* © Copyright 2005 Richard Heyes
*/
/**
diff --git a/app/lib/lib.opml.php b/app/lib/lib.opml.php
index 21890d2..7767979 100644
--- a/app/lib/lib.opml.php
+++ b/app/lib/lib.opml.php
@@ -1,109 +1,109 @@
-<?php
-class opml
-{
- var $_xml = null;
- var $_currentTag = '';
-
- var $title = '';
- var $entries = array();
- var $map =
- array(
- 'URL' => 'website',
- 'HTMLURL' => 'website',
- 'TEXT' => 'name',
- 'TITLE' => 'name',
- 'XMLURL' => 'feed',
- 'DESCRIPTION' => 'description'
- );
-
-
- function parse($data)
- {
- $this->_xml = xml_parser_create('UTF-8');
- //xml_parser_set_option($this->_xml, XML_OPTION_CASE_FOLDING, false);
- //xml_parser_set_option($this->_xml, XML_OPTION_SKIP_WHITE, true);
- xml_set_object($this->_xml, $this);
- xml_set_element_handler($this->_xml,'_openTag','_closeTag');
- xml_set_character_data_handler ($this->_xml, '_cData');
-
- xml_parse($this->_xml,$data);
- xml_parser_free($this->_xml);
- return $this->entries;
- }
-
-
- function _openTag($p,$tag,$attrs)
- {
- $this->_currentTag = $tag;
-
- if ($tag == 'OUTLINE')
- {
- $i = count($this->entries);
- foreach (array_keys($this->map) as $key)
- {
- if (isset($attrs[$key])) {
- $this->entries[$i][$this->map[$key]] = $attrs[$key];
- }
- }
- }
- }
-
- function _closeTag($p, $tag){
- $this->_currentTag = '';
- }
-
- function _cData($p, $cdata){
- if ($this->_currentTag == 'TITLE'){
- $this->title = $cdata;
- }
- }
-
- function getTitle(){
- return $this->title;
- }
-
- function getPeople(){
- return $this->entries;
- }
-}
-
-class OpmlManager
-{
- public function load($file) {
- if (@file_exists($file)) {
- $opml = new opml();
-
- //Remove BOM if needed
- $BOM = '/^/';
- $fileContent = file_get_contents($file);
- $fileContent = preg_replace($BOM, '', $fileContent, 1);
-
- //Parse
- $opml->parse($fileContent);
-
- return $opml;
- }
- }
-
- public function save($opml, $file){
- $out = '<?xml version="1.0"?>'."\n";
- $out.= '<opml version="1.1">'."\n";
- $out.= '<head>'."\n";
- $out.= '<title>'.htmlspecialchars($opml->getTitle()).'</title>'."\n";
- $out.= '<dateCreated>'.date('c').'</dateCreated>'."\n";
- $out.= '<dateModified>'.date('c').'</dateModified>'."\n";
- $out.= '</head>'."\n";
- $out.= '<body>'."\n";
- foreach ($opml->entries as $person){
- $out.= '<outline text="' . htmlspecialchars($person['name']) . '" htmlUrl="' . htmlspecialchars($person['website']) . '" xmlUrl="' . htmlspecialchars($person['feed']) . '"/>'."\n";
- }
- $out.= '</body>'."\n";
- $out.= '</opml>';
-
- file_put_contents($file, $out);
- }
-
- public function backup($file){
- copy($file, $file.'.bak');
- }
-}
+<?php
+class opml
+{
+ var $_xml = null;
+ var $_currentTag = '';
+
+ var $title = '';
+ var $entries = array();
+ var $map =
+ array(
+ 'URL' => 'website',
+ 'HTMLURL' => 'website',
+ 'TEXT' => 'name',
+ 'TITLE' => 'name',
+ 'XMLURL' => 'feed',
+ 'DESCRIPTION' => 'description'
+ );
+
+
+ function parse($data)
+ {
+ $this->_xml = xml_parser_create('UTF-8');
+ //xml_parser_set_option($this->_xml, XML_OPTION_CASE_FOLDING, false);
+ //xml_parser_set_option($this->_xml, XML_OPTION_SKIP_WHITE, true);
+ xml_set_object($this->_xml, $this);
+ xml_set_element_handler($this->_xml,'_openTag','_closeTag');
+ xml_set_character_data_handler ($this->_xml, '_cData');
+
+ xml_parse($this->_xml,$data);
+ xml_parser_free($this->_xml);
+ return $this->entries;
+ }
+
+
+ function _openTag($p,$tag,$attrs)
+ {
+ $this->_currentTag = $tag;
+
+ if ($tag == 'OUTLINE')
+ {
+ $i = count($this->entries);
+ foreach (array_keys($this->map) as $key)
+ {
+ if (isset($attrs[$key])) {
+ $this->entries[$i][$this->map[$key]] = $attrs[$key];
+ }
+ }
+ }
+ }
+
+ function _closeTag($p, $tag){
+ $this->_currentTag = '';
+ }
+
+ function _cData($p, $cdata){
+ if ($this->_currentTag == 'TITLE'){
+ $this->title = $cdata;
+ }
+ }
+
+ function getTitle(){
+ return $this->title;
+ }
+
+ function getPeople(){
+ return $this->entries;
+ }
+}
+
+class OpmlManager
+{
+ public function load($file) {
+ if (@file_exists($file)) {
+ $opml = new opml();
+
+ //Remove BOM if needed
+ $BOM = '/^/';
+ $fileContent = file_get_contents($file);
+ $fileContent = preg_replace($BOM, '', $fileContent, 1);
+
+ //Parse
+ $opml->parse($fileContent);
+
+ return $opml;
+ }
+ }
+
+ public function save($opml, $file){
+ $out = '<?xml version="1.0"?>'."\n";
+ $out.= '<opml version="1.1">'."\n";
+ $out.= '<head>'."\n";
+ $out.= '<title>'.htmlspecialchars($opml->getTitle()).'</title>'."\n";
+ $out.= '<dateCreated>'.date('c').'</dateCreated>'."\n";
+ $out.= '<dateModified>'.date('c').'</dateModified>'."\n";
+ $out.= '</head>'."\n";
+ $out.= '<body>'."\n";
+ foreach ($opml->entries as $person){
+ $out.= '<outline text="' . htmlspecialchars($person['name']) . '" htmlUrl="' . htmlspecialchars($person['website']) . '" xmlUrl="' . htmlspecialchars($person['feed']) . '"/>'."\n";
+ }
+ $out.= '</body>'."\n";
+ $out.= '</opml>';
+
+ file_put_contents($file, $out);
+ }
+
+ public function backup($file){
+ copy($file, $file.'.bak');
+ }
+}
diff --git a/cron.php b/cron.php
index 1098e9b..77d9d8f 100644
--- a/cron.php
+++ b/cron.php
@@ -1,9 +1,9 @@
-<?php
-include_once(dirname(__FILE__).'/app/app.php');
-
-//Load OPML
-if (0 < $Planet->loadOpml(dirname(__FILE__).'/custom/people.opml')) {
- $Planet->download(1.0);
-}
-
+<?php
+include_once(dirname(__FILE__).'/app/app.php');
+
+//Load OPML
+if (0 < $Planet->loadOpml(dirname(__FILE__).'/custom/people.opml')) {
+ $Planet->download(1.0);
+}
+
var_dump($Planet->errors);
diff --git a/custom/style/default.css b/custom/style/default.css
index 2095ff1..de813ac 100644
--- a/custom/style/default.css
+++ b/custom/style/default.css
@@ -1,58 +1,58 @@
-html{
- font-family: "Lucida Grande", "Segoe UI", sans-serif;
- color: #111;
- background: #EEE;
- font-size: 62.5%;
-}
-
-body{
- margin: 0;
- padding: 0;
- font-size: 1.3em;
- line-height: 1.5em;
-}
-
-a{
- color: #669;
-}
-
-a:visited{
- color: #444;
-}
-
-a:hover{
- color: #000;
-}
-
-a img{
- border: none;
-}
-
+html{
+ font-family: "Lucida Grande", "Segoe UI", sans-serif;
+ color: #111;
+ background: #EEE;
+ font-size: 62.5%;
+}
+
+body{
+ margin: 0;
+ padding: 0;
+ font-size: 1.3em;
+ line-height: 1.5em;
+}
+
+a{
+ color: #669;
+}
+
+a:visited{
+ color: #444;
+}
+
+a:hover{
+ color: #000;
+}
+
+a img{
+ border: none;
+}
+
pre, code{
max-height: 100%;
- width: 100%;
+ width: 100%;
font-size: 1.2em;
- overflow: auto;
-}
-
-h1, h2{
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
-}
-
-h2{
- margin: 0;
-}
-
-#page {
- width: 890px;
- margin: 0 auto;
-}
+ overflow: auto;
+}
+
+h1, h2{
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+}
+
+h2{
+ margin: 0;
+}
+
+#page {
+ width: 890px;
+ margin: 0 auto;
+}
/* Header
-*******************************************************************************/
-#top {
- color: #FFF;
- padding: 10px 30px;
+*******************************************************************************/
+#top {
+ color: #FFF;
+ padding: 10px 30px;
}
h1 a,
h1 a:visited {
@@ -61,63 +61,63 @@ h2{
}
h1 a:hover {
color: #444;
- }
+ }
/* Content
-*******************************************************************************/
-#content {
- width: 590px;
- float: left;
-}
+*******************************************************************************/
+#content {
+ width: 590px;
+ float: left;
+}
/* Sidebar
-*******************************************************************************/
-#sidebar {
- width: 300px;
- float: left;
-}
- #sidebar div {
- padding: 1em 30px;
+*******************************************************************************/
+#sidebar {
+ width: 300px;
+ float: left;
+}
+ #sidebar div {
+ padding: 1em 30px;
}
#sidebar h2 {
color: #665;
- }
- #sidebar ul {
- list-style: none;
- padding: 0;
- margin: 1em 0;
- }
-
+ }
+ #sidebar ul {
+ list-style: none;
+ padding: 0;
+ margin: 1em 0;
+ }
+
/* Article
-*******************************************************************************/
-.article{
- margin-bottom: 2em;
- padding: 30px;
- background: #FFF;
- border: 1px solid #DDD;
-}
-
- .article-title,
- .article-title a{
- color: #111;
- text-decoration: none;
- }
-
- .article-info{
- margin: 0 0 1em 0;
- color: #999;
+*******************************************************************************/
+.article{
+ margin-bottom: 2em;
+ padding: 30px;
+ background: #FFF;
+ border: 1px solid #DDD;
+}
+
+ .article-title,
+ .article-title a{
+ color: #111;
+ text-decoration: none;
+ }
+
+ .article-info{
+ margin: 0 0 1em 0;
+ color: #999;
}
.article-content {
font-family: Georgia, serif;
- }
-
- .article img{
- max-width: 440px;
- }
-
- .article .collapsed{
- display: none;
+ }
+
+ .article img{
+ max-width: 440px;
+ }
+
+ .article .collapsed{
+ display: none;
}
/* Footer
diff --git a/custom/views/archive/index.tpl.php b/custom/views/archive/index.tpl.php
index 8f45fa0..c09e266 100644
--- a/custom/views/archive/index.tpl.php
+++ b/custom/views/archive/index.tpl.php
@@ -1,4 +1,4 @@
-<?php
+<?php
$count = 0;
$today = Array();
$week = Array();
@@ -19,23 +19,23 @@ foreach ($items as $item) {
}
}
-header('Content-type: text/html; charset=UTF-8');
-?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <meta http-equiv="Content-Style-Type" content="text/css" />
-
- <title><?php echo $PlanetConfig->getName(); ?></title>
- <?php include(dirname(__FILE__).'/head.tpl.php'); ?>
-</head>
-
-<body>
- <div id="page">
- <?php include(dirname(__FILE__).'/top.tpl.php'); ?>
-
+header('Content-type: text/html; charset=UTF-8');
+?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+
+ <title><?php echo $PlanetConfig->getName(); ?></title>
+ <?php include(dirname(__FILE__).'/head.tpl.php'); ?>
+</head>
+
+<body>
+ <div id="page">
+ <?php include(dirname(__FILE__).'/top.tpl.php'); ?>
+
<div id="content">
<?php if (0 == count($items)) :?>
<div class="article">
@@ -47,15 +47,15 @@ header('Content-type: text/html; charset=UTF-8');
<?php endif; ?>
<?php if (count($today)): ?>
<div class="article">
- <h2>Today</h2>
- <ul>
+ <h2>Today</h2>
+ <ul>
<?php foreach ($today as $item): ?>
- <?php $feed = $item->get_feed(); ?>
+ <?php $feed = $item->get_feed(); ?>
<li>
- <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
- <a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a>
- </li>
- <?php endforeach; ?>
+ <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> :
+ <a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a>
+ </li>
+ <?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
@@ -103,12 +103,12 @@ header('Content-type: text/html; charset=UTF-8');
<?php endforeach; ?>
</ul>
</div>
- <?php endif; ?>
- </div>
-
- <?php include_once(dirname(__FILE__).'/sidebar.tpl.php'); ?>
-
- <?php include(dirname(__FILE__).'/footer.tpl.php'); ?>
- </div>
-</body>
-</html>
+ <?php endif; ?>
+ </div>
+
+ <?php include_once(dirname(__FILE__).'/sidebar.tpl.php'); ?>
+
+ <?php include(dirname(__FILE__).'/footer.tpl.php'); ?>
+ </div>
+</body>
+</html>
diff --git a/custom/views/atom10/index.tpl.php b/custom/views/atom10/index.tpl.php
index d515961..6e03980 100644
--- a/custom/views/atom10/index.tpl.php
+++ b/custom/views/atom10/index.tpl.php
@@ -1,29 +1,29 @@
-<?php
-$limit = $PlanetConfig->getMaxDisplay();
-$count = 0;
-
-header('Content-Type: application/atom+xml; charset=UTF-8');
-echo '<?xml version="1.0" encoding="UTF-8" ?>';
-?><feed xmlns="http://www.w3.org/2005/Atom">
- <title><?php echo $PlanetConfig->getName(); ?></title>
- <subtitle></subtitle>
- <id><?php echo $PlanetConfig->getUrl(); ?></id>
- <link rel="self" type="text/html" href="<?php echo $PlanetConfig->getUrl(); ?>?type=atom10" />
- <link rel="alternate" type="text/html" href="<?php echo $PlanetConfig->getUrl(); ?>" />
- <updated><?php echo date("Y-m-d\TH:i:s\Z") ?></updated>
- <author><name>Author</name></author>
-
- <?php $count = 0; ?>
- <?php foreach ($items as $item): ?>
- <entry xmlns="http://www.w3.org/2005/Atom">
- <title type="html"><?php echo htmlspecialchars($item->get_feed()->getName()); ?> : <?php echo htmlspecialchars($item->get_title());?></title>
- <id><?php echo htmlspecialchars($item->get_permalink());?></id>
- <link rel="alternate" href="<?php echo htmlspecialchars($item->get_permalink());?>"/>
- <published><?php echo $item->get_date('Y-m-d\\TH:i:s+00:00'); ?></published>
- <author><name><?php echo ($item->get_author()? $item->get_author()->get_name() : 'anonymous'); ?></name></author>
-
- <content type="html"><![CDATA[<?php echo $item->get_content();?>]]></content>
- </entry>
- <?php if (++$count == $limit) { break; } ?>
- <?php endforeach; ?>
-</feed>
+<?php
+$limit = $PlanetConfig->getMaxDisplay();
+$count = 0;
+
+header('Content-Type: application/atom+xml; charset=UTF-8');
+echo '<?xml version="1.0" encoding="UTF-8" ?>';
+?><feed xmlns="http://www.w3.org/2005/Atom">
+ <title><?php echo $PlanetConfig->getName(); ?></title>
+ <subtitle></subtitle>
+ <id><?php echo $PlanetConfig->getUrl(); ?></id>
+ <link rel="self" type="text/html" href="<?php echo $PlanetConfig->getUrl(); ?>?type=atom10" />
+ <link rel="alternate" type="text/html" href="<?php echo $PlanetConfig->getUrl(); ?>" />
+ <updated><?php echo date("Y-m-d\TH:i:s\Z") ?></updated>
+ <author><name>Author</name></author>
+
+ <?php $count = 0; ?>
+ <?php foreach ($items as $item): ?>
+ <entry xmlns="http://www.w3.org/2005/Atom">
+ <title type="html"><?php echo htmlspecialchars($item->get_feed()->getName()); ?> : <?php echo htmlspecialchars($item->get_title());?></title>
+ <id><?php echo htmlspecialchars($item->get_permalink());?></id>
+ <link rel="alternate" href="<?php echo htmlspecialchars($item->get_permalink());?>"/>
+ <published><?php echo $item->get_date('Y-m-d\\TH:i:s+00:00'); ?></published>
+ <author><name><?php echo ($item->get_author()? $item->get_author()->get_name() : 'anonymous'); ?></name></author>
+
+ <content type="html"><![CDATA[<?php echo $item->get_content();?>]]></content>
+ </entry>
+ <?php if (++$count == $limit) { break; } ?>
+ <?php endforeach; ?>
+</feed>
diff --git a/custom/views/default/index.tpl.php b/custom/views/default/index.tpl.php
index 4f82e46..9efc5f7 100644
--- a/custom/views/default/index.tpl.php
+++ b/custom/views/default/index.tpl.php
@@ -1,27 +1,27 @@
-<?php
-$limit = $PlanetConfig->getMaxDisplay();
+<?php
+$limit = $PlanetConfig->getMaxDisplay();
$count = 0;
-header('Content-type: text/html; charset=UTF-8');
-?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <meta http-equiv="Content-Style-Type" content="text/css" />
-
- <title><?php echo $PlanetConfig->getName(); ?></title>
- <?php include(dirname(__FILE__).'/head.tpl.php'); ?>
-</head>
-
-<body>
- <script type="text/javascript">
- document.body.className += 'js';
- </script>
- <div id="page">
- <?php include(dirname(__FILE__).'/top.tpl.php'); ?>
-
+header('Content-type: text/html; charset=UTF-8');
+?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+
+ <title><?php echo $PlanetConfig->getName(); ?></title>
+ <?php include(dirname(__FILE__).'/head.tpl.php'); ?>
+</head>
+
+<body>
+ <script type="text/javascript">
+ document.body.className += 'js';
+ </script>
+ <div id="page">
+ <?php include(dirname(__FILE__).'/top.tpl.php'); ?>
+
<div id="content">
<?php if (0 == count($items)) : ?>
<div class="article">
@@ -30,23 +30,23 @@ header('Content-type: text/html; charset=UTF-8');
</h2>
<p class="article-content">No news, good news.</p>
</div>
- <?php else : ?>
+ <?php else : ?>
<?php foreach ($items as $item): ?>
<?php
$arParsedUrl = parse_url($item->get_feed()->getWebsite());
$host = 'from-' . preg_replace('/[^a-zA-Z0-9]/i', '-', $arParsedUrl['host']);
- ?>
- <div class="article <?php echo $host; ?>">
- <h2 class="article-title">
- <a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a>
- </h2>
- <p class="article-info">
-
- <?php echo ($item->get_author()? $item->get_author()->get_name() : 'Anonymous'); ?>,
- <?php
- $ago = time() - $item->get_date('U');
- //echo '<span title="'.Duration::toString($ago).' ago" class="date">'.date('d/m/Y', $item->get_date('U')).'</span>';
- echo '<span id="post'.$item->get_date('U').'" class="date">'.$item->get_date('d/m/Y').'</span>';
+ ?>
+ <div class="article <?php echo $host; ?>">
+ <h2 class="article-title">
+ <a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a>
+ </h2>
+ <p class="article-info">
+
+ <?php echo ($item->get_author()? $item->get_author()->get_name() : 'Anonymous'); ?>,
+ <?php
+ $ago = time() - $item->get_date('U');
+ //echo '<span title="'.Duration::toString($ago).' ago" class="date">'.date('d/m/Y', $item->get_date('U')).'</span>';
+ echo '<span id="post'.$item->get_date('U').'" class="date">'.$item->get_date('d/m/Y').'</span>';
?>
|
@@ -54,20 +54,20 @@ header('Content-type: text/html; charset=UTF-8');
Source: <?php
$feed = $item->get_feed();
echo '<a href="'.$feed->getWebsite().'" class="source">'.$feed->getName().'</a>';
- ?>
- </p>
- <div class="article-content">
- <?php echo $item->get_content(); ?>
- </div>
- </div>
- <?php if (++$count == $limit) { break; } ?>
+ ?>
+ </p>
+ <div class="article-content">
+ <?php echo $item->get_content(); ?>
+ </div>
+ </div>
+ <?php if (++$count == $limit) { break; } ?>
<?php endforeach; ?>
- <?php endif; ?>
- </div>
-
- <?php include_once(dirname(__FILE__).'/sidebar.tpl.php'); ?>
-
- <?php include(dirname(__FILE__).'/footer.tpl.php'); ?>
- </div>
-</body>
-</html>
+ <?php endif; ?>
+ </div>
+
+ <?php include_once(dirname(__FILE__).'/sidebar.tpl.php'); ?>
+
+ <?php include(dirname(__FILE__).'/footer.tpl.php'); ?>
+ </div>
+</body>
+</html>
diff --git a/custom/views/rss10/index.tpl.php b/custom/views/rss10/index.tpl.php
index 7d07196..0141327 100644
--- a/custom/views/rss10/index.tpl.php
+++ b/custom/views/rss10/index.tpl.php
@@ -1,49 +1,49 @@
-<?php
-$limit = $PlanetConfig->getMaxDisplay();
+<?php
+$limit = $PlanetConfig->getMaxDisplay();
$count = 0;
header('Content-Type: text/xml; charset=UTF-8');
-echo '<?xml version="1.0" encoding="UTF-8" ?>';
-?><rdf:RDF
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
- xmlns:admin="http://webns.net/mvcb/"
- xmlns:cc="http://web.resource.org/cc/"
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
- xmlns="http://purl.org/rss/1.0/">
-
- <channel rdf:about="<?php echo $PlanetConfig->getUrl(); ?>">
- <title><?php echo $PlanetConfig->getName(); ?></title>
- <description></description>
- <link><?php echo $PlanetConfig->getUrl(); ?></link>
- <dc:language></dc:language>
- <dc:creator></dc:creator>
- <dc:rights></dc:rights>
- <dc:date><?php echo date('Y-m-d\\TH:i:s+00:00'); ?></dc:date>
- <admin:generatorAgent rdf:resource="http://moonmoon.inertie.org/" />
-
- <items>
- <rdf:Seq>
- <?php foreach ($items as $item): ?>
- <rdf:li rdf:resource="<?php echo $item->get_permalink(); ?>"/>
- <?php if (++$count == $limit) { break; } ?>
- <?php endforeach; ?>
- </rdf:Seq>
- </items>
- </channel>
-
- <?php $count = 0; ?>
- <?php foreach ($items as $item): ?>
- <item rdf:about="<?php echo $item->get_permalink();?>">
- <title><?php echo htmlspecialchars($item->get_feed()->getName()) ?> : <?php echo htmlspecialchars($item->get_title());?></title>
- <link><?php echo htmlspecialchars($item->get_permalink());?></link>
- <dc:date><?php echo date('Y-m-d\\TH:i:s+00:00',$item->get_date('U')); ?></dc:date>
- <dc:creator><?php echo htmlspecialchars($item->get_author()? $item->get_author()->get_name() : 'anonymous') ?></dc:creator>
- <description><?php echo htmlspecialchars($item->get_content()); ?></description>
- <content:encoded><![CDATA[<?php echo $item->get_content();?>]]></content:encoded>
- </item>
- <?php if (++$count == $limit) { break; } ?>
- <?php endforeach; ?>
-
+echo '<?xml version="1.0" encoding="UTF-8" ?>';
+?><rdf:RDF
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+ xmlns:admin="http://webns.net/mvcb/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:content="http://purl.org/rss/1.0/modules/content/"
+ xmlns="http://purl.org/rss/1.0/">
+
+ <channel rdf:about="<?php echo $PlanetConfig->getUrl(); ?>">
+ <title><?php echo $PlanetConfig->getName(); ?></title>
+ <description></description>
+ <link><?php echo $PlanetConfig->getUrl(); ?></link>
+ <dc:language></dc:language>
+ <dc:creator></dc:creator>
+ <dc:rights></dc:rights>
+ <dc:date><?php echo date('Y-m-d\\TH:i:s+00:00'); ?></dc:date>
+ <admin:generatorAgent rdf:resource="http://moonmoon.inertie.org/" />
+
+ <items>
+ <rdf:Seq>
+ <?php foreach ($items as $item): ?>
+ <rdf:li rdf:resource="<?php echo $item->get_permalink(); ?>"/>
+ <?php if (++$count == $limit) { break; } ?>
+ <?php endforeach; ?>
+ </rdf:Seq>
+ </items>
+ </channel>
+
+ <?php $count = 0; ?>
+ <?php foreach ($items as $item): ?>
+ <item rdf:about="<?php echo $item->get_permalink();?>">
+ <title><?php echo htmlspecialchars($item->get_feed()->getName()) ?> : <?php echo htmlspecialchars($item->get_title());?></title>
+ <link><?php echo htmlspecialchars($item->get_permalink());?></link>
+ <dc:date><?php echo date('Y-m-d\\TH:i:s+00:00',$item->get_date('U')); ?></dc:date>
+ <dc:creator><?php echo htmlspecialchars($item->get_author()? $item->get_author()->get_name() : 'anonymous') ?></dc:creator>
+ <description><?php echo htmlspecialchars($item->get_content()); ?></description>
+ <content:encoded><![CDATA[<?php echo $item->get_content();?>]]></content:encoded>
+ </item>
+ <?php if (++$count == $limit) { break; } ?>
+ <?php endforeach; ?>
+
</rdf:RDF> \ No newline at end of file
diff --git a/index.php b/index.php
index cf23238..e8644c2 100644
--- a/index.php
+++ b/index.php
@@ -1,37 +1,37 @@
<?php
include_once(dirname(__FILE__).'/app/app.php');
include_once(dirname(__FILE__).'/app/lib/Cache.php');
-
+
//Installed ?
-if (!isset($Planet)) {
+if (!isset($Planet)) {
echo '<p>You might want to <a href="install.php">install moonmoon</a>.</p>';
- exit;
-}
+ exit;
+}
//Load from cache
-$items = Array();
+$items = Array();
if (0 < $Planet->loadOpml(dirname(__FILE__).'/custom/people.opml')) {
- $Planet->loadFeeds();
- $items = $Planet->getItems();
+ $Planet->loadFeeds();
+ $items = $Planet->getItems();
}
//Prepare output cache
-Cache::$enabled = false;
+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
+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';
+ 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();
+
+if (!OutputCache::Start($_GET['type'], $cache_key, $cache_duration)) {
+ include_once(dirname(__FILE__).'/custom/views/'.$_GET['type'].'/index.tpl.php');
+ OutputCache::End();
}
echo "<!--";
diff --git a/postload.php b/postload.php
index 64fd42e..8f18678 100644
--- a/postload.php
+++ b/postload.php
@@ -1,16 +1,16 @@
-<?php
-include_once(dirname(__FILE__).'/app/app.php');
-
-$Planet->addPerson(
- new PlanetFeed(
- '',
- htmlspecialchars_decode($_GET['url'], ENT_QUOTES),
- ''
- )
-);
-
-//Load feeds
-$Planet->download(1);
-header("Content-type: image/png");
-readfile(dirname(__FILE__)."/custom/img/feed.png");
-die();
+<?php
+include_once(dirname(__FILE__).'/app/app.php');
+
+$Planet->addPerson(
+ new PlanetFeed(
+ '',
+ htmlspecialchars_decode($_GET['url'], ENT_QUOTES),
+ ''
+ )
+);
+
+//Load feeds
+$Planet->download(1);
+header("Content-type: image/png");
+readfile(dirname(__FILE__)."/custom/img/feed.png");
+die();