From 89c312ab233ea7501b9fc3a90a888a18ee38acb1 Mon Sep 17 00:00:00 2001
From: Josh Sherman
Date: Sat, 16 Feb 2008 20:55:22 +0000
Subject: [PATCH] Added a new site and a contrib directory for my 3rd party
libraries.
git-svn-id: http://svn.cleancode.org/svn/pickles@11 4d10bc64-7434-11dc-a737-d2d0f8310089
---
classes/Config.php | 34 +-
config/netlabelnews.org.ini | 13 +
contrib/magpierss | 1 +
contrib/magpierss-0.72/AUTHORS | 1 +
contrib/magpierss-0.72/CHANGES | 41 +
contrib/magpierss-0.72/ChangeLog | 405 ++++++++
contrib/magpierss-0.72/INSTALL | 143 +++
contrib/magpierss-0.72/NEWS | 53 ++
contrib/magpierss-0.72/README | 48 +
contrib/magpierss-0.72/TROUBLESHOOTING | 152 +++
contrib/magpierss-0.72/cookbook | 125 +++
.../magpierss-0.72/extlib/Snoopy.class.inc | 900 ++++++++++++++++++
contrib/magpierss-0.72/htdocs/cookbook.html | 237 +++++
contrib/magpierss-0.72/htdocs/index.html | 419 ++++++++
contrib/magpierss-0.72/rss_cache.inc | 200 ++++
contrib/magpierss-0.72/rss_fetch.inc | 458 +++++++++
contrib/magpierss-0.72/rss_parse.inc | 612 ++++++++++++
contrib/magpierss-0.72/rss_utils.inc | 67 ++
contrib/magpierss-0.72/scripts/README | 27 +
.../magpierss-0.72/scripts/magpie_debug.php | 80 ++
.../magpierss-0.72/scripts/magpie_simple.php | 29 +
.../scripts/magpie_slashbox.php | 66 ++
.../magpierss-0.72/scripts/simple_smarty.php | 58 ++
.../smarty_plugin/modifier.rss_date_parse.php | 31 +
.../scripts/templates/simple.smarty | 46 +
jLib.php | 17 +-
26 files changed, 4255 insertions(+), 8 deletions(-)
create mode 100755 config/netlabelnews.org.ini
create mode 120000 contrib/magpierss
create mode 100644 contrib/magpierss-0.72/AUTHORS
create mode 100644 contrib/magpierss-0.72/CHANGES
create mode 100644 contrib/magpierss-0.72/ChangeLog
create mode 100644 contrib/magpierss-0.72/INSTALL
create mode 100644 contrib/magpierss-0.72/NEWS
create mode 100644 contrib/magpierss-0.72/README
create mode 100644 contrib/magpierss-0.72/TROUBLESHOOTING
create mode 100644 contrib/magpierss-0.72/cookbook
create mode 100644 contrib/magpierss-0.72/extlib/Snoopy.class.inc
create mode 100644 contrib/magpierss-0.72/htdocs/cookbook.html
create mode 100644 contrib/magpierss-0.72/htdocs/index.html
create mode 100644 contrib/magpierss-0.72/rss_cache.inc
create mode 100644 contrib/magpierss-0.72/rss_fetch.inc
create mode 100644 contrib/magpierss-0.72/rss_parse.inc
create mode 100644 contrib/magpierss-0.72/rss_utils.inc
create mode 100644 contrib/magpierss-0.72/scripts/README
create mode 100755 contrib/magpierss-0.72/scripts/magpie_debug.php
create mode 100755 contrib/magpierss-0.72/scripts/magpie_simple.php
create mode 100755 contrib/magpierss-0.72/scripts/magpie_slashbox.php
create mode 100755 contrib/magpierss-0.72/scripts/simple_smarty.php
create mode 100644 contrib/magpierss-0.72/scripts/smarty_plugin/modifier.rss_date_parse.php
create mode 100644 contrib/magpierss-0.72/scripts/templates/simple.smarty
diff --git a/classes/Config.php b/classes/Config.php
index 867e782..eb9071e 100755
--- a/classes/Config.php
+++ b/classes/Config.php
@@ -6,9 +6,18 @@ class Config {
private function __construct() { }
+ public static function check($site) {
+ if (file_exists('/var/www/josh/common/config/' . $site . '.ini')) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
public static function load($site) {
// @todo no hardcoded paths!
- $file = "/var/www/josh/common/config/{$site}.ini";
+ $file = '/var/www/josh/common/config/' . $site . '.ini';
if (file_exists($file)) {
self::$data = parse_ini_file($file, true);
}
@@ -21,17 +30,28 @@ class Config {
}
public static function get($variable, $section = null) {
- return isset($section) ? self::$data[$section][$variable] : self::$data[$variable];
+ if (isset($section)) {
+ if (isset(self::$data[$section][$variable])) {
+ return self::$data[$section][$variable];
+ }
+ }
+
+ if (isset(self::$data[$variable])) {
+ return self::$data[$variable];
+ }
+
+ return false;
}
- public static function enableDebug() { self::$data['debug'] = true; }
+ public static function enableDebug() { self::$data['debug'] = true; }
public static function disableDebug() { self::$data['debug'] = false; }
- public static function getDebug() { return self::get('debug'); }
+ public static function getDebug() { return self::get('debug'); }
- public static function getDisable() { return self::get('disable'); }
- public static function getSession() { return self::get('session'); }
- public static function getSmarty() { return self::get('smarty'); }
+ public static function getDisable() { return self::get('disable'); }
+ public static function getSession() { return self::get('session'); }
+ public static function getSmarty() { return self::get('smarty'); }
public static function getFCKEditor() { return self::get('fckeditor'); }
+ public static function getMagpieRSS() { return self::get('magpierss'); }
}
diff --git a/config/netlabelnews.org.ini b/config/netlabelnews.org.ini
new file mode 100755
index 0000000..45a2a1a
--- /dev/null
+++ b/config/netlabelnews.org.ini
@@ -0,0 +1,13 @@
+debug = false
+disable = false
+fckeditor = false
+session = false
+smarty = true
+magpierss = true
+
+[database]
+hostname = "localhost"
+username = "netlabelnews"
+password = "n37l4b3ln3w5"
+database = "netlabelnews"
+
diff --git a/contrib/magpierss b/contrib/magpierss
new file mode 120000
index 0000000..effd084
--- /dev/null
+++ b/contrib/magpierss
@@ -0,0 +1 @@
+magpierss-0.72/
\ No newline at end of file
diff --git a/contrib/magpierss-0.72/AUTHORS b/contrib/magpierss-0.72/AUTHORS
new file mode 100644
index 0000000..7d7f3f5
--- /dev/null
+++ b/contrib/magpierss-0.72/AUTHORS
@@ -0,0 +1 @@
+kellan
diff --git a/contrib/magpierss-0.72/CHANGES b/contrib/magpierss-0.72/CHANGES
new file mode 100644
index 0000000..3346f2b
--- /dev/null
+++ b/contrib/magpierss-0.72/CHANGES
@@ -0,0 +1,41 @@
+Version 0.72
+-----------
+ - fix security exploit: http://www.sec-consult.com/216.html
+
+Version 0.7
+-----------
+ - support for input and output charset encoding
+ based on the work in FoF, uses iconv or mbstring if available
+ -
+
+Version 0.6
+-----------
+ - basic support for Atom syndication format
+ including support for Atom content constructs
+ - fixed support for private feeds (HTTP Auth and SSL)
+ (thanks to silverorange.com for providing test feeds)
+ - support for some broken webservers
+
+Version 0.52
+-----------
+ - support GZIP content negoiation
+ - PHP 4.3.2 support
+
+Version 0.4
+-----------
+ - improved error handling, better access for script authors
+ - included example scripts of working with MagpieRSS
+ - new Smarty plugin for RSS date parsing
+
+Version 0.3
+-----------
+ - added support for conditional gets (Last-Modified, ETag)
+ - now use Snoopy to handle fetching RSS files
+
+Version 0.2
+-----------
+ - MAJOR CLEAN UP
+ - removed kludgy $options array in favour of constants
+ - phased out returning arrays
+ - added better error handling
+ - re-worked comments
diff --git a/contrib/magpierss-0.72/ChangeLog b/contrib/magpierss-0.72/ChangeLog
new file mode 100644
index 0000000..62fa4f5
--- /dev/null
+++ b/contrib/magpierss-0.72/ChangeLog
@@ -0,0 +1,405 @@
+2005-10-28 14:11 kellan
+
+ * extlib/Snoopy.class.inc: a better solution
+
+2005-10-28 11:51 kellan
+
+ * extlib/Snoopy.class.inc: fix arbtriary code execution
+ vulnerability when using curl+ssl
+
+ http://www.sec-consult.com/216.html
+
+2005-03-08 10:46 kellan
+
+ * rss_parse.inc: fix bug w/ atom and date normalization
+
+2005-02-09 14:59 kellan
+
+ * rss_fetch.inc: fix stale cache bug
+
+2005-01-28 02:27 kellan
+
+ * rss_parse.inc: support php w/o array_change_case
+
+2005-01-23 20:02 kellan
+
+ * rss_fetch.inc: fix cache bug introduced by charset encoding
+
+2005-01-12 09:14 kellan
+
+ * rss_cache.inc, rss_fetch.inc: more sanity checks for when things
+ go wrong
+
+2004-12-12 13:44 kellan
+
+ * INSTALL, rss_cache.inc, rss_utils.inc: detab
+
+2004-11-23 20:15 kellan
+
+ * rss_parse.inc: fix calling iconv instead of mb_convert_encoding
+
+2004-11-22 02:11 kellan
+
+ * CHANGES, ChangeLog, rss_parse.inc, scripts/magpie_debug.php: last
+ bit of tidying
+
+2004-11-22 01:45 kellan
+
+ * rss_fetch.inc: detab, bump version
+
+2004-11-22 01:43 kellan
+
+ * rss_parse.inc: was filtering too much
+
+2004-11-22 00:03 kellan
+
+ * rss_fetch.inc, rss_parse.inc: cache on $url . $output_encoding
+ otherwise we can get munged output
+
+2004-11-21 23:52 kellan
+
+ * rss_parse.inc: add WARNING
+
+2004-11-21 23:45 kellan
+
+ * rss_parse.inc: don't set ERROR on notice or warning (rss_fetch
+ dies on parse errors)
+
+2004-11-21 23:44 kellan
+
+ * rss_fetch.inc: add encoding defines (fix timeout error reporting)
+
+2004-11-21 20:21 kellan
+
+ * rss_parse.inc: incorporate steve's patch
+
+2004-11-21 19:26 kellan
+
+ * rss_parse.inc: remove old debugging functions, totally
+ arbitrarily. might break stuff. can't really explain why i'm
+ doing this.
+
+2004-10-28 15:52 kellan
+
+ * rss_parse.inc: fixed '=' instead of '=='
+
+2004-10-26 00:48 kellan
+
+ * rss_parse.inc: chance epoch to timestamp to conform w/ php naming
+ conventions
+
+2004-06-15 12:00 kellan
+
+ * rss_parse.inc: [no log message]
+
+2004-04-26 14:16 kellan
+
+ * rss_fetch.inc: bump version
+
+2004-04-26 12:36 kellan
+
+ * rss_parse.inc: fix field doubling
+
+2004-04-24 17:47 kellan
+
+ * CHANGES, ChangeLog: updated
+
+2004-04-24 17:35 kellan
+
+ * rss_fetch.inc: bumped version
+
+2004-04-24 16:52 kellan
+
+ * rss_parse.inc: support arbitrary atom content constructs
+
+ some refactoring
+
+2004-04-24 16:15 kellan
+
+ * rss_parse.inc: support summary content contstruct. add normalize
+ function
+
+2004-03-27 16:29 kellan
+
+ * extlib/Snoopy.class.inc: accept self-signed certs
+
+2004-03-27 12:53 kellan
+
+ * extlib/Snoopy.class.inc: fixed SSL support * set status * set
+ error on bad curl
+
+ (also ripped out big chunks of dead weight (submit_form) which
+ were getting in my way
+
+2004-01-25 02:25 kellan
+
+ * rss_parse.inc: make RSS 1.0's rdf:about available
+
+2004-01-25 02:07 kellan
+
+ * rss_parse.inc: clean up text, and line formats. add support item
+ rdf:about
+
+2004-01-24 23:40 kellan
+
+ * CHANGES, ChangeLog: update changes
+
+2004-01-24 23:37 kellan
+
+ * rss_fetch.inc: updated version
+
+2004-01-24 23:35 kellan
+
+ * rss_parse.inc: whitespace
+
+2004-01-24 23:23 kellan
+
+ * extlib/Snoopy.class.inc: support badly formatted http headers
+
+2004-01-24 23:20 kellan
+
+ * rss_parse.inc: added alpha atom parsing support
+
+2003-06-25 22:34 kellan
+
+ * extlib/Snoopy.class.inc: fixed fread 4.3.2 compatibility problems
+
+2003-06-13 11:31 kellan
+
+ * rss_fetch.inc: reset cache on 304
+
+2003-06-12 21:37 kellan
+
+ * rss_cache.inc, rss_fetch.inc, rss_parse.inc, rss_utils.inc:
+ bumped up version numbers
+
+2003-06-12 21:32 kellan
+
+ * htdocs/index.html: updated news
+
+2003-06-12 21:27 kellan
+
+ * NEWS: a manual blog :)
+
+2003-06-12 21:22 kellan
+
+ * htdocs/index.html: fully qualified img
+
+2003-06-12 21:20 kellan
+
+ * htdocs/index.html: clean up. added badge.
+
+2003-06-12 21:04 kellan
+
+ * rss_utils.inc: clean up regex
+
+2003-06-12 21:02 kellan
+
+ * rss_cache.inc: suppress some warnings
+
+2003-05-30 20:44 kellan
+
+ * extlib/Snoopy.class.inc: more comments, cleaned up notice
+
+2003-05-30 15:14 kellan
+
+ * extlib/Snoopy.class.inc: don't advertise gzip support if the user
+ hasn't built php with gzinflate support
+
+2003-05-12 22:32 kellan
+
+ * ChangeLog: changes
+
+2003-05-12 22:11 kellan
+
+ * htdocs/index.html: announce 0.5
+
+2003-05-12 21:42 kellan
+
+ * htdocs/index.html: change
+
+2003-05-12 21:39 kellan
+
+ * rss_fetch.inc: use gzip
+
+2003-05-12 21:37 kellan
+
+ * extlib/Snoopy.class.inc: added support gzip encoded content
+ negoiation
+
+2003-05-12 21:32 kellan
+
+ * rss_cache.inc, rss_fetch.inc, rss_parse.inc, rss_utils.inc: fixed
+ typoes
+
+2003-04-26 21:44 kellan
+
+ * rss_parse.inc: fix minor typo
+
+2003-04-18 08:19 kellan
+
+ * htdocs/cookbook.html: updated cookbook to show more code for
+ limiting items
+
+2003-03-03 16:02 kellan
+
+ * rss_parse.inc, scripts/magpie_slashbox.php: committed (or
+ adpated) patch from Nicola (www.technick.com) to quell 'Undefined
+ Indexes' notices
+
+2003-03-03 15:59 kellan
+
+ * rss_fetch.inc: commited patch from nicola (www.technick.com) to
+ quell 'undefined indexes' notices.
+
+ * Magpie now automatically includes its version in the
+ user-agent, & whether cacheing is turned on.
+
+2003-02-12 01:22 kellan
+
+ * CHANGES, ChangeLog: ChangeLog now auto-generated by cvs2cl
+
+2003-02-12 00:21 kellan
+
+ * rss_fetch.inc: better errors, hopefully stomped on pesky notices
+
+2003-02-12 00:19 kellan
+
+ * rss_parse.inc: check to see is xml is supported, if not die
+
+ also throw better xml errors
+
+2003-02-12 00:18 kellan
+
+ * rss_cache.inc: hopefully cleared up some notices that were being
+ thrown into the log
+
+ fixed a debug statement that was being called as an error
+
+2003-02-12 00:15 kellan
+
+ * scripts/: magpie_simple.php, magpie_slashbox.php: moved
+ magpie_simple to magpie_slashbox, and replaced it with a simpler
+ demo.
+
+2003-02-12 00:02 kellan
+
+ * INSTALL, README, TROUBLESHOOTING: Improved documentation. Better
+ install instructions.
+
+ TROUBLESHOOTING cover common installation and usage problems
+
+2003-01-22 14:40 kellan
+
+ * htdocs/cookbook.html: added cookbook.html
+
+2003-01-21 23:47 kellan
+
+ * cookbook: a magpie cookbook
+
+2003-01-20 10:09 kellan
+
+ * ChangeLog: updated
+
+2003-01-20 09:23 kellan
+
+ * scripts/simple_smarty.php: minor clean up
+
+2003-01-20 09:15 kellan
+
+ * scripts/README: added smarty url
+
+2003-01-20 09:14 kellan
+
+ * magpie_simple.php, htdocs/index.html, scripts/README,
+ scripts/magpie_debug.php, scripts/magpie_simple.php,
+ scripts/simple_smarty.php,
+ scripts/smarty_plugin/modifier.rss_date_parse.php,
+ scripts/templates/simple.smarty: Added scripts directory for
+ examples on how to use MagpieRSS
+
+ magpie_simple - is a simple example magpie_debug - spew all the
+ information from a parsed RSS feed simple_smary - example of
+ using magpie with Smarty template system
+ smarty_plugin/modifier.rss_date_parse.php - support file for the
+ smarty demo templates/simple.smary - template for the smarty demo
+
+2003-01-20 09:11 kellan
+
+ * rss_fetch.inc, rss_parse.inc: changes to error handling to give
+ script authors more access to magpie's errors.
+
+ added method magpie_error() to retrieve global MAGPIE_ERROR
+ variable for when fetch_rss() returns false
+
+2002-10-26 19:02 kellan
+
+ * htdocs/index.html: putting the website under source control
+
+2002-10-26 18:43 kellan
+
+ * AUTHORS, ChangeLog, INSTALL, README: some documentation to make
+ it all look official :)
+
+2002-10-25 23:04 kellan
+
+ * magpie_simple.php: quxx
+
+2002-10-25 23:04 kellan
+
+ * rss_parse.inc: added support for textinput and image
+
+2002-10-25 19:23 kellan
+
+ * magpie_simple.php, rss_cache.inc, rss_fetch.inc, rss_parse.inc,
+ rss_utils.inc: switched to using Snoopy for fetching remote RSS
+ files.
+
+ added support for conditional gets
+
+2002-10-25 19:22 kellan
+
+ * rss_cache.inc, rss_fetch.inc, rss_parse.inc, rss_utils.inc:
+ Change comment style to slavishly imitate the phpinsider style
+ found in Smarty and Snoopy :)
+
+2002-10-25 19:18 kellan
+
+ * extlib/Snoopy.class.inc: added Snoopy in order to support
+ conditional gets
+
+2002-10-23 23:19 kellan
+
+ * magpie_simple.php, rss_cache.inc, rss_fetch.inc, rss_parse.inc:
+ MAJOR CLEANUP!
+
+ * rss_fetch got rid of the options array, replaced it with a more
+ PHP-like solution of using defines. constants are setup, with
+ defaults, in the function init()
+
+ got rid of the idiom of passing back an array, its was awkward to
+ deal with in PHP, and unusual (and consquently confusing to
+ people). now i return true/false values, and try to setup error
+ string where appropiate (rss_cache has the most complete example
+ of this)
+
+ change the logic for interacting with the cache
+
+ * rss_cache major re-working of how error are handled. tried to
+ make the code more resillient. the cache is now much more aware
+ of MAX_AGE, where before this was being driven out of rss_fetch
+ (which was silly)
+
+ * rss_parse properly handles xml parse errors. used to sail
+ along blithely unaware.
+
+2002-09-11 11:11 kellan
+
+ * rss_cache.inc, rss_parse.inc, magpie_simple.php, rss_fetch.inc,
+ rss_utils.inc: Initial revision
+
+2002-09-11 11:11 kellan
+
+ * rss_cache.inc, rss_parse.inc, magpie_simple.php, rss_fetch.inc,
+ rss_utils.inc: initial import
+
diff --git a/contrib/magpierss-0.72/INSTALL b/contrib/magpierss-0.72/INSTALL
new file mode 100644
index 0000000..640833d
--- /dev/null
+++ b/contrib/magpierss-0.72/INSTALL
@@ -0,0 +1,143 @@
+REQUIREMENTS
+
+ MapieRSS requires a recent PHP 4+ (developed with 4.2.0)
+ with xml (expat) support.
+
+ Optionally:
+ * PHP5 with libxml2 support.
+ * cURL for SSL support
+ * iconv (preferred) or mb_string for expanded character set support
+
+QUICK START
+
+ Magpie consists of 4 files (rss_fetch.inc, rss_parser.inc, rss_cache.inc,
+ and rss_utils.inc), and the directory extlib (which contains a modified
+ version of the Snoopy HTTP client)
+
+ Copy these 5 resources to a directory named 'magpierss' in the same
+ directory as your PHP script.
+
+ At the top of your script add the following line:
+
+ require_once('magpierss/rss_fetch.inc');
+
+ Now you can use the fetch_rss() method:
+
+ $rss = fetch_rss($url);
+
+ Done. That's it. See README for more details on using MagpieRSS.
+
+NEXT STEPS
+
+ Important: you'll probably want to get the cache directory working in
+ order to speed up your application, and not abuse the webserver you're
+ downloading the RSS from.
+
+ Optionally you can install MagpieRSS in your PHP include path in order to
+ make it available server wide.
+
+ Lastly you might want to look through the constants in rss_fetch.inc see if
+ there is anything you want to override (the defaults are pretty good)
+
+ For more info, or if you have trouble, see TROUBLESHOOTING
+
+SETTING UP CACHING
+
+ Magpie has built-in transparent caching. With caching Magpie will only
+ fetch and parse RSS feeds when there is new content. Without this feature
+ your pages will be slow, and the sites serving the RSS feed will be annoyed
+ with you.
+
+** Simple and Automatic **
+
+ By default Magpie will try to create a cache directory named 'cache' in the
+ same directory as your PHP script.
+
+** Creating a Local Cache Directory **
+
+ Often this will fail, because your webserver doesn't have sufficient
+ permissions to create the directory.
+
+ Exact instructions for how to do this will vary from install to install and
+ platform to platform. The steps are:
+
+ 1. Make a directory named 'cache'
+ 2. Give the web server write access to that directory.
+
+ An example of how to do this on Debian would be:
+
+ 1. mkdir /path/to/script/cache
+ 2. chgrp www-data /path/to/script/cache
+ 3. chmod 775 /path/to/script/cache
+
+ On other Unixes you'll need to change 'www-data' to what ever user Apache
+ runs as. (on MacOS X the user would be 'www')
+
+** Cache in /tmp **
+
+ Sometimes you won't be able to create a local cache directory. Some reasons
+ might be:
+
+ 1. No shell account
+ 2. Insufficient permissions to change ownership of a directory
+ 3. Webserver runs as 'nobody'
+
+ In these situations using a cache directory in /tmp can often be a good
+ option.
+
+ The drawback is /tmp is public, so anyone on the box can read the cache
+ files. Usually RSS feeds are public information, so you'll have to decide
+ how much of an issue that is.
+
+ To use /tmp as your cache directory you need to add the following line to
+ your script:
+
+ define('MAGPIE_CACHE_DIR', '/tmp/magpie_cache');
+
+** Global Cache **
+
+ If you have several applications using Magpie, you can create a single
+ shared cache directory, either using the /tmp cache, or somewhere else on
+ the system.
+
+ The upside is that you'll distribute fetching and parsing feeds across
+ several applications.
+
+INSTALLING MAGPIE SERVER WIDE
+
+ Rather then following the Quickstart instructions which requires you to have
+ a copy of Magpie per application, alternately you can place it in some
+ shared location.
+
+** Adding Magpie to Your Include Path **
+
+ Copy the 5 resources (rss_fetch.inc, rss_parser.inc, rss_cache.inc,
+ rss_utils.inc, and extlib) to a directory named 'magpierss' in your include
+ path. Now any PHP file on your system can use Magpie with:
+
+ require_once('magpierss/rss_fetch.inc');
+
+ Different installs have different include paths, and you'll have to figure
+ out what your include_path is.
+
+ From shell you can try:
+
+ php -i | grep 'include_path'
+
+ Alternatley you can create a phpinfo.php file with contains:
+
+
+
+ Debian's default is:
+
+ /usr/share/php
+
+ (though more idealogically pure location would be /usr/local/share/php)
+
+ Apple's default include path is:
+
+ /usr/lib/php
+
+ While the Entropy PHP build seems to use:
+
+ /usr/local/php/lib/php
\ No newline at end of file
diff --git a/contrib/magpierss-0.72/NEWS b/contrib/magpierss-0.72/NEWS
new file mode 100644
index 0000000..5ac6b97
--- /dev/null
+++ b/contrib/magpierss-0.72/NEWS
@@ -0,0 +1,53 @@
+MagpieRSS News
+
+MAGPIERSS 0.51 RELEASED
+ * important bugfix!
+ * fix "silent failure" when PHP doesn't have zlib
+
+FEED ON FEEDS USES MAGPIE
+ * web-based RSS aggregator built with Magpie
+ * easy to install, easy to use.
+ http://minutillo.com/steve/feedonfeeds/
+
+MAGPIERSS 0.5 RELEASED
+ * supports transparent HTTP gzip content negotiation for reduced bandwidth usage
+ * quashed some undefined index notices
+
+MAGPIERSS 0.46 RELEASED
+ * minor release, more error handling clean up
+ * documentation fixes, simpler example
+ * new trouble shooting guide for installation and usage problems
+ http://magpierss.sourceforge.net/TROUBLESHOOTING
+
+MAGPIE NEWS AS RSS
+ * releases, bug fixes, releated stories in RSS
+
+MAGPIERSS COOKBOOK: SIMPLE PHP RSS HOW TOS
+ * answers some of the most frequently asked Magpie questions
+ * feedback, suggestions, requests, recipes welcome
+ http://magpierss.sourceforge.net/cookbook.html
+
+MAGPIERSS 0.4 RELEASED!
+ * improved error handling, more flexibility for script authors, backwards compatible
+ * new and better examples! including using MagpieRSS and Smarty
+ * new Smarty plugin for RSS date parsing
+ http://smarty.php.net
+
+INFINITE PENGUIN NOW SUPPORTS MAGPIE 0.3
+ * simple, sophisticated RSS viewer
+ * includes auto-generated javascript ticker from RSS feed
+ http://www.infinitepenguins.net/rss/
+
+TRAUMWIND RELEASES REX BACKEND FOR MAGPIERSS
+ * drop in support using regex based XML parser
+ * parses improperly formed XML that chokes expat
+ http://traumwind.de/blog/magpie/magpie_alike.php
+
+MAGPIERSS 0.3 RELEASED!
+ * Support added for HTTP Conditional GETs.
+ http://fishbowl.pastiche.org/archives/001132.html
+
+MAGPIERSS 0.2!
+ * Major clean up of the code. Easier to use.
+ * Simpler install on shared hosts.
+ * Better documentation and comments.
diff --git a/contrib/magpierss-0.72/README b/contrib/magpierss-0.72/README
new file mode 100644
index 0000000..6af7edb
--- /dev/null
+++ b/contrib/magpierss-0.72/README
@@ -0,0 +1,48 @@
+NAME
+
+ MagpieRSS - a simple RSS integration tool
+
+SYNOPSIS
+
+ require_once(rss_fetch.inc);
+ $url = $_GET['url'];
+ $rss = fetch_rss( $url );
+
+ echo "Channel Title: " . $rss->channel['title'] . "
";
+
+DESCRIPTION
+
+ MapieRSS is an XML-based RSS parser in PHP. It attempts to be "PHP-like",
+ and simple to use.
+
+ Some features include:
+
+ * supports RSS 0.9 - 1.0, with limited RSS 2.0 support
+ * supports namespaces, and modules, including mod_content and mod_event
+ * open minded [1]
+ * simple, functional interface, to object oriented backend parser
+ * automatic caching of parsed RSS objects makes its easy to integrate
+ * supports conditional GET with Last-Modified, and ETag
+ * uses constants for easy override of default behaviour
+ * heavily commented
+
+
+1. By open minded I mean Magpie will accept any tag it finds in good faith that
+ it was supposed to be here. For strict validation, look elsewhere.
+
+
+GETTING STARTED
+
+
+
+COPYRIGHT:
+ Copyright(c) 2002 kellan@protest.net. All rights reserved.
+ This software is released under the GNU General Public License.
+ Please read the disclaimer at the top of the Snoopy.class.inc file.
diff --git a/contrib/magpierss-0.72/TROUBLESHOOTING b/contrib/magpierss-0.72/TROUBLESHOOTING
new file mode 100644
index 0000000..89068d3
--- /dev/null
+++ b/contrib/magpierss-0.72/TROUBLESHOOTING
@@ -0,0 +1,152 @@
+TROUBLESHOOTING
+
+
+Trouble Installing MagpieRSS:
+
+1. Fatal error: Failed opening required '/path/to/script/rss_fetch.inc'
+ (include_path='.:/usr/local/lib/php:/usr/local/lib/php/pear')
+
+2. Cache couldn't make dir './cache'.
+
+3. Fatal error: Failed to load PHP's XML Extension.
+ http://www.php.net/manual/en/ref.xml.php
+
+Trouble Using MagpieRSS
+
+4. Warning: MagpieRSS: Failed to fetch example.com/index.rdf.
+ (HTTP Error: Invalid protocol "")
+
+5. Warning: MagpieRSS: Failed to parse RSS file.
+ (not well-formed (invalid token) at line 19, column 98)
+
+6. Warning: MagpieRSS: Failed to fetch http://localhost/rss/features.1-0.rss.
+ (HTTP Response: HTTP/1.1 404 Not Found)
+
+If you would rather provide a custom error, see the COOKBOOK
+(http://magpierss.sf.net/cookbook.html) recipe 2.
+
+*************************************************************************
+1. Fatal error: Failed opening required '/path/to/script/rss_fetch.inc'
+ (include_path='.:/usr/local/lib/php:/usr/local/lib/php/pear')
+
+ This could mean that:
+
+ a) PHP can't find the MagpieRSS files.
+ b) PHP found them the MagpieRSS files, but can't read them.
+
+ a. Telling PHP where to look for MagpieRSS file.
+
+ This might mean your PHP program can't find the MagpieRSS libraries.
+ Magpie relies on 4 include files, rss_fetch.inc, rss_parse.inc,
+ rss_cache.inc, rss_util.inc, and for normal use you'll need all 4 (see the
+ cookbook for exceptions).
+
+ This can be fixed by making sure the MagpieRSS files are in your include
+ path.
+
+ If you can edit your include path (for example your on a shared host) then
+ you need to replace:
+
+ require_once('rss_fetch.inc');
+
+ -with-
+
+ define('MAGPIE_DIR', '/path/to/magpierss/');
+ require_once(MAGPIE_DIR.'rss_fetch.inc');
+
+ b. PHP can't read the MagpieRSS files
+
+ All PHP libraries need to be readable by your webserver.
+
+ On Unix you can accomplish this with:
+
+ chmod 755 rss_fetch.inc rss_parse.inc rss_cache.inc rss_util.inc
+
+*************************************************************************
+2. Cache couldn't make dir './cache'.
+
+ MagpieRSS caches the results of fetched and parsed RSS to reduce the load on
+ both your server, and the remote server providing the RSS. It does this by
+ writing files to a cache directory.
+
+ This error means the webserver doesn't have write access to the current
+ directory.
+
+ a. Make a webserver writeable cache directory
+
+ Find the webserver's group. (on my system it is 'www')
+
+ mkdir ./cache
+ chgrp www directory_name
+ chmod g+w directory_name
+
+ (this is the best, and desired solution)
+
+ b. Tell MagpieRSS to create the cache directory somewhere the webserver can
+ write to.
+
+ define('MAGPIE_CACHE_DIR', '/tmp/magpierss');
+
+ (this is not a great solution, and might have security considerations)
+
+ c. Turn off cacheing.
+
+ Magpie can work fine with cacheing, but it will be slower, and you might
+ become a nuiance to the RSS provider, but it is an option.
+
+ define('MAGPIE_CACHE_ON', 0);
+
+ d. And lastly, do NOT
+
+ chmod 777 ./cache
+
+ Any of the above solutions are better then this.
+
+ NOTE: If none of this works for you, let me know. I've got root, and a
+ custom compiled Apache on almost any box I ever touch, so I can be a little
+ out of touch with reality. But I won't know that if I don't feedback.
+
+************************************************************************* 3.
+3. Fatal error: Failed to load PHP's XML Extension.
+ http://www.php.net/manual/en/ref.xml.php
+
+ -or-
+
+ Fatal error: Failed to create an instance of PHP's XML parser.
+ http://www.php.net/manual/en/ref.xml.php
+
+ Make sure your PHP was built with --with-xml
+
+ This has been turned on by default for several versions of PHP, but it might
+ be turned off in your build.
+
+ See php.net for details on building and configuring PHP.
+
+
+*************************************************************************
+4. Warning: MagpieRSS: Failed to fetch index.rdf.
+ (HTTP Error: Invalid protocol "")
+
+ You need to put http:// in front of your the URL to your RSS feed
+
+*************************************************************************
+5. Warning: MagpieRSS: Failed to parse RSS file.
+ (not well-formed (invalid token) at line 19, column 98)
+
+ There is a problem with the RSS feed you are trying to read.
+ MagpieRSS is an XML parser, and therefore can't parse RSS feed with invalid
+ characters. Some RSS parser are based on regular expressions, and can
+ parse invalid RSS but they have their own problems.
+
+ You could try contacting the author of the RSS feed, and pointing them to
+ the online RSS validator at:
+
+ http://feeds.archive.org/validator/
+
+*************************************************************************
+6. Warning: MagpieRSS: Failed to fetch http://example.com/index.rdf
+ (HTTP Response: HTTP/1.1 404 Not Found)
+
+ Its a 404! The RSS file ain't there.
+
+
diff --git a/contrib/magpierss-0.72/cookbook b/contrib/magpierss-0.72/cookbook
new file mode 100644
index 0000000..45dda98
--- /dev/null
+++ b/contrib/magpierss-0.72/cookbook
@@ -0,0 +1,125 @@
+MAGPIERSS RECIPES: Cooking with Corbies
+
+ "Four and twenty blackbirds baked in a pie."
+
+1. LIMIT THE NUMBER OF HEADLINES(AKA ITEMS) RETURNED.
+
+PROBLEM:
+
+You want to display the 10 (or 3) most recent headlines, but the RSS feed
+contains 15.
+
+SOLUTION:
+
+$num_items = 10;
+$rss = fetch_rss($url);
+
+$items = array_slice($rss->items, 0, $num_items);
+
+DISCUSSION:
+
+Rather then trying to limit the number of items Magpie parses, a much simpler,
+and more flexible approach is to take a "slice" of the array of items. And
+array_slice() is smart enough to do the right thing if the feed has less items
+then $num_items.
+
+See: http://www.php.net/array_slice
+
+
+2. DISPLAY A CUSTOM ERROR MESSAGE IF SOMETHING GOES WRONG
+
+PROBLEM:
+
+You don't want Magpie's error messages showing up if something goes wrong.
+
+SOLUTION:
+
+# Magpie throws USER_WARNINGS only
+# so you can cloak these, by only showing ERRORs
+error_reporting(E_ERROR);
+
+# check the return value of fetch_rss()
+
+$rss = fetch_rss($url);
+
+if ( $rss ) {
+...display rss feed...
+}
+else {
+ echo "An error occured! " .
+ "Consider donating more $$$ for restoration of services." .
+ " Error Message: " . magpie_error();
+}
+
+DISCUSSION:
+
+MagpieRSS triggers a warning in a number of circumstances. The 2 most common
+circumstances are: if the specified RSS file isn't properly formed (usually
+because it includes illegal HTML), or if Magpie can't download the remote RSS
+file, and there is no cached version.
+
+If you don't want your users to see these warnings change your error_reporting
+settings to only display ERRORs. Another option is to turn off display_error,
+so that WARNINGs, and NOTICEs still go to the error_log but not to the webpages.
+
+You can do this with:
+
+ini_set('display_errors', 0);
+
+See: http://www.php.net/error_reporting,
+ http://www.php.net/ini_set,
+ http://www.php.net/manual/en/ref.errorfunc.php
+
+3. GENERATE A NEW RSS FEED
+
+PROBLEM:
+
+Create an RSS feed for other people to use.
+
+SOLUTION:
+
+Use Useful Inc's RSSWriter (http://usefulinc.com/rss/rsswriter/)
+
+DISCUSSION:
+
+An example of turning a Magpie parsed RSS object back into an RSS file is forth
+coming. In the meantime RSSWriter has great documentation.
+
+4. DISPLAY HEADLINES MORE RECENT THEN X DATE
+
+PROBLEM:
+
+You only want to display headlines that were published on, or after a certain
+date.
+
+
+SOLUTION:
+
+require 'rss_utils.inc';
+
+# get all headlines published today
+$today = getdate();
+
+# today, 12AM
+$date = mktime(0,0,0,$today['mon'], $today['mday'], $today['year']);
+
+$rss = fetch_rss($url);
+
+foreach ( $rss->items as $item ) {
+ $published = parse_w3cdtf($item['dc']['date']);
+ if ( $published >= $date ) {
+ echo "Title: " . $item['title'];
+ echo "Published: " . date("h:i:s A", $published);
+ echo "
+
+Rather then trying to limit the number of items Magpie parses, a much simpler,
+and more flexible approach is to take a "slice" of the array of items. And
+array_slice() is smart enough to do the right thing if the feed has less items
+then $num_items.
+
+
2. Display a Custom Error Message if Something Goes Wrong
+
+
Problem:
+
+You don't want Magpie's error messages showing up if something goes wrong.
+
+
Solution:
+
+# Magpie throws USER_WARNINGS only
+# so you can cloak these, by only showing ERRORs
+error_reporting(E_ERROR);
+
+# check the return value of fetch_rss()
+
+$rss = fetch_rss($url);
+
+if ( $rss ) {
+...display rss feed...
+}
+else {
+ echo "An error occured! " .
+ "Consider donating more $$$ for restoration of services." .
+ "<br>Error Message: " . magpie_error();
+}
+
+
Discussion:
+
+MagpieRSS triggers a warning in a number of circumstances. The 2 most common
+circumstances are: if the specified RSS file isn't properly formed (usually
+because it includes illegal HTML), or if Magpie can't download the remote RSS
+file, and there is no cached version.
+
+If you don't want your users to see these warnings change your error_reporting
+settings to only display ERRORs.
+Another option is to turn off display_error,
+so that WARNINGs, and NOTICEs still go to the error_log but not to the webpages.
+
+You can do this with:
+
+
+# you can also do this in your php.ini file
+ini_set('display_errors', 0);
+
+
+This recipe only works for RSS 1.0 feeds that include the field.
+(which is very good RSS style)
+parse_w3cdtf() is defined in
+rss_utils.inc, and parses RSS style dates into Unix epoch
+seconds.
+
+
+MagpieRSS provides fetch_rss() which takes a URL and returns a
+parsed RSS object, but what if you want to parse a file stored locally that
+doesn't have a URL?
+
+
Solution
+
+require_once('rss_parse.inc');
+
+$rss_file = 'some_rss_file.rdf';
+$rss_string = read_file($rss_file);
+$rss = new MagpieRSS( $rss_string );
+
+if ( $rss and !$rss->ERROR) {
+...display rss...
+}
+else {
+ echo "Error: " . $rss->ERROR;
+}
+
+# efficiently read a file into a string
+# in php >= 4.3.0 you can simply use file_get_contents()
+#
+function read_file($filename) {
+ $fh = fopen($filename, 'r') or die($php_errormsg);
+ $rss_string = fread($fh, filesize($filename) );
+ fclose($fh);
+ return $rss_string;
+}
+
+
+
Discussion
+Here we are using MagpieRSS's RSS parser directly without the convience wrapper
+of fetch_rss(). We read the contents of the RSS file into a
+string, and pass it to the parser constructor. Notice also that error handling
+is subtly different.
+
+
improved error handling, more flexibility for script authors,
+backwards compatible
+
new and better examples! including using MagpieRSS and Smarty
+
new Smarty plugin for RSS date parsing
+
+
+
+
+
+
+
+
+
Why?
+ I wrote MagpieRSS out of a frustration with the limitations of existing
+ solutions. In particular many of the existing PHP solutions seemed to:
+
+
use a parser based on regular expressions, making for an inherently
+ fragile solution
+
only support early versions of RSS
+
discard all the interesting information besides item title, description,
+ and link.
+
not build proper separation between parsing the RSS and displaying it.
+
+ In particular I failed to find any PHP RSS parsers that could sufficiently
+ parse RSS 1.0 feeds, to be useful on the RSS based event feeds we generate
+ at Protest.net.
+
+
+
+ Parses most RSS formats, including support for
+ 1.0 modules and limited
+ namespace support. RSS is packed into convenient data structures; easy to
+ use in PHP, and appropriate for passing to a templating system, like
+ Smarty.
+
+
+
Integrated Object Cache
+
+ Caching the parsed RSS means that the 2nd request is fast, and that
+including the rss_fetch call in your PHP page won't destroy your performance,
+and force you to reply on an external cron job. And it happens transparently.
+
+
+
+ Makes extensive use of constants to allow overriding default behaviour, and
+ installation on shared hosts.
+
+
Modular
+
+
rss_fetch.inc - wraps a simple interface (fetch_rss())
+ around the library.
+
rss_parse.inc - provides the RSS parser, and the RSS object
+
rss_cache.inc - a simple (no GC) object cache, optimized for RSS objects
+
rss_utils.inc - utility functions for working with RSS. currently
+ provides parse_w3cdtf(), for parsing W3CDTF into epoch seconds.
+
+
+
+
+
+
+
+
Magpie's approach to parsing RSS
+
+ Magpie takes a naive, and inclusive approach. Absolutely
+ non-validating, as long as the RSS feed is well formed, Magpie will
+ cheerfully parse new, and never before seen tags in your RSS feeds.
+
+
+ This makes it very simple support the varied versions of RSS simply, but
+ forces the consumer of a RSS feed to be cognizant of how it is
+ structured.(at least if you want to do something fancy)
+
+
+ Magpie parses a RSS feed into a simple object, with 4 fields:
+ channel, items, image, and
+ textinput.
+
+
+
channel
+ $rss->channel contains key-value pairs of all tags, without
+ nested tags, found between the root tag (<rdf:RDF>, or <rss>)
+ and the end of the document.
+
+
+
items
+ $rss->items is an array of associative arrays, each one
+ describing a single item. An example that looks like:
+
+<item rdf:about="http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257">
+<title>Weekly Peace Vigil</title>
+<link>http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257</link>
+<description>Wear a white ribbon</description>
+<dc:subject>Peace</dc:subject>
+<ev:startdate>2002-06-01T11:00:00</ev:startdate>
+<ev:location>Northampton, MA</ev:location>
+<ev:enddate>2002-06-01T12:00:00</ev:enddate>
+<ev:type>Protest</ev:type>
+</item>
+
+ Is parsed, and pushed on the $rss->items array as:
+
+array(
+ title => 'Weekly Peace Vigil',
+ link => 'http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257',
+ description => 'Wear a white ribbon',
+ dc => array (
+ subject => 'Peace'
+ ),
+ ev => array (
+ startdate => '2002-06-01T11:00:00',
+ enddate => '2002-06-01T12:00:00',
+ type => 'Protest',
+ location => 'Northampton, MA'
+ )
+);
+
+
+
+
image and textinput
+$rss->image and $rss-textinput are associative arrays
+including name-value pairs for anything found between the respective parent
+tags.
+
+
+
+Error: PHP compiled without XML support (--with-xml), Mapgie won't work without PHP support for XML. \n";
+ exit;
+ }
+ else {
+ echo "OK: Found an XML parser. \n";
+ }
+
+ if ( ! function_exists('gzinflate') ) {
+ echo "Warning: PHP compiled without Zlib support (--with-zlib). No support for GZIP encoding. \n";
+ }
+ else {
+ echo "OK: Support for GZIP encoding. \n";
+ }
+
+ if ( ! (function_exists('iconv') and function_exists('mb_convert_encoding') ) ) {
+ echo "Warning: No support for iconv (--with-iconv) or multi-byte strings (--enable-mbstring)." .
+ "No support character set munging. \n";
+ }
+ else {
+ echo "OK: Support for character munging. \n";
+ }
+}
+
+?>
diff --git a/contrib/magpierss-0.72/scripts/magpie_simple.php b/contrib/magpierss-0.72/scripts/magpie_simple.php
new file mode 100755
index 0000000..282735e
--- /dev/null
+++ b/contrib/magpierss-0.72/scripts/magpie_simple.php
@@ -0,0 +1,29 @@
+channel['title'] . "
+This is a simple example script. If this was a real script we probably wouldn't allow strangers to submit random URLs, and we certainly wouldn't simply echo anything passed in the URL. Additionally its a bad idea to leave this example script lying around.
+
\ No newline at end of file
diff --git a/contrib/magpierss-0.72/scripts/magpie_slashbox.php b/contrib/magpierss-0.72/scripts/magpie_slashbox.php
new file mode 100755
index 0000000..bbef30b
--- /dev/null
+++ b/contrib/magpierss-0.72/scripts/magpie_slashbox.php
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+";
+ $rss = fetch_rss( $url );
+ echo slashbox ($rss);
+}
+
+echo "