Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 2cc5968d50c1fd98c1d346f5e8bc21d5acf9066f root committed Apr 30, 2009
Showing with 23,631 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +40 −0 .htaccess
  3. +34 −0 INSTALL
  4. +27 −0 admin/.htaccess
  5. +6 −0 admin/deletecache.php
  6. +26 −0 admin/htaccess
  7. +33 −0 admin/index.php
  8. +59 −0 admin/sitemap/sitemap.xml
  9. +43 −0 admin/xsl/epoz.xsl
  10. +6 −0 bla
  11. +121 −0 div/db/mysql.sql
  12. BIN favicon.ico
  13. +32 −0 htaccess
  14. BIN images/atompixel.png
  15. BIN images/pearpowered.png
  16. BIN images/phppowered.png
  17. BIN images/popoon.png
  18. BIN images/rss092.gif
  19. BIN images/rss1.gif
  20. BIN images/rss2.gif
  21. +41 −0 inc/config.inc.php-dist
  22. 0 inc/deletecache.php
  23. +32 −0 index.php
  24. +4 −0 info.php
  25. +22 −0 js/search.js
  26. +350 −0 libs/aggregator.php
  27. +341 −0 libs/aggregator.php.orig
  28. +21 −0 libs/aggregator.php.rej
  29. +1 −0 libs/magpierss/AUTHORS
  30. +18 −0 libs/magpierss/CHANGES
  31. +185 −0 libs/magpierss/ChangeLog
  32. +21 −0 libs/magpierss/INSTALL
  33. +53 −0 libs/magpierss/NEWS
  34. +48 −0 libs/magpierss/README
  35. +152 −0 libs/magpierss/TROUBLESHOOTING
  36. +125 −0 libs/magpierss/cookbook
  37. +1,208 −0 libs/magpierss/extlib/Snoopy.class.inc
  38. +184 −0 libs/magpierss/rss_cache.inc
  39. +438 −0 libs/magpierss/rss_fetch.inc
  40. +567 −0 libs/magpierss/rss_parse.inc
  41. +67 −0 libs/magpierss/rss_utils.inc
  42. +27 −0 libs/magpierss/scripts/README
  43. +31 −0 libs/magpierss/scripts/magpie_debug.php
  44. +25 −0 libs/magpierss/scripts/magpie_simple.php
  45. +66 −0 libs/magpierss/scripts/magpie_slashbox.php
  46. +58 −0 libs/magpierss/scripts/simple_smarty.php
  47. +31 −0 libs/magpierss/scripts/smarty_plugin/modifier.rss_date_parse.php
  48. +46 −0 libs/magpierss/scripts/templates/simple.smarty
  49. +3,789 −0 libs/popoon/ChangeLog
  50. +202 −0 libs/popoon/LICENSE
  51. +2 −0 libs/popoon/NOTICE
  52. +1 −0 libs/popoon/VERSION
  53. +27 −0 libs/popoon/autoload.php
  54. +213 −0 libs/popoon/classes/browser.php
  55. +313 −0 libs/popoon/classes/config.php
  56. +59 −0 libs/popoon/classes/externalinput.php
  57. +35 −0 libs/popoon/classes/i18n.php
  58. +608 −0 libs/popoon/classes/structure2xml.php
  59. +279 −0 libs/popoon/component.php
  60. +43 −0 libs/popoon/components/action.php
  61. +408 −0 libs/popoon/components/actions/bxe_newarticle.php
  62. +87 −0 libs/popoon/components/actions/bxe_save.php
  63. +70 −0 libs/popoon/components/actions/davput.php
  64. +56 −0 libs/popoon/components/actions/db_query.php
  65. +59 −0 libs/popoon/components/actions/httpauth.php
  66. +85 −0 libs/popoon/components/actions/mail.php
  67. +166 −0 libs/popoon/components/actions/pearauth.php
  68. +275 −0 libs/popoon/components/actions/pwforgotten.php
  69. +101 −0 libs/popoon/components/actions/querybuilder.php
  70. +97 −0 libs/popoon/components/actions/querybuilder.xsl
  71. +61 −0 libs/popoon/components/actions/search2sql.php
  72. +87 −0 libs/popoon/components/actions/sessionstorer.php
  73. +50 −0 libs/popoon/components/actions/simple.php
  74. +96 −0 libs/popoon/components/actions/simpleperm.php
  75. +89 −0 libs/popoon/components/actions/slidemladmin.php
  76. +138 −0 libs/popoon/components/aggregator.php
  77. +565 −0 libs/popoon/components/cache.php
  78. +131 −0 libs/popoon/components/generator.php
  79. +88 −0 libs/popoon/components/generators/db2xml.php
  80. 0 libs/popoon/components/generators/deletecache.php
  81. +254 −0 libs/popoon/components/generators/directory.php
  82. +149 −0 libs/popoon/components/generators/error.php
  83. +213 −0 libs/popoon/components/generators/phpwiki.php
  84. +198 −0 libs/popoon/components/generators/planet.php
  85. +146 −0 libs/popoon/components/generators/pwforgotten.php
  86. +147 −0 libs/popoon/components/generators/s9y.php
  87. +310 −0 libs/popoon/components/generators/search.php
  88. +523 −0 libs/popoon/components/generators/search/MnogoSearch.php
  89. +319 −0 libs/popoon/components/generators/search/SwishE.php
  90. +713 −0 libs/popoon/components/generators/structure2xml.php
  91. +102 −0 libs/popoon/components/generators/structureslider.php
  92. +148 −0 libs/popoon/components/generators/textfile.php
  93. +748 −0 libs/popoon/components/generators/usercomments.php
  94. +71 −0 libs/popoon/components/generators/webdav/popoon.php
  95. +142 −0 libs/popoon/components/generators/webdavfile.php
  96. +134 −0 libs/popoon/components/generators/xmlfile.php
  97. +141 −0 libs/popoon/components/generators/xmlrpc_server.php
  98. +76 −0 libs/popoon/components/generators/xmlvariable.php
  99. +168 −0 libs/popoon/components/generators/yawiki.php
  100. +174 −0 libs/popoon/components/matcher.php
  101. +45 −0 libs/popoon/components/matchers/always.php
  102. +52 −0 libs/popoon/components/matchers/any.php
  103. +78 −0 libs/popoon/components/matchers/phpglobals.php
  104. +74 −0 libs/popoon/components/matchers/phpglobalvars.php
  105. +47 −0 libs/popoon/components/matchers/uri.php
  106. +72 −0 libs/popoon/components/reader.php
  107. +74 −0 libs/popoon/components/readers/info.php
  108. +70 −0 libs/popoon/components/readers/php.php
  109. +71 −0 libs/popoon/components/readers/phpsource.php
  110. +95 −0 libs/popoon/components/readers/resource.php
  111. +81 −0 libs/popoon/components/readers/textsource.php
  112. +72 −0 libs/popoon/components/readers/tgz.php
  113. +40 −0 libs/popoon/components/schemes/BX_BITLIB_DIR.php
  114. +41 −0 libs/popoon/components/schemes/BX_PROJECT_DIR.php
  115. +52 −0 libs/popoon/components/schemes/config.php
  116. +34 −0 libs/popoon/components/schemes/globals.php
  117. +44 −0 libs/popoon/components/schemes/lang.php
  118. +36 −0 libs/popoon/components/schemes/options.php
  119. +74 −0 libs/popoon/components/schemes/peardb.php
  120. +39 −0 libs/popoon/components/schemes/php.php
  121. +61 −0 libs/popoon/components/schemes/phpglobals.php
  122. +45 −0 libs/popoon/components/schemes/phpglobalsclean.php
  123. +40 −0 libs/popoon/components/schemes/popoonmap.php
  124. +157 −0 libs/popoon/components/selector.php
  125. +52 −0 libs/popoon/components/selectors/any.php
  126. +50 −0 libs/popoon/components/selectors/eval.php
  127. +72 −0 libs/popoon/components/selectors/phpglobalvars.php
  128. +44 −0 libs/popoon/components/selectors/requestmethod.php
  129. +42 −0 libs/popoon/components/selectors/uri.php
  130. +110 −0 libs/popoon/components/serializer.php
  131. +60 −0 libs/popoon/components/serializers/debug.php
  132. +122 −0 libs/popoon/components/serializers/fo2pdf.php
  133. +70 −0 libs/popoon/components/serializers/html.php
  134. +72 −0 libs/popoon/components/serializers/html2html.php
  135. +15 −0 libs/popoon/components/serializers/html2html/html2html.xsl
  136. +76 −0 libs/popoon/components/serializers/htmlwithmailobfuscator.php
  137. +129 −0 libs/popoon/components/serializers/xhtml.php
  138. +63 −0 libs/popoon/components/serializers/xml.php
  139. +62 −0 libs/popoon/components/serializers/xmldom.php
  140. +84 −0 libs/popoon/components/serializers/xmlformatted.php
  141. +300 −0 libs/popoon/components/serializers/zip.php
  142. +113 −0 libs/popoon/components/transformer.php
  143. +335 −0 libs/popoon/components/transformers/formwizard.php
  144. +244 −0 libs/popoon/components/transformers/formwizard/xml2html.xsl
  145. +66 −0 libs/popoon/components/transformers/formwizard/xml2sqlinsert.xsl
  146. +94 −0 libs/popoon/components/transformers/highlightcode.php
  147. +208 −0 libs/popoon/components/transformers/i18n.php
  148. +77 −0 libs/popoon/components/transformers/i18n/xml.php
  149. +43 −0 libs/popoon/components/transformers/libxslt.php
  150. +74 −0 libs/popoon/components/transformers/mailobfuscator.php
  151. +111 −0 libs/popoon/components/transformers/mixedcontent.php
  152. +135 −0 libs/popoon/components/transformers/phpprocessor.php
  153. +174 −0 libs/popoon/components/transformers/phpprocessorsax.php
  154. +129 −0 libs/popoon/components/transformers/phpsource.php
  155. +98 −0 libs/popoon/components/transformers/searchhighlighter.php
  156. +117 −0 libs/popoon/components/transformers/sourceview.php
  157. +100 −0 libs/popoon/components/transformers/tidy.php
  158. +436 −0 libs/popoon/components/transformers/xforms.php
  159. +411 −0 libs/popoon/components/transformers/xforms.xsl
