Permalink
Browse files

Add optional token requirement for feed polling.

  • Loading branch information...
samwilson committed Dec 17, 2015
1 parent cbb07e9 commit 0a6ec0c8aa2b13300df1cef2799cdc22c76d2439
Showing with 33 additions and 16 deletions.
  1. +7 −5 README → README.md
  2. +10 −0 action.php
  3. +4 −2 conf/default.php
  4. +4 −4 conf/metadata.php
  5. +8 −5 lang/en/settings.php
View
@@ -1,17 +1,19 @@
Feed Aggregator plugin for DokuWiki
===================================
A DokuWiki plugin for aggregating multiple news feeds onto a single wiki page.
A DokuWiki plugin for aggregating multiple news feeds into single wiki pages.
All documentation for this plugin can be found at
https://www.dokuwiki.org/plugin:feedaggregator
If you install this plugin manually, make sure it is installed in
lib/plugins/feedaggregator/ - if the folder is named differently it
will not work.
`lib/plugins/feedaggregator/` if the folder is named differently it will not
work.
Please refer to http://www.dokuwiki.org/plugins for additional info
on how to install plugins in DokuWiki.
Please refer to http://www.dokuwiki.org/plugins for additional info on how to
install plugins in DokuWiki.
[![Build Status](https://travis-ci.org/samwilson/dokuwiki-plugin-feedaggregator.svg?branch=master)](https://travis-ci.org/samwilson/dokuwiki-plugin-feedaggregator)
----
Copyright (C) Sam Wilson <sam@samwilson.id.au>
View
@@ -37,13 +37,23 @@ public function handle(Doku_Event &$event, $param) {
}
$event->preventDefault();
// See if we need a token and whether it matches.
$requiredToken = $this->getConf('token');
$suppliedToken = (isset($_GET['token'])) ? $_GET['token'] : false;
if (!empty($requiredToken) && $suppliedToken !== $requiredToken) {
msg("Token doesn't match for feedaggregator");
return true;
}
// Get the feed list.
$feeds = file(fullpath($conf['tmpdir'].'/feedaggregator.csv'));
// Set up SimplePie and merge all the feeds together.
$simplepie = new FeedParser();
$ua = 'Mozilla/4.0 (compatible; DokuWiki feedaggregator plugin '.wl('', '', true).')';
$simplepie->set_useragent($ua);
$simplepie->force_feed($this->getConf('force_feed'));
$simplepie->force_fsockopen($this->getConf('force_fsockopen'));
$simplepie->set_feed_url($feeds);
// Set up caching.
View
@@ -1,8 +1,10 @@
<?php
/**
* Default settings for the feedaggregator plugin
*
* @author Sam Wilson <sam@samwilson.id.au>
*/
//$conf['fixme'] = 'FIXME';
$conf['force_feed'] = 0;
$conf['force_fsockopen'] = 0;
$conf['token'] = '';
View
@@ -1,10 +1,10 @@
<?php
/**
* Options for the feedaggregator plugin
*
* @author Sam Wilson <sam@samwilson.id.au>
*/
//$meta['fixme'] = array('string');
$meta['force_feed'] = array('onoff');
$meta['force_fsockopen'] = array('onoff');
$meta['token'] = array('string');
View
@@ -6,8 +6,11 @@
*/
// keys need to match the config setting name
// $lang['fixme'] = 'FIXME';
//Setup VIM: ex: et ts=4 :
$lang['force_feed'] = 'Force the given data/URL to be treated as a feed. '
. 'This tells SimplePie to ignore the content-type provided by the server. '
. 'Be careful when using this option, as it will also disable autodiscovery.';
$lang['force_fsockopen'] = 'Force SimplePie to use fsockopen() instead of cURL';
$lang['token'] = "A 'secret' token that will have to be supplied in the URL in order "
. "for the aggregation script to work. For example, for a token of "
. "<code>123abc</code> the URL must be of the form "
. "<code>https://example.com/dokuwiki?do=feedaggregator&token=123abc</code>";

0 comments on commit 0a6ec0c

Please sign in to comment.