summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorMaurice Svay <maurice@svay.com>2010-02-16 15:23:41 +0000
committerMaurice Svay <maurice@svay.com>2010-02-16 15:23:41 +0000
commitec4326e4bab52c558d1f2564ab2fa0545f81b071 (patch)
tree2c7b9d1bd5a1ee72be2e40e4b45895877777aefe /admin
downloadplanet-ec4326e4bab52c558d1f2564ab2fa0545f81b071.tar
planet-ec4326e4bab52c558d1f2564ab2fa0545f81b071.tar.gz
planet-ec4326e4bab52c558d1f2564ab2fa0545f81b071.tar.bz2
planet-ec4326e4bab52c558d1f2564ab2fa0545f81b071.tar.xz
planet-ec4326e4bab52c558d1f2564ab2fa0545f81b071.zip
Initial commit
Diffstat (limited to 'admin')
-rw-r--r--admin/administration.php56
-rw-r--r--admin/changepassword.php10
-rw-r--r--admin/default.css232
-rw-r--r--admin/img/button-add.pngbin0 -> 244 bytes
-rw-r--r--admin/img/button-delete.pngbin0 -> 201 bytes
-rw-r--r--admin/img/button-h.pngbin0 -> 212 bytes
-rw-r--r--admin/img/button.pngbin0 -> 212 bytes
-rw-r--r--admin/img/h3.pngbin0 -> 212 bytes
-rw-r--r--admin/img/moonmoon.pngbin0 -> 564 bytes
-rw-r--r--admin/img/nav-admin.pngbin0 -> 1519 bytes
-rw-r--r--admin/img/nav-feed.pngbin0 -> 1090 bytes
-rw-r--r--admin/inc/auth.inc.php11
-rw-r--r--admin/inc/nav.inc.php5
-rw-r--r--admin/inc/pwd.inc.php1
-rw-r--r--admin/index.php151
-rw-r--r--admin/login.php48
-rw-r--r--admin/logout.php5
-rw-r--r--admin/purgecache.php21
-rw-r--r--admin/subscriptions.php68
19 files changed, 608 insertions, 0 deletions
diff --git a/admin/administration.php b/admin/administration.php
new file mode 100644
index 0000000..9b37ec6
--- /dev/null
+++ b/admin/administration.php
@@ -0,0 +1,56 @@
+<?php
+require_once dirname(__FILE__).'/inc/auth.inc.php';
+
+require_once dirname(__FILE__).'/../app/lib/lib.opml.php';
+$opml = OpmlManager::load(dirname(__FILE__).'/../custom/people.opml');
+$opml_people = $opml->getPeople();
+?>
+<!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" />
+ <meta http-equiv="Content-Language" content="en" />
+
+ <title>moonmoon administration</title>
+ <link rel="stylesheet" media="screen" type="text/css" href="default.css" />
+ <script>
+ window.onload = function(){
+ var formManage = document.getElementById('frmPurge');
+ formManage.onsubmit = function(){
+ return confirm('Are you sure you want to purge the cache?');
+ }
+ }
+ </script>
+</head>
+
+<body id="admin-admin">
+ <div id="page">
+ <div id="header">
+ <h1>moonmoon</h1>
+ <p><a href="../">Back to main page</a></p>
+ </div>
+
+ <?php readfile("inc/nav.inc.php"); ?>
+
+ <div id="content">
+ <div class="widget">
+ <h3>Purge cache</h3>
+ <form action="purgecache.php" method="post" id="frmPurge">
+ <p><label>Purge cache:</label><input type="submit" class="submit delete" name="purge" id="purge" value="Purge" /></p>
+ <p class="help">Purging the cache will make moonmoon reload all feeds.</p>
+ </form>
+ </div>
+
+ <div class="widget">
+ <h3>Change administration password</h3>
+ <form action="changepassword.php" method="post" id="frmPassword">
+ <p><label for="password">New password:</label> <input type="password" class="text" value="" name="password" id="password" size="20" /> <input type="submit" class="submit delete" name="changepwd" id="changepwd" value="Change password" /></p>
+ </form>
+ </div>
+ </div>
+ </div>
+</body>
+</html> \ No newline at end of file
diff --git a/admin/changepassword.php b/admin/changepassword.php
new file mode 100644
index 0000000..1fa505e
--- /dev/null
+++ b/admin/changepassword.php
@@ -0,0 +1,10 @@
+<?php
+require_once dirname(__FILE__).'/inc/auth.inc.php';
+
+if (isset($_POST['password']) && ('' != $_POST['password'])){
+ $out = '<?php $login="admin"; $password="'.md5($_POST['password']).'"; ?>';
+ file_put_contents(dirname(__FILE__).'/inc/pwd.inc.php', $out);
+ die("Password changed. <a href='administration.php'>Login</a>");
+} else {
+ die('Can not change password');
+}
diff --git a/admin/default.css b/admin/default.css
new file mode 100644
index 0000000..ea2fe59
--- /dev/null
+++ b/admin/default.css
@@ -0,0 +1,232 @@
+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;
+ }
+
+/* Login form
+*******************************************************************************/
+form.login {
+ width: 400px;
+ margin: 0 auto;
+}
+form.login fieldset {
+ border: 1px solid #CCC;
+ text-align: center;
+}
+
+p.logout {
+ float: right;
+ margin: 20px 30px 0 0;
+}
+ p.logout a {
+ padding: 8px;
+ display: block;
+ } \ No newline at end of file
diff --git a/admin/img/button-add.png b/admin/img/button-add.png
new file mode 100644
index 0000000..859364a
--- /dev/null
+++ b/admin/img/button-add.png
Binary files differ
diff --git a/admin/img/button-delete.png b/admin/img/button-delete.png
new file mode 100644
index 0000000..7bfebc2
--- /dev/null
+++ b/admin/img/button-delete.png
Binary files differ
diff --git a/admin/img/button-h.png b/admin/img/button-h.png
new file mode 100644
index 0000000..0a43a6a
--- /dev/null
+++ b/admin/img/button-h.png
Binary files differ
diff --git a/admin/img/button.png b/admin/img/button.png
new file mode 100644
index 0000000..fad6ccc
--- /dev/null
+++ b/admin/img/button.png
Binary files differ
diff --git a/admin/img/h3.png b/admin/img/h3.png
new file mode 100644
index 0000000..0c86748
--- /dev/null
+++ b/admin/img/h3.png
Binary files differ
diff --git a/admin/img/moonmoon.png b/admin/img/moonmoon.png
new file mode 100644
index 0000000..26cc8f4
--- /dev/null
+++ b/admin/img/moonmoon.png
Binary files differ
diff --git a/admin/img/nav-admin.png b/admin/img/nav-admin.png
new file mode 100644
index 0000000..3077a54
--- /dev/null
+++ b/admin/img/nav-admin.png
Binary files differ
diff --git a/admin/img/nav-feed.png b/admin/img/nav-feed.png
new file mode 100644
index 0000000..00c896b
--- /dev/null
+++ b/admin/img/nav-feed.png
Binary files differ
diff --git a/admin/inc/auth.inc.php b/admin/inc/auth.inc.php
new file mode 100644
index 0000000..0b70d05
--- /dev/null
+++ b/admin/inc/auth.inc.php
@@ -0,0 +1,11 @@
+<?php
+include (dirname(__FILE__).'/pwd.inc.php');
+
+if ( isset($_COOKIE['auth']) && $_COOKIE['auth'] == $password ) {
+ //ok, cool
+} else {
+ setcookie('auth','', time()-3600);
+ header('Location: login.php');
+ die;
+}
+?> \ No newline at end of file
diff --git a/admin/inc/nav.inc.php b/admin/inc/nav.inc.php
new file mode 100644
index 0000000..d524348
--- /dev/null
+++ b/admin/inc/nav.inc.php
@@ -0,0 +1,5 @@
+<p class="logout"><a href="logout.php">Logout</a></p>
+<ul id="nav">
+ <li id="nav-feed"><a href="index.php">Feeds</a></li>
+ <li id="nav-admin"><a href="administration.php">Administration</a></li>
+</ul> \ No newline at end of file
diff --git a/admin/inc/pwd.inc.php b/admin/inc/pwd.inc.php
new file mode 100644
index 0000000..10d9225
--- /dev/null
+++ b/admin/inc/pwd.inc.php
@@ -0,0 +1 @@
+<?php $login="admin"; $password=md5("admin"); ?> \ No newline at end of file
diff --git a/admin/index.php b/admin/index.php
new file mode 100644
index 0000000..feee813
--- /dev/null
+++ b/admin/index.php
@@ -0,0 +1,151 @@
+<?php
+require_once dirname(__FILE__).'/inc/auth.inc.php';
+
+include_once(dirname(__FILE__).'/../app/classes/Planet.class.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);
+
+//Load
+if (0 < $Planet->loadOpml(dirname(__FILE__).'/../custom/people.opml')) {
+ $Planet->loadFeeds();
+ $items = $Planet->getItems();
+}
+
+$everyone = $Planet->getPeople();
+
+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" />
+ <meta http-equiv="Content-Language" content="en" />
+
+ <title>moonmoon administration</title>
+ <link rel="stylesheet" media="screen" type="text/css" href="default.css" />
+</head>
+
+<body id="admin-feed">
+ <div id="page">
+ <div id="header">
+ <h1>moonmoon</h1>
+ <p><a href="../">Back to main page</a></p>
+ </div>
+
+ <?php readfile("inc/nav.inc.php"); ?>
+
+ <div id="content">
+ <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: <?php echo count($everyone); ?></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="<?php echo ($i%2)?'odd':'even'; ?>">
+ <td><input type="checkbox" class="checkbox" name="opml[<?php echo $i; ?>][delete]" /></td>
+ <td><input type="text" size="10" class="text" name="opml[<?php echo $i; ?>][name]" value="<?php echo $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[<?php echo $i; ?>][website]" value="<?php echo $opml_person->getWebsite(); ?>" /></td>
+ <td><input type="text" size="30" class="text" name="opml[<?php echo $i; ?>][feed]" value="<?php echo $opml_person->getFeed(); ?>" /></td>
+ </tr>
+ <?php } ?>
+ </tbody>
+ </table>
+ </form>
+ </div>
+ </div>
+ </div>
+
+ <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>
+</body>
+</html>
diff --git a/admin/login.php b/admin/login.php
new file mode 100644
index 0000000..0dbc794
--- /dev/null
+++ b/admin/login.php
@@ -0,0 +1,48 @@
+<?php
+if (isset($_POST['password'])) {
+ setcookie('auth',md5($_POST['password']));
+ header('Location: index.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" />
+ <meta http-equiv="Content-Language" content="en" />
+
+ <title>moonmoon administration</title>
+ <link rel="stylesheet" media="screen" type="text/css" href="default.css" />
+</head>
+
+<body id="admin-feed">
+ <div id="page">
+ <div id="header">
+ <h1>moonmoon</h1>
+ <p><a href="../">Back to main page</a></p>
+ </div>
+
+ <div id="content">
+ <form action="" method="post" class="login">
+ <fieldset>
+ <p class="field">
+ <label for="password">Password:</label>
+ <input type="password" name="password" id="password"/>
+
+ <input type="submit" class="submit" value="OK"/>
+ </p>
+ </fieldset>
+ </form>
+ </div>
+ </div>
+ <script type="text/javascript">
+ <!--
+ window.onload = function() {
+ document.getElementById('password').focus();
+ }
+ -->
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/admin/logout.php b/admin/logout.php
new file mode 100644
index 0000000..6dd32aa
--- /dev/null
+++ b/admin/logout.php
@@ -0,0 +1,5 @@
+<?php
+setcookie('auth','', time()-3600);
+header('Location: login.php');
+die;
+?> \ No newline at end of file
diff --git a/admin/purgecache.php b/admin/purgecache.php
new file mode 100644
index 0000000..a5af5cf
--- /dev/null
+++ b/admin/purgecache.php
@@ -0,0 +1,21 @@
+<?php
+require_once dirname(__FILE__).'/inc/auth.inc.php';
+
+if (isset($_POST['purge'])){
+ $dir = dirname(__FILE__).'/../cache/';
+
+ $dh = opendir($dir);
+
+ while ($filename = readdir($dh)) {
+ if ($filename == '.' OR $filename == '..') {
+ continue;
+ }
+
+ if (filemtime($dir . DIRECTORY_SEPARATOR . $filename) < time()) {
+ @unlink($dir . DIRECTORY_SEPARATOR . $filename);
+ }
+ }
+}
+
+header('Location: administration.php');
+die(); \ No newline at end of file
diff --git a/admin/subscriptions.php b/admin/subscriptions.php
new file mode 100644
index 0000000..d5536fe
--- /dev/null
+++ b/admin/subscriptions.php
@@ -0,0 +1,68 @@
+<?php
+require_once dirname(__FILE__).'/inc/auth.inc.php';
+
+include_once(dirname(__FILE__).'/../app/classes/Planet.class.php');
+include_once(dirname(__FILE__).'/../app/lib/spyc-0.2.3/spyc.php');
+require_once dirname(__FILE__).'/../app/lib/lib.opml.php';
+require_once dirname(__FILE__).'/../app/lib/simplepie/simplepie.inc';
+
+function removeSlashes(&$item, $key){
+ $item = stripslashes($item);
+}
+
+if (isset($_POST['opml']) || isset($_POST['add'])) {
+
+ // Load config and old OPML
+ $conf = Spyc::YAMLLoad(dirname(__FILE__).'/../custom/config.yml');
+ $PlanetConfig = new PlanetConfig($conf);
+ if ($PlanetConfig->getName() === '') {
+ $PlanetConfig->setName($oldOpml->getTitle());
+ }
+ $oldOpml = OpmlManager::load(dirname(__FILE__).'/../custom/people.opml');
+ $newOpml = new opml();
+ $newOpml->title = $PlanetConfig->getName();
+
+ // Remove slashes if needed
+ if (get_magic_quotes_gpc() && isset($_POST['opml'])) {
+ array_walk_recursive($_POST['opml'], 'removeSlashes');
+ }
+ // Delete/Save feeds
+ if (isset($_POST['delete']) || isset($_POST['save'])){
+ foreach ($_POST['opml'] as $person){
+ if (isset($_POST['delete'])) {
+ //delete mode, check if to be deleted
+ if (!isset($person['delete'])){
+ $newOpml->entries[] = $person;
+ }
+ } else {
+ $newOpml->entries[] = $person;
+ }
+ }
+ }
+
+ // Add feed
+ if (isset($_POST['add'])){
+ if ('http://' != $_POST['url']) {
+ //autodiscover feed
+ $feed = new SimplePie();
+ $feed->enable_cache(false);
+ $feed->set_feed_url($_POST['url']);
+ $feed->init();
+ $feed->handle_content_type();
+ $person['name'] = $feed->get_title();
+ $person['website'] = $feed->get_permalink();
+ $person['feed'] = $feed->feed_url;
+
+ $oldOpml->entries[] = $person;
+ $newOpml->entries = $oldOpml->entries;
+ }
+ }
+
+ // Backup old OPML
+ OpmlManager::backup(dirname(__FILE__).'/../custom/people.opml');
+
+ // Save new OPML
+ OpmlManager::save($newOpml, dirname(__FILE__).'/../custom/people.opml');
+}
+header("Location: index.php");
+die(); \ No newline at end of file