Sorry, we could not display the entire diff because too many files (314) changed.
4 .gitignore
@@ -0,0 +1,4 @@
+.svn
+tmp
+s9y
+s9y.
40 .htaccess
@@ -0,0 +1,40 @@
+php_value error_reporting 2039
+#php_flag display_errors on
+php_value magic_quotes_gpc off
+
+AddDefaultCharset utf-8
+php_value default_charset utf-8
+
+RewriteEngine On
+RewriteRule blog/rss.php ./s9y/rss.php [L]
+RewriteRule blog/serendipity_xmlrpc.php ./s9y/serendipity_xmlrpc.php [L]
+RewriteRule blog/templates/(.+) ./s9y/templates/$1 [L]
+RewriteRule blog/pixel/(.+) ./s9y/pixel/$1 [L]
+
+RewriteCond %{REQUEST_URI} !^/*themes/planet-php/.*
+RewriteCond %{REQUEST_URI} !^/*themes/standard/.*
+RewriteRule ^/*themes/(.+)$ ./themes/planet-php/$1 [L]
+# 195.226.16.50
+RewriteCond %{REMOTE_ADDR} 72.55.156.179
+RewriteRule /*rdf/ ./rippers/rdf.php [L]
+
+
+
+RewriteCond %{REQUEST_URI} !^/*themes/planet-php/.*
+RewriteCond %{REQUEST_URI} !^/*index.php
+RewriteCond %{REQUEST_URI} !^.*info.php
+RewriteCond %{REQUEST_URI} !^.*test.php
+RewriteCond %{REQUEST_URI} !^.*js/
+RewriteCond %{REQUEST_URI} !^.*ping/
+RewriteCond %{REQUEST_URI} !^.*images/
+RewriteCond %{REQUEST_URI} !^.*rippers/
+RewriteCond %{REQUEST_URI} !^.*submit/
+RewriteCond %{REQUEST_URI} !^.*robots.txt
+RewriteCond %{REQUEST_URI} !^/*s9y/
+RewriteCond %{REQUEST_URI} !^.*admin/
+RewriteCond %{REQUEST_URI} !^.*_vti_.*
+RewriteCond %{REQUEST_URI} !favicon.ico
+RewriteCond %{REQUEST_URI} !search.html
+RewriteCond %{REQUEST_URI} !planet-php.src
+RewriteRule ^(.+)$ ./index.php?path=$1 [QSA]
+
34 INSTALL
@@ -0,0 +1,34 @@
+PREQUISITES
+***********
+
+- PHP 5 (with enabled xslt support -> --with-xsl)
+- The tidy extension (optional, if you don't want to tidy it, just comment it out in the sitemap)
+- A database (only tested with mysql, but should work with others, too)
+- MDB2 ( pear install MDB2)
+- Cache (pear install Cache), if you want caching
+
+
+INSTALLATION
+************
+
+
+- checkout with subversion
+ svn co http://svn.bitflux.org/repos/public/planet-php/trunk planet-php
+
+ (or use a webdav client an copy it from the above http location)
+
+- cp inc/config.inc.php-dist to inc/config.inc.php
+
+- adjust the dsn parameter (and other config options if you want)
+
+- make a "tmp" directory and make it writeable for the webserver
+
+- import the db from div/db/mysql.sql
+
+- import the feeds with the libs/scripts/aggregate.php script
+
+- open the page ;)
+
+- Administration has to be done via phpMyAdmin (or similar), just add your
+ RSS feeds to the entries table. The rest should be done automatically.
+.
27 admin/.htaccess
@@ -0,0 +1,27 @@
+php_value error_reporting 2039
+php_value magic_quotes_gpc off
+
+RewriteEngine On
+RewriteRule ^webdav$ %{REQUEST_URI}/ [L,R]
+
+
+
+RewriteCond %{REQUEST_URI} !^.*index.php
+RewriteCond %{REQUEST_URI} !^.*deletecache.php
+RewriteCond %{REQUEST_URI} !^.*epoz/
+RewriteCond %{REQUEST_URI} !^.*_vti_.*
+
+RewriteRule ^(.+)$ ./index.php?path=$1 [QSA]
+
+ deny from all
+# Allow From 212.71.98.109
+# Allow From 212.71.97.156
+ Allow From 127.0.0.1
+#Allow From 212.55.202.249
+Allow From 194.50.176.165
+AuthType Basic
+AuthName EBP-Preview
+AuthUserFile /home/bitflux/.htpasswd
+Satisfy any
+require valid-user
+
6 admin/deletecache.php
@@ -0,0 +1,6 @@
+<?php
+//baad style
+chdir("../tmp/");
+ exec("find cache/outputcache/ -mindepth 1 | xargs rm -rf");
+ exec("find cache/outputcache.meta/ -mindepth 1 -mtime +7 | xargs rm -rf");
+ exec("find magpie/ -mindepth 1 -mmin +360 | xargs rm -rf");
26 admin/htaccess
@@ -0,0 +1,26 @@
+php_value error_reporting 2039
+php_value magic_quotes_gpc off
+
+RewriteEngine On
+RewriteRule ^webdav$ %{REQUEST_URI}/ [L,R]
+
+
+
+RewriteCond %{REQUEST_URI} !^.*index.php
+RewriteCond %{REQUEST_URI} !^.*deletecache.php
+RewriteCond %{REQUEST_URI} !^.*epoz/
+RewriteCond %{REQUEST_URI} !^.*_vti_.*
+
+RewriteRule ^(.+)$ ./index.php?path=$1 [QSA]
+
+ deny from all
+# Allow From 212.71.98.109
+ Allow From 212.71.97.156
+ Allow From 127.0.0.1
+
+AuthType Basic
+AuthName EBP-Preview
+AuthUserFile /home/bitflux/.htpasswd
+Satisfy any
+require valid-user
+
33 admin/index.php
@@ -0,0 +1,33 @@
+<?php
+// +----------------------------------------------------------------------+
+// | Planet PHP |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 2003 |
+// +----------------------------------------------------------------------+
+// | This program is subject to the GPL license. |
+// +----------------------------------------------------------------------+
+// | Author: Bitflux GmbH <developer@bitflux.ch> |
+// +----------------------------------------------------------------------+
+//
+// : sitemap.php,v 1.5 2002/03/27 07:59:05 chregu Exp $
+//apd_set_session_trace(35);
+//print_r($_SERVER['REQUEST_METHOD']);
+include('../inc/config.inc.php');
+ini_set("log_errors",true);
+$BX_config['popoon']['sm2php_xsl_dir'] = BX_POPOON_DIR.'/popoon/sitemap';
+$BX_config['popoon']['cacheDir'] = BX_PROJECT_DIR.'tmp/';
+/*$BX_config['popoon']['cacheParams'] = array('cache_dir' => BX_PROJECT_DIR.'/tmp/cache','encoding_mode'=>'slash');
+$BX_config['popoon']['cacheContainer'] = 'file';*/
+
+include_once(BX_POPOON_DIR."/popoon/popoon.php");
+if (isset($_GET['path'])) {
+ $path = $_GET['path'];
+} else {
+ $path = "";
+}
+$sitemap = new popoon (BX_PROJECT_DIR."/admin/sitemap/sitemap.xml",$path,
+$BX_config['popoon']
+);
+
+?>
+
59 admin/sitemap/sitemap.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+ <map:components>
+ <map:schemes>
+ <map:scheme name="config" path="BX_PROJECT_DIR:///inc/config.inc.php" global="yes" variable="BX_config"/>
+ </map:schemes>
+ </map:components>
+
+ <map:pipelines>
+
+
+ <map:pipeline>
+ <map:match type="uri" pattern="webdav/*">
+ <map:generate type="webdav_file">
+ <map:parameter name="fsroot" value="BX_PROJECT_DIR:///data/"/>
+ <map:parameter name="webroot" value="webdav"/>
+ </map:generate>
+ <map:serialize type="xml"/>
+
+ </map:match>
+ </map:pipeline>
+
+ <map:pipeline>
+ <map:match type="uri" pattern="edit/*.xhtml">
+ <map:generate type="xmlfile" src="BX_PROJECT_DIR:///admin/epoz/common/epozmacros.html"/>
+ <map:transform type="xslt" mode="libxslt" src="BX_PROJECT_DIR:///admin/xsl/epoz.xsl">
+ <map:parameter name="src" value="../data/{1}.xhtml"/>
+ </map:transform>
+ <map:serialize type="html"/>
+ </map:match>
+ </map:pipeline>
+
+
+
+ <map:pipeline>
+ <map:match type="uri" pattern="data/*.xhtml">
+ <map:select type="requestmethod">
+ <map:when test="PUT">
+ <map:act type="davput">
+ <map:parameter name="src" value="BX_PROJECT_DIR:///data/{1}.xhtml"/>
+ </map:act>
+ <!-- <map:generate type="xmlfile" src="BX_PROJECT_DIR:///data/{1}.xhtml"/>
+ <map:serialize type="xhtml"/>-->
+ </map:when>
+ <map:otherwise>
+ <map:generate type="xmlfile" src="BX_PROJECT_DIR:///data/{1}.xhtml"/>
+ <map:serialize type="xhtml"/>
+ </map:otherwise>
+ </map:select>
+
+ </map:match>
+ </map:pipeline>
+
+
+ </map:pipelines>
+
+</map:sitemap>
43 admin/xsl/epoz.xsl
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:metal="http://xml.zope.org/namespaces/metal"
+xmlns:xhtml="http://www.w3.org/1999/xhtml">
+ <xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
+ <xsl:param name="src"/>
+
+
+
+ <xsl:template match="*">
+
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="/xhtml:html/xhtml:body//xhtml:iframe[@id='epoz-editor']/@src">
+ <xsl:attribute name="src"><xsl:value-of select="$src"/></xsl:attribute>
+ <xsl:attribute name="dst"><xsl:value-of select="$src"/></xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="/xhtml:html/xhtml:head//metal:css">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:apply-templates/>
+
+ </xsl:copy>
+
+
+ </xsl:template>
+
+
+ <xsl:template match="@*">
+ <xsl:copy/>
+ </xsl:template>
+ <xsl:template match="@src">
+ <xsl:attribute name="src">../epoz/common/<xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+<xsl:template match="@href">
+ <xsl:attribute name="href">../epoz/common/<xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+</xsl:stylesheet>
6 bla
@@ -0,0 +1,6 @@
+-rw-r--r-- 1 planet-php planet-php 1780 May 13 08:12 ./libs/magpierss/rss_utils.inc
+-rw-r--r-- 1 planet-php planet-php 5065 May 13 08:12 ./libs/magpierss/rss_cache.inc
+-rw-r--r-- 1 planet-php planet-php 36158 May 13 08:12 ./libs/magpierss/extlib/Snoopy.class.inc
+-rw-r--r-- 1 planet-php planet-php 12259 May 13 08:12 ./libs/magpierss/rss_fetch.inc
+-rw-r--r-- 1 planet-php planet-php 9243 May 13 08:12 ./libs/magpierss/rss_parse.inc
+
121 div/db/mysql.sql
@@ -0,0 +1,121 @@
+-- MySQL dump 10.11
+--
+-- Host: localhost Database: planet-php
+-- ------------------------------------------------------
+-- Server version 5.0.51a-24+lenny1
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL40' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `blogs`
+--
+
+DROP TABLE IF EXISTS `blogs`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `blogs` (
+ `ID` int(11) NOT NULL auto_increment,
+ `link` varchar(255) NOT NULL default '',
+ `title` varchar(255) NOT NULL default '',
+ `description` tinytext,
+ `changed` timestamp NOT NULL default '0000-00-00 00:00:00',
+ `author_old` varchar(100) NOT NULL default '',
+ `dontshowblogtitle` tinyint(4) NOT NULL default '1',
+ PRIMARY KEY (`ID`),
+ UNIQUE KEY `link` (`link`)
+) TYPE=MyISAM AUTO_INCREMENT=33958;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `entries`
+--
+
+DROP TABLE IF EXISTS `entries`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `entries` (
+ `ID` int(11) NOT NULL default '0',
+ `feedsID` int(11) NOT NULL default '0',
+ `title` tinytext,
+ `link` tinytext NOT NULL,
+ `description` text,
+ `dc_date` datetime default '0000-00-00 00:00:00',
+ `dc_creator` varchar(100) default NULL,
+ `content_encoded` text,
+ `changed` timestamp NOT NULL,
+ `md5` varchar(32) NOT NULL default '',
+ `guid` varchar(255) NOT NULL default '',
+ PRIMARY KEY (`ID`),
+ UNIQUE KEY `guid` (`guid`(250)),
+ KEY `rss_feed_ID` (`feedsID`),
+ FULLTEXT KEY `search` (`description`,`content_encoded`,`title`)
+) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `feeds`
+--
+
+DROP TABLE IF EXISTS `feeds`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `feeds` (
+ `ID` int(11) NOT NULL auto_increment,
+ `blogsID` int(11) NOT NULL default '0',
+ `link` varchar(255) NOT NULL default '',
+ `changed` timestamp NOT NULL,
+ `cats` varchar(255) NOT NULL default '',
+ `section` varchar(50) NOT NULL default 'default',
+ `author` varchar(200) NOT NULL default '',
+ PRIMARY KEY (`ID`),
+ UNIQUE KEY `rssURL` (`link`),
+ KEY `blogID` (`blogsID`),
+ KEY `section` (`section`)
+) TYPE=MyISAM AUTO_INCREMENT=351;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `planet_seq`
+--
+
+DROP TABLE IF EXISTS `planet_seq`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `planet_seq` (
+ `sequence` int(11) NOT NULL auto_increment,
+ PRIMARY KEY (`sequence`)
+) TYPE=MyISAM AUTO_INCREMENT=34031;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `submissions`
+--
+
+DROP TABLE IF EXISTS `submissions`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `submissions` (
+ `id` int(11) NOT NULL auto_increment,
+ `name` varchar(200) NOT NULL default '',
+ `url` varchar(200) NOT NULL default '',
+ `rss` varchar(200) NOT NULL default '',
+ `description` text NOT NULL,
+ `changed` timestamp NOT NULL,
+ `email` varchar(200) NOT NULL default '',
+ `state` tinyint(4) NOT NULL default '0',
+ `rejectreason` text NOT NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=612;
+SET character_set_client = @saved_cs_client;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2009-04-30 16:02:31
BIN favicon.ico
Binary file not shown.
32 htaccess
@@ -0,0 +1,32 @@
+# The following php_* instruction only work, if you're running
+# php as apache-module, not as cgi.
+# they are not really needed...
+php_value error_reporting 2039
+#php_flag display_errors on
+php_value magic_quotes_gpc off
+
+RewriteEngine On
+RewriteRule blog/rss.php ./s9y/rss.php [L]
+RewriteRule blog/serendipity_xmlrpc.php ./s9y/serendipity_xmlrpc.php [L]
+RewriteRule blog/templates/(.+) ./s9y/templates/$1 [L]
+RewriteRule blog/pixel/(.+) ./s9y/pixel/$1 [L]
+
+RewriteCond %{REQUEST_URI} !^/*themes/planet-php/.*
+RewriteCond %{REQUEST_URI} !^/*themes/standard/.*
+RewriteRule ^/*themes/(.+)$ ./themes/planet-php/$1 [L]
+
+
+RewriteCond %{REQUEST_URI} !^/*themes/planet-php/.*
+RewriteCond %{REQUEST_URI} !^/*index.php
+RewriteCond %{REQUEST_URI} !^.*info.php
+RewriteCond %{REQUEST_URI} !^.*test.php
+RewriteCond %{REQUEST_URI} !^.*js/
+RewriteCond %{REQUEST_URI} !^.*images/
+RewriteCond %{REQUEST_URI} !^.*robots.txt
+RewriteCond %{REQUEST_URI} !^/*s9y/
+RewriteCond %{REQUEST_URI} !^.*admin/
+RewriteCond %{REQUEST_URI} !^.*_vti_.*
+RewriteCond %{REQUEST_URI} !favicon.ico
+RewriteCond %{REQUEST_URI} !search.html
+RewriteRule ^(.+)$ ./index.php?path=$1 [QSA]
+
BIN images/atompixel.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/pearpowered.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/phppowered.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/popoon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/rss092.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/rss1.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/rss2.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 inc/config.inc.php-dist
@@ -0,0 +1,41 @@
+<?php
+
+define(PATH_SEPARATOR,":");
+define('BX_PROJECT_DIR',substr(__FILE__,0,-18));
+define('BX_POPOON_DIR', BX_PROJECT_DIR.'libs/popoon/');
+define('BX_INCLUDE_DIR', BX_PROJECT_DIR. 'libs/');
+define('BX_TEMP_DIR', BX_PROJECT_DIR. 'tmp/');
+
+ini_set('include_path',BX_INCLUDE_DIR.PATH_SEPARATOR.BX_POPOON_DIR.PATH_SEPARATOR.ini_get('include_path'));
+include_once(BX_POPOON_DIR.'/autoload.php');
+//this global is somehow ugly...
+$GLOBALS['POOL'] = popoon_pool::getInstance("popoon_classes_config");
+$BX_config = $GLOBALS['POOL']->config;
+
+
+
+$BX_config['dsn'] = 'mysql://user:pass@localhost/planet-php';
+$BX_config['webRoot'] = "/";
+
+
+// local timezone relative to utc (in hours)
+
+$BX_config['webTimezone'] = "0";
+$BX_config['theme'] = 'planet-php';
+
+define('VERBOSE', TRUE);
+define('MAGPIE_CACHE_DIR', BX_PROJECT_DIR.'/tmp/magpie/');
+define('MAGPIE_CACHE_AGE', 1000);
+define('MAGPIE_USER_AGENT', 'PlanetPHPAggregator/0.2 (PHP5) (http://planet-php.org/)');
+
+
+$BX_config->setOutputCacheCallback("checkOutputCaching");
+function checkOutputCaching() {
+if ($_SERVER['REMOTE_ADDR'] == "212.71.98.109") {
+ return false;
+}
+ return true;
+
+}
+
+?>
0 inc/deletecache.php
No changes.
32 index.php
@@ -0,0 +1,32 @@
+<?php
+// +----------------------------------------------------------------------+
+// | Planet PHP |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 2003 |
+// +----------------------------------------------------------------------+
+// | This program is subject to the GPL license. |
+// +----------------------------------------------------------------------+
+// | Author: Bitflux GmbH <developer@bitflux.ch> |
+// +----------------------------------------------------------------------+
+//
+// : sitemap.php,v 1.5 2002/03/27 07:59:05 chregu Exp $
+//apd_set_session_trace(35);
+/*if ($_SERVER['REMOTE_ADDR'] != "80.218.7.144") {
+ header("HTTP/1.1 503 Service Temporarily Unavailable");
+ print "<h1>503 Service Temporarily Unavailable</h1>";
+ print "Software Maintenance. Please come back in a few minutes";
+die();
+}*/
+error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
+
+include('./inc/config.inc.php');
+
+ini_set("log_errors",true);
+include_once(BX_POPOON_DIR."popoon.php");
+if (!isset($_GET['path'])) {
+ $_GET['path'] = "";
+}
+$sitemap = new popoon (BX_PROJECT_DIR."/sitemap/sitemap.xml",$_GET["path"],
+NULL
+);
+
4 info.php
@@ -0,0 +1,4 @@
+<?php
+
+phpinfo();
+?>
22 js/search.js
@@ -0,0 +1,22 @@
+ function niceURL () {
+ var value=document.getElementById("searchtext").value;
+ window.location.href = "/search/" + value;
+ return false;
+ }
+
+function addEngine()
+ {
+ if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function"))
+ {
+ window.sidebar.addSearchEngine(
+ "http://www.planet-php.net/planet-php.src", /* engine URL */
+ "http://www.planet-php.net/themes/img/planet-php.jpg", /* icon URL */
+ "Planet-PHP", /* engine name */
+ "Web" ); /* category name */
+ }
+ else
+ {
+ alert("Mozilla M15 or later is required to add a search engine.");
+ }
+ }
+
350 libs/aggregator.php
@@ -0,0 +1,350 @@
+<?php
+while (getLoad() > 7) {
+ print "load > 7. wait 20 sec. \n";
+ sleep(20);
+}
+
+include_once('MDB2.php');
+include_once('utf2entities.php');
+//include_once('HTTP/Request.php');
+
+include_once('magpierss/rss_fetch.inc');
+
+class aggregator {
+
+ var $mdb = null;
+
+ function aggregator() {
+ $this->__construct();
+ }
+
+ function __construct() {
+ $this->mdb = MDB2::connect($GLOBALS['BX_config']['dsn']);
+ if(MDB2::isError($this->mdb)) {
+ die('unable to connect to db');
+ }
+ }
+
+ function aggregateAllBlogs($id = null) {
+ if ($id) {
+ $where = "where ID = $id";
+ }
+ $res = $this->mdb->query("select ID,blogsID as blogsid, link, cats, section from feeds $where");
+ if (MDB2::isError($res)) {
+ print $res->getMessage();
+ print "\n";
+ print $res->getUserinfo();
+ die();
+ }
+ while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
+ //get remote feed from magpie
+ while (getLoad() > 8) {
+ print "load > 8. wait 20 sec. \n";
+ sleep(20);
+ }
+
+ $feed = $this->getRemoteFeed($row['link']);
+ if(!$feed) {
+ continue;
+ }
+ //check if this blog already exists
+
+ if (!$feed->channel['link']) {
+ if (isset($feed->channel['link_'])) {
+ $feed->channel['link'] = $feed->channel['link_'];
+ } else {
+ print "NO channel/link... PLEASE FIX THIS\n";
+ continue;
+ }
+ }
+
+ $blog = $this->getBlogEntry($feed->channel['link']);
+ if (!$blog) {
+ $id = $this->insertBlogEntry($feed->channel);
+ print "new Blog: " .$feed->channel['title'] ."\n";
+ $newBlog = true;
+ } else {
+ //TODO: check for changed channel entries
+ $id = $blog['id'];
+ if ($feed->channel['title'] && $blog['title'] != $feed->channel['title'] && $row['section'] != 'comments') {
+ $this->updateBlogEntry($feed->channel, $id);
+ }
+ $newBlog = false;
+ }
+ // update id, if not the same
+ if ($row['blogsid'] != $id) {
+ $this->updateFeedBlogID($row['link'], $id);
+ }
+
+ //loop through feeds
+
+ foreach ($feed->items as $item) {
+ if (!isset($item['link']) && isset($item['link_'])) {
+ $item['link'] = $item['link_'];
+ }
+
+ if (!isset($item['content']['encoded']) && isset($item['atom_content'])) {
+ $item['content']['encoded'] = $item['atom_content'];
+ }
+ $item['md5'] = $this->generateMD5($item);
+ if (isset($item['guid'])) {
+ $guid = $item['guid'];
+ } else if(isset($item['origlink'])) {
+ $guid = $item['origlink'];
+ } else {
+ $guid = $item['link'];
+ }
+
+ $feedInDB = $this->getEntry($guid);
+ if (!$feedInDB) {
+
+ // check for categroy stuff
+ // we only do that for new entries
+ if (isset($item['dc']['subject'])) {
+ $item['category'] = $item['dc']['subject'];
+ }
+
+ if ($row['cats']) {
+ $cats = explode(",",$row['cats']);
+ $hit = false;
+ foreach ($cats as $cat) {
+ if (strpos($item['category'],$cat) !== false) {
+ $hit = true;
+ }
+ }
+
+ if (!$hit) {
+ print $item['title'] . " - " . $item['category'] . " not in list\n";
+ continue;
+ }
+ }
+ // insert it in the db
+ $item = $this->truncateEntries($item);
+ $this->insertEntry($item, $row['id'], array("newBlog"=>$newBlog));
+ } else if ($item['md5'] != $feedInDB['md5'] or $feedInDB['dc_date'] == "1970-01-01 00:00:00") {
+ $item = $this->truncateEntries($item);
+ $this->updateEntry($item,$feedInDB['id']);
+ }
+
+ }
+ }
+ }
+
+ function truncateEntries($item) {
+ $maxsize = 5000;
+
+ $item['content']['encoded'] = preg_replace('#src="http://www.pheedo.com/[^"]+"#','',$item['content']['encoded']);
+ $item['description'] = preg_replace('#src="http://www.pheedo.com/[^"]+"#','',$item['description']);
+
+ if (isset($item['content']['encoded']) && strlen($item['content']['encoded']) > $maxsize + 500) {
+ print "TRUNCATE content_encoded on ". $item['title'] ."\n";
+ $morebytes = (strlen($item['content']['encoded']) - $maxsize);
+ $item['content']['encoded'] = $this->getBody(substr($item['content']['encoded'],0,$maxsize));
+ $item['content']['encoded'] .= '<p><i>Truncated by Planet PHP, read more at <a href="'.$item['link'].'">the original</a> (another ' . $morebytes .' bytes)</i></p>';
+ } else if (isset($item['description']) && strlen($item['description']) > $maxsize + 500) {
+ print "TRUNCATE description ". $item['title'] ."\n";
+ $morebytes = (strlen($item['description']) - $maxsize);
+
+ $item['description'] = $this->getBody(substr($item['description'],0,$maxsize));
+ $item['description'] .= '<p><i>Truncated by Planet PHP, read more at <a href="'.$item['link'].'">the original</a> (another ' . $morebytes .' bytes)</i></p>';
+ }
+ return $item;
+ }
+
+ function getBody($html) {
+
+ $d = new DomDocument();
+ $html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>'.$html.'</body>';
+ @$d->loadHTML($html);
+ $xp = new domxpath($d);
+ $res = $xp->query("/html/body/node()");
+ $body = "";
+ foreach ($res as $node) {
+ $body .= $d->saveXML($node);
+ }
+ return $body;
+ }
+
+ function generateMD5($item) {
+
+ return md5($item['title'] .$item['link'] . $item['description'] .$item['content']['encoded']);
+ }
+
+ function updateEntry($item, $entryID) {
+ $date = $this->getDcDate($item, 0,true);
+ $query = "update entries set " .
+ " link = '" .mysql_escape_string(utf2entities($item['link'])) . "'," .
+ " title = '" .mysql_escape_string(utf2entities($item['title'])) . "'," .
+ " description= '" .mysql_escape_string(utf2entities($item['description'])) . "'," .
+ " content_encoded= '" . mysql_escape_string(utf2entities($item['content']['encoded'])) . "',";
+ if ($date) {
+ $query .= " dc_date = '".$date."',";
+ }
+
+ $query .= " md5= '" .$item['md5'] . "' ".
+ " where ID = $entryID";
+ print "update " . $item['title'] ."\n";
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+ return false;
+ } else {
+ return true;
+ }
+ }
+ function insertEntry($item,$feedID, $options = array()) {
+ $id = $this->mdb->nextID("planet");
+ if (isset($options['newBlog']) && $options['newBlog']) {
+ $offset = - 3600 * 144; // offset back to 6 days ago.needed for new blogs without pubdate/dcdate
+ } else {
+ $offset = 0;
+ }
+
+ if (!isset($item['guid']) || $item['guid'] == '') {
+ if (isset($item['origlink'])) {
+ $item['guid'] = $item['origlink'];
+ } else {
+ $item['guid'] = $item['link'];
+ }
+ }
+
+ $date = $this->getDcDate($item, $offset);
+
+ $query = "insert into entries (ID,feedsID, title,link, guid,description,dc_date, dc_creator, content_encoded, md5) VALUES (". $id . "," .
+ $feedID . ",'" .
+
+ mysql_escape_string(utf2entities($item['title'])) . "','" .
+ mysql_escape_string(trim($item['link'])) . "','" .
+ mysql_escape_string(($item['guid'])) . "','" .
+ mysql_escape_string(utf2entities($item['description'])) . "','".
+ $date . "','" .
+ $item['dc']['creator'] . "','" .
+ mysql_escape_string(utf2entities($item['content']['encoded'])) . "','".
+ $item['md5'] . "')";
+
+ print "insert " . $item['title'] ."\n";
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+ return false;
+ } else {
+ return $id;
+ }
+ }
+
+ function getDcDate($item, $nowOffset = 0, $returnNull = false) {
+ //we want the dates in UTC... Looks like MySQL can't handle timezones...
+ //putenv("TZ=UTC");
+ if (isset($item['dc']['date'])) {
+ $dcdate = $this->fixdate($item['dc']['date']);
+ } elseif (isset($item['pubdate'])) {
+ $dcdate = $this->fixdate($item['pubdate']);
+ } elseif (isset($item['published'])) {
+ $dcdate = $this->fixdate($item['published']);
+ } elseif (isset($item['created'])) {
+ $dcdate = $this->fixdate($item['created']);
+ } elseif (isset($item['modified'])) {
+ $dcdate = $this->fixdate($item['modified']);
+ } elseif (isset($item['edited'])) {
+ $dcdate = $this->fixdate($item['edited']);
+ } elseif (isset($item['updated'])) {
+ $dcdate = $this->fixdate($item['updated']);
+ } elseif ($returnNull) {
+ return NULL;
+ } else {
+ //TODO: Find a better alternative here
+ $dcdate = gmdate("Y-m-d H:i:s O",time() + $nowOffset);
+ }
+ return $dcdate;
+
+ }
+
+ function fixdate($date) {
+ $date = preg_replace("/([0-9])T([0-9])/","$1 $2",$date);
+ $date = preg_replace("/([\+\-][0-9]{2}):([0-9]{2})/","$1$2",$date);
+ $time = strtotime($date);
+ //if time is too much in the future (more than 1 hours)
+ // set it to now()
+ if (($time - time()) > 3600) {
+ $time = time();
+ }
+ $date = gmdate("Y-m-d H:i:s O",$time);
+ return $date;
+ }
+
+ function updateFeedBlogID($url, $id) {
+
+ $query = "update feeds set blogsID = $id where link = '$url'";
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+ return false;
+ } else {
+ return $id;
+ }
+ }
+
+ function insertBlogEntry($channel) {
+
+ $id = $this->mdb->nextID("planet");
+ $query = "insert into blogs (ID,title,link,description) VALUES (".
+ $id . ",'" .
+ mysql_escape_string(utf2entities($channel['title'])) . "','" .
+ mysql_escape_string($channel['link']) . "','" .
+ mysql_escape_string(utf2entities($channel['description'])) . "')";
+
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+ return false;
+ } else {
+ return $id;
+ }
+ }
+
+
+ function updateBlogEntry($channel,$id) {
+
+
+ $query = "update blogs set
+ title = '".mysql_escape_string(utf2entities($channel['title'])) . "',
+ link = '".mysql_escape_string($channel['link']) . "',
+ description = '".mysql_escape_string(utf2entities($channel['description'])) . "' where ID = ". $id;
+
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+ return false;
+ } else {
+ return $id;
+ }
+ }
+
+ function getBlogEntry($url) {
+ return $this->mdb->queryRow ("select * from blogs where link = '$url'",null,MDB2_FETCHMODE_ASSOC);
+ }
+
+ function getFeedEntry($url) {
+ return $this->mdb->queryRow ("select * from feeds where link = '$url'",null,MDB2_FETCHMODE_ASSOC);
+ }
+ function getEntry($url) {
+ return $this->mdb->queryRow ("select * from entries where guid = '$url'",null,MDB2_FETCHMODE_ASSOC);
+ }
+
+
+ function getRemoteFeed($url) {
+ print "Get $url \n";
+ if ($feed = fetch_rss($url)) {
+ return $feed;
+ } else {
+ print "$url is not a valid feed \n";
+ return false;
+ }
+
+ }
+
+}
+
+function getLoad() {
+ return substr(file_get_contents("/proc/loadavg"),0,4);
+}
341 libs/aggregator.php.orig
@@ -0,0 +1,341 @@
+<?php
+while (getLoad() > 7) {
+ print "load > 7. wait 20 sec. \n";
+ sleep(20);
+}
+
+include_once('MDB2.php');
+include_once('utf2entities.php');
+//include_once('HTTP/Request.php');
+
+include_once('magpierss/rss_fetch.inc');
+
+class aggregator {
+
+ var $mdb = null;
+
+ function aggregator() {
+ $this->__construct();
+ }
+
+ function __construct() {
+ $this->mdb = MDB2::connect($GLOBALS['BX_config']['dsn']);
+ if(MDB2::isError($this->mdb)) {
+ die('unable to connect to db');
+ }
+ }
+
+ function aggregateAllBlogs($id = null) {
+ if ($id) {
+ $where = "where ID = $id";
+ }
+ $res = $this->mdb->query("select ID,blogsID as blogsid, link, cats, section from feeds $where");
+ if (MDB2::isError($res)) {
+ print $res->getMessage();
+ print "\n";
+ print $res->getUserinfo();
+ die();
+ }
+ while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
+ //get remote feed from magpie
+ while (getLoad() > 8) {
+ print "load > 8. wait 20 sec. \n";
+ sleep(20);
+ }
+
+ $feed = $this->getRemoteFeed($row['link']);
+ if(!$feed) {
+ continue;
+ }
+ //check if this blog already exists
+
+ if (!$feed->channel['link']) {
+ if (isset($feed->channel['link_'])) {
+ $feed->channel['link'] = $feed->channel['link_'];
+ } else {
+ print "NO channel/link... PLEASE FIX THIS\n";
+ continue;
+ }
+ }
+
+ $blog = $this->getBlogEntry($feed->channel['link']);
+ if (!$blog) {
+ $id = $this->insertBlogEntry($feed->channel);
+ print "new Blog: " .$feed->channel['title'] ."\n";
+ $newBlog = true;
+ } else {
+ //TODO: check for changed channel entries
+ $id = $blog['id'];
+ if ($feed->channel['title'] && $blog['title'] != $feed->channel['title'] && $row['section'] != 'comments') {
+ $this->updateBlogEntry($feed->channel, $id);
+ }
+ $newBlog = false;
+ }
+ // update id, if not the same
+ if ($row['blogsid'] != $id) {
+ $this->updateFeedBlogID($row['link'], $id);
+ }
+
+ //loop through feeds
+
+ foreach ($feed->items as $item) {
+
+ if (!isset($item['link']) && isset($item['link_'])) {
+ $item['link'] = $item['link_'];
+ }
+
+ if (!isset($item['content']['encoded']) && isset($item['atom_content'])) {
+ $item['content']['encoded'] = $item['atom_content'];
+ }
+ $item['md5'] = $this->generateMD5($item);
+ if (isset($item['guid'])) {
+ $guid = $item['guid'];
+ } else {
+ $guid = $item['link'];
+ }
+
+ $feedInDB = $this->getEntry($guid);
+ if (!$feedInDB) {
+
+ // check for categroy stuff
+ // we only do that for new entries
+ if (isset($item['dc']['subject'])) {
+ $item['category'] = $item['dc']['subject'];
+ }
+
+ if ($row['cats']) {
+ $cats = explode(",",$row['cats']);
+ $hit = false;
+ foreach ($cats as $cat) {
+ if (strpos($item['category'],$cat) !== false) {
+ $hit = true;
+ }
+ }
+
+ if (!$hit) {
+ print $item['title'] . " - " . $item['category'] . " not in list\n";
+ continue;
+ }
+ }
+ // insert it in the db
+ $item = $this->truncateEntries($item);
+ $this->insertEntry($item, $row['id'], array("newBlog"=>$newBlog));
+ } else if ($item['md5'] != $feedInDB['md5'] or $feedInDB['dc_date'] == "1970-01-01 00:00:00") {
+ $item = $this->truncateEntries($item);
+ $this->updateEntry($item,$feedInDB['id']);
+ }
+
+ }
+ }
+ }
+
+ function truncateEntries($item) {
+ $maxsize = 5000;
+
+ $item['content']['encoded'] = preg_replace('#src="http://www.pheedo.com/[^"]+"#','',$item['content']['encoded']);
+ $item['description'] = preg_replace('#src="http://www.pheedo.com/[^"]+"#','',$item['description']);
+
+ if (isset($item['content']['encoded']) && strlen($item['content']['encoded']) > $maxsize + 500) {
+ print "TRUNCATE content_encoded on ". $item['title'] ."\n";
+ $morebytes = (strlen($item['content']['encoded']) - $maxsize);
+ $item['content']['encoded'] = $this->getBody(substr($item['content']['encoded'],0,$maxsize));
+ $item['content']['encoded'] .= '<p><i>Truncated by Planet PHP, read more at <a href="'.$item['link'].'">the original</a> (another ' . $morebytes .' bytes)</i></p>';
+ } else if (isset($item['description']) && strlen($item['description']) > $maxsize + 500) {
+ print "TRUNCATE description ". $item['title'] ."\n";
+ $morebytes = (strlen($item['description']) - $maxsize);
+
+ $item['description'] = $this->getBody(substr($item['description'],0,$maxsize));
+ $item['description'] .= '<p><i>Truncated by Planet PHP, read more at <a href="'.$item['link'].'">the original</a> (another ' . $morebytes .' bytes)</i></p>';
+ }
+ return $item;
+ }
+
+ function getBody($html) {
+
+ $d = new DomDocument();
+ $html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>'.$html.'</body>';
+ @$d->loadHTML($html);
+ $xp = new domxpath($d);
+ $res = $xp->query("/html/body/node()");
+ $body = "";
+ foreach ($res as $node) {
+ $body .= $d->saveXML($node);
+ }
+ return $body;
+ }
+
+ function generateMD5($item) {
+
+ return md5($item['title'] .$item['link'] . $item['description'] .$item['content']['encoded']);
+ }
+
+ function updateEntry($item, $entryID) {
+ $date = $this->getDcDate($item, 0,true);
+ $query = "update entries set " .
+ " link = '" .mysql_escape_string(utf2entities($item['link'])) . "'," .
+ " title = '" .mysql_escape_string(utf2entities($item['title'])) . "'," .
+ " description= '" .mysql_escape_string(utf2entities($item['description'])) . "'," .
+ " content_encoded= '" . mysql_escape_string(utf2entities($item['content']['encoded'])) . "',";
+ if ($date) {
+ $query .= " dc_date = '".$date."',";
+ }
+
+ $query .= " md5= '" .$item['md5'] . "' ".
+ " where ID = $entryID";
+ print "update " . $item['title'] ."\n";
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+ return false;
+ } else {
+ return true;
+ }
+ }
+ function insertEntry($item,$feedID, $options = array()) {
+ $id = $this->mdb->nextID("planet");
+ if (isset($options['newBlog']) && $options['newBlog']) {
+ $offset = - 3600 * 144; // offset back to 6 days ago.needed for new blogs without pubdate/dcdate
+ } else {
+ $offset = 0;
+ }
+
+ if (!isset($item['guid']) || $item['guid'] == '') {
+ $item['guid'] = $item['link'];
+ }
+
+ $date = $this->getDcDate($item, $offset);
+
+ $query = "insert into entries (ID,feedsID, title,link, guid,description,dc_date, dc_creator, content_encoded, md5) VALUES (". $id . "," .
+ $feedID . ",'" .
+
+ mysql_escape_string(utf2entities($item['title'])) . "','" .
+ mysql_escape_string(trim($item['link'])) . "','" .
+ mysql_escape_string(($item['guid'])) . "','" .
+ mysql_escape_string(utf2entities($item['description'])) . "','".
+ $date . "','" .
+ $item['dc']['creator'] . "','" .
+ mysql_escape_string(utf2entities($item['content']['encoded'])) . "','".
+ $item['md5'] . "')";
+
+ print "insert " . $item['title'] ."\n";
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+ return false;
+ } else {
+ return $id;
+ }
+ }
+
+ function getDcDate($item, $nowOffset = 0, $returnNull = false) {
+ //we want the dates in UTC... Looks like MySQL can't handle timezones...
+ //putenv("TZ=UTC");
+ if (isset($item['dc']['date'])) {
+ $dcdate = $this->fixdate($item['dc']['date']);
+ } elseif (isset($item['pubdate'])) {
+ $dcdate = $this->fixdate($item['pubdate']);
+ } elseif (isset($item['issued'])) {
+ $dcdate = $this->fixdate($item['issued']);
+ } elseif (isset($item['created'])) {
+ $dcdate = $this->fixdate($item['created']);
+ } elseif (isset($item['modified'])) {
+ $dcdate = $this->fixdate($item['modified']);
+ } elseif ($returnNull) {
+ return NULL;
+ } else {
+ //TODO: Find a better alternative here
+ $dcdate = gmdate("Y-m-d H:i:s O",time() + $nowOffset);
+ }
+ return $dcdate;
+
+ }
+
+ function fixdate($date) {
+ $date = preg_replace("/([0-9])T([0-9])/","$1 $2",$date);
+ $date = preg_replace("/([\+\-][0-9]{2}):([0-9]{2})/","$1$2",$date);
+ $time = strtotime($date);
+ //if time is too much in the future (more than 1 hours)
+ // set it to now()
+ if (($time - time()) > 3600) {
+ $time = time();
+ }
+ $date = gmdate("Y-m-d H:i:s O",$time);
+ return $date;
+ }
+
+ function updateFeedBlogID($url, $id) {
+
+ $query = "update feeds set blogsID = $id where link = '$url'";
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+ return false;
+ } else {
+ return $id;
+ }
+ }
+
+ function insertBlogEntry($channel) {
+
+ $id = $this->mdb->nextID("planet");
+ $query = "insert into blogs (ID,title,link,description) VALUES (".
+ $id . ",'" .
+ mysql_escape_string($channel['title']) . "','" .
+ mysql_escape_string($channel['link']) . "','" .
+ mysql_escape_string($channel['description']) . "')";
+
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+ return false;
+ } else {
+ return $id;
+ }
+ }
+
+
+ function updateBlogEntry($channel,$id) {
+
+
+ $query = "update blogs set
+ title = '".mysql_escape_string($channel['title']) . "',
+ link = '".mysql_escape_string($channel['link']) . "',
+ description = '".mysql_escape_string($channel['description']) . "' where ID = ". $id;
+
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+ return false;
+ } else {
+ return $id;
+ }
+ }
+
+ function getBlogEntry($url) {
+ return $this->mdb->queryRow ("select * from blogs where link = '$url'",null,MDB2_FETCHMODE_ASSOC);
+ }
+
+ function getFeedEntry($url) {
+ return $this->mdb->queryRow ("select * from feeds where link = '$url'",null,MDB2_FETCHMODE_ASSOC);
+ }
+ function getEntry($url) {
+ return $this->mdb->queryRow ("select * from entries where guid = '$url'",null,MDB2_FETCHMODE_ASSOC);
+ }
+
+
+ function getRemoteFeed($url) {
+ print "Get $url \n";
+ if ($feed = fetch_rss($url)) {
+ return $feed;
+ } else {
+ print "$url is not a valid feed \n";
+ return false;
+ }
+
+ }
+
+}
+
+function getLoad() {
+ return substr(file_get_contents("/proc/loadavg"),0,4);
+}
21 libs/aggregator.php.rej
@@ -0,0 +1,21 @@
+***************
+*** 261,269 ****
+ $id = $this->mdb->nextID("planet");
+ $query = "insert into blogs (ID,title,link,description) VALUES (".
+ $id . ",'" .
+- mysql_escape_string($channel['title']) . "','" .
+ mysql_escape_string($channel['link']) . "','" .
+- mysql_escape_string($channel['description']) . "')";
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
+--- 261,269 ----
+ $id = $this->mdb->nextID("planet");
+ $query = "insert into blogs (ID,title,link,description) VALUES (".
+ $id . ",'" .
++ mysql_escape_string(utf2entities($channel['title'])) . "','" .
+ mysql_escape_string($channel['link']) . "','" .
++ mysql_escape_string(utf2entities($channel['description'])) . "')";
+ $res = $this->mdb->query($query);
+ if (MDB2::isError($res)) {
+ print "DB ERROR: ". $res->getMessage() . "\n". $res->getUserInfo(). "\n";
1 libs/magpierss/AUTHORS
@@ -0,0 +1 @@
+kellan <kellan@protest.net>
18 libs/magpierss/CHANGES
@@ -0,0 +1,18 @@
+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
185 libs/magpierss/ChangeLog
@@ -0,0 +1,185 @@
+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
+
21 libs/magpierss/INSTALL
@@ -0,0 +1,21 @@
+REQUIREMENTS
+
+ MapieRSS requires a recent PHP 4+ (developed with 4.2.0)
+ with xml (expat) support
+
+QUICK START
+
+ Magpie can work "out of the box". Usually nothing more then placing 4
+ MagpieRSS include files (rss_fetch.inc, rss_parser.inc, rss_cache.inc, and
+ rss_util.inc) in the same directory as your PHP script will be required.
+
+ You might want to:
+
+ * Add the include files to your include path.
+ * Create a cache directory that your webserver can write to
+ (Mapie will try to create one for you, but it often fails)
+ * Read through the constants at the top of rss_fetch.inc
+ see if there is anything you want to override (the defaults should
+ be pretty good)
+
+ For more info, or if you have trouble, see TROUBLESHOOTING
53 libs/magpierss/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.
48 libs/magpierss/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'] . "<p>";
+ echo "<ul>";
+ foreach ($rss->items as $item) {
+ $href = $item['link'];
+ $title = $item['title'];
+ echo "<li><a href=$href>$title</a></li>";
+ }
+ echo "</ul>";
+
+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.
152 libs/magpierss/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.
+
+
125 libs/magpierss/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." .
+ "<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:
+
+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 "<p>";
+ }
+}
+
+DISCUSSION:
+
+This recipe only works for RSS 1.0 feeds that include the <dc:date> field.
+(which is very good RSS style)
+
+parse_w3cdtf is defined in rss_utils.inc, and parses RSS style dates into Unix
+epoch seconds.
+
+See: http://www.php.net/manual/en/ref.datetime.php
1,208 libs/magpierss/extlib/Snoopy.class.inc
@@ -0,0 +1,1208 @@
+<?php
+
+/*************************************************
+
+Snoopy - the PHP net client
+Author: Monte Ohrt <monte@ispi.net>
+Copyright (c): 1999-2000 ispi, all rights reserved
+Version: 1.0
+
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+You may contact the author of Snoopy by e-mail at:
+monte@ispi.net
+
+Or, write to:
+Monte Ohrt
+CTO, ispi
+237 S. 70th suite 220
+Lincoln, NE 68510
+
+The latest version of Snoopy can be obtained from:
+http://snoopy.sourceforge.com
+
+*************************************************/
+
+class Snoopy
+{
+ /**** Public variables ****/
+
+ /* user definable vars */
+
+ var $host = "www.php.net"; // host name we are connecting to
+ var $port = 80; // port we are connecting to
+ var $proxy_host = ""; // proxy host to use
+ var $proxy_port = ""; // proxy port to use
+ var $agent = "Snoopy v1.0"; // agent we masquerade as
+ var $referer = ""; // referer info to pass
+ var $cookies = array(); // array of cookies to pass
+ // $cookies["username"]="joe";
+ var $rawheaders = array(); // array of raw headers to send
+ // $rawheaders["Content-type"]="text/html";
+
+ var $maxredirs = 5; // http redirection depth maximum. 0 = disallow
+ var $lastredirectaddr = ""; // contains address of last redirected address
+ var $offsiteok = true; // allows redirection off-site
+ var $maxframes = 0; // frame content depth maximum. 0 = disallow
+ var $expandlinks = true; // expand links to fully qualified URLs.
+ // this only applies to fetchlinks()
+ // or submitlinks()
+ var $passcookies = true; // pass set cookies back through redirects
+ // NOTE: this currently does not respect
+ // dates, domains or paths.
+
+ var $user = ""; // user for http authentication
+ var $pass = ""; // password for http authentication
+
+ // http accept types
+ var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
+
+ var $results = ""; // where the content is put
+
+ var $error = ""; // error messages sent here
+ var $response_code = ""; // response code returned from server
+ var $headers = array(); // headers returned from server sent here
+ var $maxlength = 500000; // max return data length (body)
+ var $read_timeout = 0; // timeout on read operations, in seconds
+ // supported only since PHP 4 Beta 4
+ // set to 0 to disallow timeouts
+ var $timed_out = false; // if a read operation timed out
+ var $status = 0; // http request status
+
+ var $curl_path = "/usr/local/bin/curl";
+ // Snoopy will use cURL for fetching
+ // SSL content if a full system path to
+ // the cURL binary is supplied here.
+ // set to false if you do not have
+ // cURL installed. See http://curl.haxx.se
+ // for details on installing cURL.
+ // Snoopy does *not* use the cURL
+ // library functions built into php,
+ // as these functions are not stable
+ // as of this Snoopy release.
+
+ // send Accept-encoding: gzip?
+ var $use_gzip = true;
+
+ /**** Private variables ****/
+
+ var $_maxlinelen = 4096; // max line length (headers)
+
+ var $_httpmethod = "GET"; // default http request method
+ var $_httpversion = "HTTP/1.0"; // default http request version
+ var $_submit_method = "POST"; // default submit method
+ var $_submit_type = "application/x-www-form-urlencoded"; // default submit type
+ var $_mime_boundary = ""; // MIME boundary for multipart/form-data submit type
+ var $_redirectaddr = false; // will be set if page fetched is a redirect
+ var $_redirectdepth = 0; // increments on an http redirect
+ var $_frameurls = array(); // frame src urls
+ var $_framedepth = 0; // increments on frame depth
+
+ var $_isproxy = false; // set if using a proxy server
+ var $_fp_timeout = 30; // timeout for socket connection
+
+/*============================================================