summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/classes/class_feedcreator.php1755
-rw-r--r--includes/classes/class_module.php5
-rw-r--r--includes/classes/class_stats.php3
-rw-r--r--includes/functions/functions.php2
-rw-r--r--includes/functions/functions_db.php2
-rw-r--r--includes/functions/functions_print.php8
-rw-r--r--includes/functions/functions_rss.php537
-rw-r--r--includes/set_gedcom_defaults.php2
8 files changed, 7 insertions, 2307 deletions
diff --git a/includes/classes/class_feedcreator.php b/includes/classes/class_feedcreator.php
deleted file mode 100644
index 4aa969abe3..0000000000
--- a/includes/classes/class_feedcreator.php
+++ /dev/null
@@ -1,1755 +0,0 @@
-<?php
-/***************************************************************************
-
-FeedCreator class v1.8.0-dev (development)
-http://feedcreator.org
-maintained by Mohammad Hafiz bin Ismail (info@mypapit.net)
-feedcreator.org
-
-originally (c) Kai Blankenhorn
-www.bitfolge.de
-kaib@bitfolge.de
-
-
-v1.3 work by Scott Reynen (scott@randomchaos.com) and Kai Blankenhorn
-v1.5 OPML support by Dirk Clemens
-v1.7.2-mod on-the-fly feed generation by Fabian Wolf (info@f2w.de)
-v1.7.2-ppt ATOM 1.0 support by Mohammad Hafiz bin Ismail (mypapit@gmail.com)
-
-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
-
-$Id$
-
-****************************************************************************
-
-
-
-
-***************************************************************************/
-
-/*** GENERAL USAGE *********************************************************
-
-Please refer to to /example directory
-
-
-***************************************************************************
-* A little setup *
-**************************************************************************/
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_CLASS_FEEDCREATOR_PHP', '');
-
-// your local timezone, set to "" to disable or for GMT
-define("TIME_ZONE","");
-
-
-
-
-/**
- * Version string.
- **/
-
-define("FEEDCREATOR_VERSION", "FeedCreator 1.8.0-dev");
-
-
-
-/**
- * A FeedItem is a part of a FeedCreator feed.
- *
- * @author Kai Blankenhorn <kaib@bitfolge.de>
- * @since 1.3
- */
-class FeedItem extends HtmlDescribable {
- /**
- * Mandatory attributes of an item.
- */
- var $title, $description, $link;
-
- /**
- * Optional attributes of an item.
- */
- var $author, $authorEmail, $authorURL,$image, $category, $categoryScheme, $comments, $guid, $source, $creator, $contributor;
-
- /**
- * Publishing date of an item. May be in one of the following formats:
- *
- * RFC 822:
- * "Mon, 20 Jan 03 18:05:41 +0400"
- * "20 Jan 03 18:05:41 +0000"
- *
- * ISO 8601:
- * "2003-01-20T18:05:41+04:00"
- *
- * Unix:
- * 1043082341
- */
- var $date;
-
- /**
- * Add <enclosure> element tag RSS 2.0, supported by ATOM 1.0 too
- * modified by : Mohammad Hafiz bin Ismail (mypapit@gmail.com)
- *
- *
- * display :
- * <enclosure length="17691" url="http://something.com/picture.jpg" type="image/jpeg" />
- *
- */
- var $enclosure;
-
- /**
- * Any additional elements to include as an assiciated array. All $key => $value pairs
- * will be included unencoded in the feed item in the form
- * <$key>$value</$key>
- * Again: No encoding will be used! This means you can invalidate or enhance the feed
- * if $value contains markup. This may be abused to embed tags not implemented by
- * the FeedCreator class used.
- */
- var $additionalElements = Array();
-
-
-
-
- // on hold
- // var $source;
-}
-
-class EnclosureItem extends HtmlDescribable {
- /*
- *
- * core variables
- *
- **/
- var $url,$length,$type;
-
- /*
- *
- * supported by ATOM 1.0 only
- *
- */
-
- var $language, $title;
- /*
- * For use with another extension like Yahoo mRSS
- * Warning :
- * These variables might not show up in
- * later release / not finalize yet!
- *
- *
- * var $width, $height, $title, $description, $keywords, $thumburl;
- */
-
- var $additionalElements = Array();
-
-}
-
-
-/**
- * An FeedImage may be added to a FeedCreator feed.
- * @author Kai Blankenhorn <kaib@bitfolge.de>
- * @since 1.3
- */
-class FeedImage extends HtmlDescribable {
- /**
- * Mandatory attributes of an image.
- */
- var $title, $url, $link;
-
- /**
- * Optional attributes of an image.
- */
- var $width, $height, $description;
-}
-
-
-
-/**
- * An HtmlDescribable is an item within a feed that can have a description that may
- * include HTML markup.
- */
-class HtmlDescribable {
- /**
- * Indicates whether the description field should be rendered in HTML.
- */
- var $descriptionHtmlSyndicated;
-
- /**
- * Indicates whether and to how many characters a description should be truncated.
- */
- var $descriptionTruncSize;
-
- /**
- * Returns a formatted description field, depending on descriptionHtmlSyndicated and
- * $descriptionTruncSize properties
- * @return string the formatted description
- */
- function getDescription() {
- $descriptionField = new FeedHtmlField($this->description);
- $descriptionField->syndicateHtml = $this->descriptionHtmlSyndicated;
- $descriptionField->truncSize = $this->descriptionTruncSize;
- return $descriptionField->output();
- }
-
-}
-
-
-
-/**
- * An FeedHtmlField describes and generates
- * a feed, item or image html field (probably a description). Output is
- * generated based on $truncSize, $syndicateHtml properties.
- * @author Pascal Van Hecke <feedcreator.class.php@vanhecke.info>
- * @version 1.6
- */
-class FeedHtmlField {
- /**
- * Mandatory attributes of a FeedHtmlField.
- */
- var $rawFieldContent;
-
- /**
- * Optional attributes of a FeedHtmlField.
- *
- */
- var $truncSize, $syndicateHtml;
-
- /**
- * Creates a new instance of FeedHtmlField.
- * @param $string: if given, sets the rawFieldContent property
- */
- function FeedHtmlField($parFieldContent) {
- if ($parFieldContent) {
- $this->rawFieldContent = $parFieldContent;
- }
- }
-
-
- /**
- * Creates the right output, depending on $truncSize, $syndicateHtml properties.
- * @return string the formatted field
- */
- function output() {
- // when field available and syndicated in html we assume
- // - valid html in $rawFieldContent and we enclose in CDATA tags
- // - no truncation (truncating risks producing invalid html)
- if (!$this->rawFieldContent) {
- $result = "";
- } elseif ($this->syndicateHtml) {
- $result = "<![CDATA[".$this->rawFieldContent."]]>";
- } else {
- if ($this->truncSize and is_int($this->truncSize)) {
- $result = FeedCreator::iTrunc(htmlspecialchars($this->rawFieldContent),$this->truncSize);
- } else {
- $result = htmlspecialchars($this->rawFieldContent);
- }
- }
- return $result;
- }
-
-}
-
-
-
-/**
- * UniversalFeedCreator lets you choose during runtime which
- * format to build.
- * For general usage of a feed class, see the FeedCreator class
- * below or the example above.
- *
- * @since 1.3
- * @author Kai Blankenhorn <kaib@bitfolge.de>
- */
-class UniversalFeedCreator extends FeedCreator {
- var $_feed;
-
- function _setMIME() {
- //switch (strtoupper($format)) {
-
-
- header('Content-type: ' . $this->contentType .'; charset=' . $this->encoding, true);
-
-
- }
-
- function _setFormat($format) {
- switch (strtoupper($format)) {
-
- case "2.0":
- case "RSS": //added 8 Jan 2007
- // fall through
- case "RSS2.0":
- $this->_feed = new RSSCreator20();
- break;
-
- case "1.0":
- // fall through
- case "RSS1.0":
- $this->_feed = new RSSCreator10();
- break;
-
- case "0.91":
-
- // fall through
- case "RSS0.91":
- $this->_feed = new RSSCreator091();
- break;
-
- case "PIE0.1":
- $this->_feed = new PIECreator01();
- break;
-
- case "MBOX":
- $this->_feed = new MBOXCreator();
- break;
-
- case "OPML":
- $this->_feed = new OPMLCreator();
- break;
-
- case "ATOM":
- // fall through: always the latest ATOM version
- case "ATOM1.0":
- $this->_feed = new AtomCreator10();
- break;
-
-
- case "ATOM0.3":
- $this->_feed = new AtomCreator03();
- break;
-
- case "HTML":
- $this->_feed = new HTMLCreator();
- break;
-
- case "JS":
- // fall through
- case "JAVASCRIPT":
- $this->_feed = new JSCreator();
- break;
-
- default:
- $this->_feed = new RSSCreator091();
- break;
- }
-
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- // prevent overwriting of properties "contentType", "encoding"; do not copy "_feed" itself
- if (!in_array($key, array("_feed", "contentType", "encoding"))) {
- $this->_feed->{$key} = $this->{$key};
- }
- }
- }
-
- /**
- * Creates a syndication feed based on the items previously added.
- *
- * @see FeedCreator::addItem()
- * @param string format format the feed should comply to. Valid values are:
- * "PIE0.1", "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3", "HTML", "JS"
- * @return string the contents of the feed.
- */
- function createFeed($format = "RSS0.91") {
- $this->_setFormat($format);
- return $this->_feed->createFeed();
- }
-
-
-
- /**
- * Saves this feed as a file on the local disk. After the file is saved, an HTTP redirect
- * header may be sent to redirect the use to the newly created file.
- * @since 1.4
- *
- * @param string format format the feed should comply to. Valid values are:
- * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM", "ATOM0.3", "HTML", "JS"
- * @param string filename optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()).
- * @param boolean displayContents optional send the content of the file or not. If true, the file will be sent in the body of the response.
- */
- function saveFeed($format="RSS0.91", $filename="", $displayContents=true) {
- $this->_setFormat($format);
- $this->_feed->saveFeed($filename, $displayContents);
- }
-
-
- /**
- * Turns on caching and checks if there is a recent version of this feed in the cache.
- * If there is, an HTTP redirect header is sent.
- * To effectively use caching, you should create the FeedCreator object and call this method
- * before anything else, especially before you do the time consuming task to build the feed
- * (web fetching, for example).
- *
- * @param string format format the feed should comply to. Valid values are:
- * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3".
- * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()).
- * @param timeout int optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour)
- */
- function useCached($format="RSS0.91", $filename="", $timeout=3600) {
- $this->_setFormat($format);
- $this->_feed->useCached($filename, $timeout);
- }
-
-
- /**
- * Outputs feed to the browser - needed for on-the-fly feed generation (like it is done in WordPress, etc.)
- *
- * @param format string format the feed should comply to. Valid values are:
- * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3".
- */
- function outputFeed($format='RSS0.91') {
- $this->_setFormat($format);
- $this->_setMIME($format);
- $this->_feed->outputFeed();
- }
-
-
-}
-
-
-/**
- * FeedCreator is the abstract base implementation for concrete
- * implementations that implement a specific format of syndication.
- *
- * @abstract
- * @author Kai Blankenhorn <kaib@bitfolge.de>
- * @since 1.4
- */
-class FeedCreator extends HtmlDescribable {
-
- /**
- * Mandatory attributes of a feed.
- */
- var $title, $description, $link;
-
-
- /**
- * Optional attributes of a feed.
- */
- var $syndicationURL, $image, $language, $copyright, $pubDate, $lastBuildDate, $editor, $editorEmail, $webmaster, $category, $docs, $ttl, $rating, $skipHours, $skipDays;
-
- /**
- * The url of the external xsl stylesheet used to format the naked syndication feed.
- * Ignored in the output when empty.
- */
- var $xslStyleSheet = "";
-
-
- /**
- * The url of the external css stylesheet used to format the naked syndication feed.
- * Ignored in the output when empty.
- */
- var $cssStyleSheet = "";
-
-
- /**
- * @access private
- */
- var $items = Array();
-
-
- /**
- * This feed's MIME content type.
- * @since 1.4
- * @access private
- */
- var $contentType = "application/xml";
-
-
- /**
- * This feed's character encoding.
- * @since 1.6.1
- *
- * var $encoding = "ISO-8859-1"; //original :p
- */
- var $encoding = "utf-8";
-
- /*
- * Generator string
- *
- */
-
- var $generator = "info@mypapit.net";
-
-
- /**
- * Any additional elements to include as an assiciated array. All $key => $value pairs
- * will be included unencoded in the feed in the form
- * <$key>$value</$key>
- * Again: No encoding will be used! This means you can invalidate or enhance the feed
- * if $value contains markup. This may be abused to embed tags not implemented by
- * the FeedCreator class used.
- */
- var $additionalElements = Array();
-
-
- /**
- * Adds an FeedItem to the feed.
- *
- * @param object FeedItem $item The FeedItem to add to the feed.
- * @access public
- */
- function addItem($item) {
- $this->items[] = $item;
- }
-
- /**
- *
- *
- *
- **/
- function version() {
-
- return FEEDCREATOR_VERSION." (".$this->generator.")";
- }
-
- /**
- * Truncates a string to a certain length at the most sensible point.
- * First, if there's a '.' character near the end of the string, the string is truncated after this character.
- * If there is no '.', the string is truncated after the last ' ' character.
- * If the string is truncated, " ..." is appended.
- * If the string is already shorter than $length, it is returned unchanged.
- *
- * @static
- * @param string string A string to be truncated.
- * @param int length the maximum length the string should be truncated to
- * @return string the truncated string
- */
- function iTrunc($string, $length) {
- if (strlen($string)<=$length) {
- return $string;
- }
-
- $pos = strrpos($string,".");
- if ($pos>=$length-4) {
- $string = substr($string,0,$length-4);
- $pos = strrpos($string,".");
- }
- if ($pos>=$length*0.4) {
- return substr($string,0,$pos+1)." ...";
- }
-
- $pos = strrpos($string," ");
- if ($pos>=$length-4) {
- $string = substr($string,0,$length-4);
- $pos = strrpos($string," ");
- }
- if ($pos>=$length*0.4) {
- return substr($string,0,$pos)." ...";
- }
-
- return substr($string,0,$length-4)." ...";
-
- }
-
-
- /**
- * Creates a comment indicating the generator of this feed.
- * The format of this comment seems to be recognized by
- * Syndic8.com.
- */
- function _createGeneratorComment() {
- return "<!-- generator=\"".$this->version()."\" -->\n";
- }
-
-
- /**
- * Creates a string containing all additional elements specified in
- * $additionalElements.
- * @param elements array an associative array containing key => value pairs
- * @param indentString string a string that will be inserted before every generated line
- * @return string the XML tags corresponding to $additionalElements
- */
- function _createAdditionalElements($elements, $indentString="") {
- $ae = "";
- if (is_array($elements)) {
- foreach($elements AS $key => $value) {
- $ae.= $indentString."<$key>$value</$key>\n";
- }
- }
- return $ae;
- }
-
-
-
- function _createStylesheetReferences() {
- $xml = "";
- if ($this->cssStyleSheet) $xml .= "<?xml-stylesheet href=\"".$this->cssStyleSheet."\" type=\"text/css\"?>\n";
- if ($this->xslStyleSheet) $xml .= "<?xml-stylesheet href=\"".$this->xslStyleSheet."\" type=\"text/xsl\"?>\n";
- return $xml;
- }
-
-
- /**
- * Builds the feed's text.
- * @abstract
- * @return string the feed's complete text
- */
- function createFeed() {
- }
-
- /**
- * Generate a filename for the feed cache file. The result will be $_SERVER["PHP_SELF"] with the extension changed to .xml.
- * For example:
- *
- * echo $_SERVER["PHP_SELF"]."\n";
- * echo FeedCreator::_generateFilename();
- *
- * would produce:
- *
- * /rss/latestnews.php
- * latestnews.xml
- *
- * @return string the feed cache filename
- * @since 1.4
- * @access private
- */
- function _generateFilename() {
- $fileInfo = pathinfo($_SERVER["PHP_SELF"]);
- return substr($fileInfo["basename"],0,-(strlen($fileInfo["extension"])+1)).".xml";
- }
-
-
- /**
- * @since 1.4
- * @access private
- */
- function _redirect($filename) {
- // attention, heavily-commented-out-area
-
- // maybe use this in addition to file time checking
- //Header("Expires: ".date("r",time()+$this->_timeout));
-
- /* no caching at all, doesn't seem to work as good:
- Header("Cache-Control: no-cache");
- Header("Pragma: no-cache");
- */
-
- // HTTP redirect, some feed readers' simple HTTP implementations don't follow it
- //Header("Location: ".$filename);
-
- Header("Content-Type: ".$this->contentType."; charset=".$this->encoding."; filename=".basename($filename));
- Header("Content-Disposition: inline; filename=".basename($filename));
- readfile($filename, "r");
- die();
- }
-
- /**
- * Turns on caching and checks if there is a recent version of this feed in the cache.
- * If there is, an HTTP redirect header is sent.
- * To effectively use caching, you should create the FeedCreator object and call this method
- * before anything else, especially before you do the time consuming task to build the feed
- * (web fetching, for example).
- * @since 1.4
- * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()).
- * @param timeout int optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour)
- */
- function useCached($filename="", $timeout=3600) {
- $this->_timeout = $timeout;
- if ($filename=="") {
- $filename = $this->_generateFilename();
- }
- if (file_exists($filename) AND (time()-filemtime($filename) < $timeout)) {
- $this->_redirect($filename);
- }
- }
-
-
- /**
- * Saves this feed as a file on the local disk. After the file is saved, a redirect
- * header may be sent to redirect the user to the newly created file.
- * @since 1.4
- *
- * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()).
- * @param redirect boolean optional send an HTTP redirect header or not. If true, the user will be automatically redirected to the created file.
- */
- function saveFeed($filename="", $displayContents=true) {
- if ($filename=="") {
- $filename = $this->_generateFilename();
- }
- $feedFile = fopen($filename, "w+");
- if ($feedFile) {
- fputs($feedFile,$this->createFeed());
- fclose($feedFile);
- if ($displayContents) {
- $this->_redirect($filename);
- }
- } else {
- echo "<br /><b>Error creating feed file, please check write permissions.</b><br />";
- }
- }
-
- /**
- * Outputs this feed directly to the browser - for on-the-fly feed generation
- * @since 1.7.2-mod
- *
- * still missing: proper header output - currently you have to add it manually
- */
- function outputFeed() {
- echo $this->createFeed();
- }
-
- function setEncoding($encoding="utf-8") {
- $this->encoding = "utf-8";
-
- }
-
- /**
- * Creates a string containing all additional namespace specified
- */
-
- function addNamespace($ns,$uri)
- {
- $array = array_combine(array($ns),array($uri));
- $this->namespace = array_merge($array,$this->namespace);
- }
-
- function _createNamespace() {
- $ns = "";
-
- if (is_array($this->namespace)) {
- foreach($this->namespace AS $key => $value) {
- $ns.= " xmlns:$key=\"$value\"";
- }
- }
- return $ns;
- }
-
-
-
- /**
- *
- * Additional namespace for custom modules and tags
- *
- * $key=>$value pair will match namespace xmlns:$key="$value" in tags
- * EXPERIMENTAL!
- *
- */
- var $namespace = Array();
-
-
-}
-
-
-/**
- * FeedDate is an internal class that stores a date for a feed or feed item.
- * Usually, you won't need to use this.
- */
-class FeedDate {
- var $unix;
-
- /**
- * Creates a new instance of FeedDate representing a given date.
- * Accepts RFC 822, ISO 8601 date formats as well as unix time stamps.
- * @param mixed $dateString optional the date this FeedDate will represent. If not specified, the current date and time is used.
- */
- function FeedDate($dateString="") {
- if ($dateString=="") $dateString = date("r");
-
- if (is_numeric($dateString)) {
- $this->unix = $dateString;
- return;
- }
- if (preg_match("~(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s+)?(\\d{1,2})\\s+([a-zA-Z]{3})\\s+(\\d{4})\\s+(\\d{2}):(\\d{2}):(\\d{2})\\s+(.*)~",$dateString,$matches)) {
- $months = Array("Jan"=>1,"Feb"=>2,"Mar"=>3,"Apr"=>4,"May"=>5,"Jun"=>6,"Jul"=>7,"Aug"=>8,"Sep"=>9,"Oct"=>10,"Nov"=>11,"Dec"=>12);
- $this->unix = mktime($matches[4],$matches[5],$matches[6],$months[$matches[2]],$matches[1],$matches[3]);
- if (substr($matches[7],0,1)=='+' OR substr($matches[7],0,1)=='-') {
- $tzOffset = (substr($matches[7],0,3) * 60 + substr($matches[7],-2)) * 60;
- } else {
- if (strlen($matches[7])==1) {
- $oneHour = 3600;
- $ord = ord($matches[7]);
- if ($ord < ord("M")) {
- $tzOffset = (ord("A") - $ord - 1) * $oneHour;
- } elseif ($ord >= ord("M") AND $matches[7]!="Z") {
- $tzOffset = ($ord - ord("M")) * $oneHour;
- } elseif ($matches[7]=="Z") {
- $tzOffset = 0;
- }
- }
- switch ($matches[7]) {
- case "UT":
- case "GMT": $tzOffset = 0;
- }
- }
- $this->unix += $tzOffset;
- return;
- }
- if (preg_match("~(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(.*)~",$dateString,$matches)) {
- $this->unix = mktime($matches[4],$matches[5],$matches[6],$matches[2],$matches[3],$matches[1]);
- if (substr($matches[7],0,1)=='+' OR substr($matches[7],0,1)=='-') {
- $tzOffset = (substr($matches[7],0,3) * 60 + substr($matches[7],-2)) * 60;
- } else {
- if ($matches[7]=="Z") {
- $tzOffset = 0;
- }
- }
- $this->unix += $tzOffset;
- return;
- }
- $this->unix = 0;
- }
-
- /**
- * Gets the date stored in this FeedDate as an RFC 822 date.
- *
- * @return a date in RFC 822 format
- */
- function rfc822() {
- //return gmdate("r",$this->unix);
- $date = gmdate("D, d M Y H:i:s", $this->unix);
-
- if (TIME_ZONE!="") {
- $date .= " ".str_replace(":","",TIME_ZONE);
- } else {
- $date .= " ".str_replace(":","","GMT");
- }
- return $date;
- }
-
- /**
- * Gets the date stored in this FeedDate as an ISO 8601 date.
- *
- * @return a date in ISO 8601 (RFC 3339) format
- */
- function iso8601() {
- $date = gmdate("Y-m-d\TH:i:sO",$this->unix);
- $date = substr($date,0,22) . ':' . substr($date,-2);
- if (TIME_ZONE!="") $date = str_replace("+00:00",TIME_ZONE,$date);
- return $date;
- }
-
-
- /**
- * Gets the date stored in this FeedDate as unix time stamp.
- *
- * @return a date as a unix time stamp
- */
- function unix() {
- return $this->unix;
- }
-}
-
-
-/**
- * RSSCreator10 is a FeedCreator that implements RDF Site Summary (RSS) 1.0.
- *
- * @see http://www.purl.org/rss/1.0/
- * @since 1.3
- * @author Kai Blankenhorn <kaib@bitfolge.de>
- */
-class RSSCreator10 extends FeedCreator {
-
- /**
- * Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0.
- * The feed will contain all items previously added in the same order.
- * @return string the feed's complete text
- */
- function createFeed() {
- $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
- $feed.= $this->_createGeneratorComment();
- if ($this->cssStyleSheet=="") {
- $cssStyleSheet = "http://www.w3.org/2000/08/w3c-synd/style.css";
- }
- $feed.= $this->_createStylesheetReferences();
- $feed.= "<rdf:RDF\n";
- $feed.= " xmlns=\"http://purl.org/rss/1.0/\"\n";
- $feed.= " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
- $feed.= " xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\n";
- $feed.= " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
- $feed.= " <channel rdf:about=\"".$this->syndicationURL."\">\n";
- $feed.= " <title>".htmlspecialchars($this->title)."</title>\n";
- $feed.= " <description>".htmlspecialchars($this->description)."</description>\n";
- $feed.= " <link>".$this->link."</link>\n";
- if ($this->image!=null) {
- $feed.= " <image rdf:resource=\"".$this->image->url."\" />\n";
- }
- $now = new FeedDate();
- $feed.= " <dc:date>".htmlspecialchars($now->iso8601())."</dc:date>\n";
- $feed.= " <items>\n";
- $feed.= " <rdf:Seq>\n";
- for ($i=0;$i<count($this->items);$i++) {
- $feed.= " <rdf:li rdf:resource=\"".htmlspecialchars($this->items[$i]->link)."\"/>\n";
- }
- $feed.= " </rdf:Seq>\n";
- $feed.= " </items>\n";
- $feed.= " </channel>\n";
- if ($this->image!=null) {
- $feed.= " <image rdf:about=\"".$this->image->url."\">\n";
- $feed.= " <title>".$this->image->title."</title>\n";
- $feed.= " <link>".$this->image->link."</link>\n";
- $feed.= " <url>".$this->image->url."</url>\n";
- $feed.= " </image>\n";
- }
- $feed.= $this->_createAdditionalElements($this->additionalElements, " ");
-
- for ($i=0;$i<count($this->items);$i++) {
- $feed.= " <item rdf:about=\"".htmlspecialchars($this->items[$i]->link)."\">\n";
- //$feed.= " <dc:type>Posting</dc:type>\n";
- $feed.= " <dc:format>text/html</dc:format>\n";
- if ($this->items[$i]->date!=null) {
- $itemDate = new FeedDate($this->items[$i]->date);
- $feed.= " <dc:date>".htmlspecialchars($itemDate->iso8601())."</dc:date>\n";
- }
- if ($this->items[$i]->source!="") {
- $feed.= " <dc:source>".htmlspecialchars($this->items[$i]->source)."</dc:source>\n";
- }
- if ($this->items[$i]->author!="") {
- $feed.= " <dc:creator>".htmlspecialchars($this->items[$i]->author)."</dc:creator>\n";
- }
- $feed.= " <title>".htmlspecialchars(strip_tags(strtr($this->items[$i]->title,"\n\r"," ")))."</title>\n";
- $feed.= " <link>".htmlspecialchars($this->items[$i]->link)."</link>\n";
- $feed.= " <description>".htmlspecialchars($this->items[$i]->description)."</description>\n";
- $feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
- $feed.= " </item>\n";
- }
- $feed.= "</rdf:RDF>\n";
- return $feed;
- }
-}
-
-
-
-/**
- * RSSCreator091 is a FeedCreator that implements RSS 0.91 Spec, revision 3.
- *
- * @see http://my.netscape.com/publish/formats/rss-spec-0.91.html
- * @since 1.3
- * @author Kai Blankenhorn <kaib@bitfolge.de>
- */
-class RSSCreator091 extends FeedCreator {
-
- /**
- * Stores this RSS feed's version number.
- * @access private
- */
- var $RSSVersion;
-
- function addNamespace($ns,$uri) {
- parent::addNamespace($ns,$uri);
- }
-
- function RSSCreator091() {
- $this->_setRSSVersion("0.91");
- $this->contentType = "application/rss+xml";
-
- }
-
- /**
- * Sets this RSS feed's version number.
- * @access private
- */
- function _setRSSVersion($version) {
- $this->RSSVersion = $version;
- }
-
-
-
- /**
- * Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0.
- * The feed will contain all items previously added in the same order.
- * @return string the feed's complete text
- */
- function createFeed() {
- $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
- $feed.= $this->_createGeneratorComment();
- $feed.= $this->_createStylesheetReferences();
-
- if ($this->RSSVersion == "2.0" || $this->RSSVersion == "1.0" ) {
- $feed.= "<rss version=\"".$this->RSSVersion."\" ". $this->_createNamespace(). ">\n";
- } else {
- $feed.= "<rss version=\"".$this->RSSVersion."\">\n";
- }
-
-
- $feed.= " <channel>\n";
- $feed.= " <title>".FeedCreator::iTrunc(htmlspecialchars($this->title),100)."</title>\n";
- $this->descriptionTruncSize = 500;
- $feed.= " <description>".$this->getDescription()."</description>\n";
- $feed.= " <link>".$this->link."</link>\n";
- $now = new FeedDate();
- $feed.= " <lastBuildDate>".htmlspecialchars($now->rfc822())."</lastBuildDate>\n";
- $feed.= " <generator>". $this->version()."</generator>\n";
-
- if ($this->image!=null) {
- $feed.= " <image>\n";
- $feed.= " <url>".$this->image->url."</url>\n";
- $feed.= " <title>".FeedCreator::iTrunc(htmlspecialchars($this->image->title),100)."</title>\n";
- $feed.= " <link>".$this->image->link."</link>\n";
- if ($this->image->width!="") {
- $feed.= " <width>".$this->image->width."</width>\n";
- }
- if ($this->image->height!="") {
- $feed.= " <height>".$this->image->height."</height>\n";
- }
- if ($this->image->description!="") {
- $feed.= " <description>".$this->image->getDescription()."</description>\n";
- }
- $feed.= " </image>\n";
- }
- if ($this->language!="") {
- $feed.= " <language>".$this->language."</language>\n";
- }
- if ($this->copyright!="") {
- $feed.= " <copyright>".FeedCreator::iTrunc(htmlspecialchars($this->copyright),100)."</copyright>\n";
- }
- if ($this->editor!="") {
- $feed.= " <managingEditor>".FeedCreator::iTrunc(htmlspecialchars($this->editor),100)."</managingEditor>\n";
- }
- if ($this->webmaster!="") {
- $feed.= " <webMaster>".FeedCreator::iTrunc(htmlspecialchars($this->webmaster),100)."</webMaster>\n";
- }
- if ($this->pubDate!="") {
- $pubDate = new FeedDate($this->pubDate);
- $feed.= " <pubDate>".htmlspecialchars($pubDate->rfc822())."</pubDate>\n";
- }
- if ($this->category!="") {
- $feed.= " <category>".htmlspecialchars($this->category)."</category>\n";
- }
- if ($this->docs!="") {
- $feed.= " <docs>".FeedCreator::iTrunc(htmlspecialchars($this->docs),500)."</docs>\n";
- }
- if ($this->ttl!="") {
- $feed.= " <ttl>".htmlspecialchars($this->ttl)."</ttl>\n";
- }
- if ($this->rating!="") {
- $feed.= " <rating>".FeedCreator::iTrunc(htmlspecialchars($this->rating),500)."</rating>\n";
- }
- if ($this->skipHours!="") {
- $feed.= " <skipHours>".htmlspecialchars($this->skipHours)."</skipHours>\n";
- }
- if ($this->skipDays!="") {
- $feed.= " <skipDays>".htmlspecialchars($this->skipDays)."</skipDays>\n";
- }
-
- if ($this->RSSVersion == "2.0" || $this->RSSVersion == "1.0" ) {
- $feed.= $this->_createAdditionalElements($this->additionalElements, " ");
- }
-
- for ($i=0;$i<count($this->items);$i++) {
- $feed.= " <item>\n";
- $feed.= " <title>".FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)),100)."</title>\n";
- $feed.= " <link>".htmlspecialchars($this->items[$i]->link)."</link>\n";
- $feed.= " <description>".$this->items[$i]->getDescription()."</description>\n";
-
- if ($this->items[$i]->author!="") {
- if ($this->items[$i]->authorEmail!="") {
- $feed.= " <author> " . htmlspecialchars($this->items[$i]->authorEmail) . " (".htmlspecialchars($this->items[$i]->author).")</author>\n";
- } else {
- $feed.= " <author> no_email@example.com (".htmlspecialchars($this->items[$i]->author).")</author>\n";
- }
- }
- /*
- // on hold
- if ($this->items[$i]->source!="") {
- $feed.= " <source>".htmlspecialchars($this->items[$i]->source)."</source>\n";
- }
- */
- if ($this->items[$i]->category!="") {
- $feed.= " <category ";
-
- if (!empty($this->items[$i]->categoryScheme)) {
-
- $feed.=" domain=\"". htmlspecialchars($this->items[$i]->categoryScheme)."\"";
- }
- $feed.=">".htmlspecialchars($this->items[$i]->category)."</category>\n";
- }
- if ($this->items[$i]->comments!="") {
- $feed.= " <comments>".htmlspecialchars($this->items[$i]->comments)."</comments>\n";
- }
- if ($this->items[$i]->date!="") {
- $itemDate = new FeedDate($this->items[$i]->date);
- $feed.= " <pubDate>".htmlspecialchars($itemDate->rfc822())."</pubDate>\n";
- }
-
-
- if ($this->items[$i]->guid!="") {
- $feed.= " <guid isPermaLink=\"false\">".htmlspecialchars($this->items[$i]->guid)."</guid>\n";
- } else {
- $feed.= " <guid isPermaLink=\"false\">".htmlspecialchars($this->items[$i]->link)."</guid>\n";
-
- }
-
- if ($this->RSSVersion == "2.0" || $this->RSSVersion == "1.0" ) {
- $feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
- }
-
- if ($this->RSSVersion == "2.0" && $this->items[$i]->enclosure != NULL)
- {
- $feed.= " <enclosure url=\"";
- $feed.= $this->items[$i]->enclosure->url;
- $feed.= "\" length=\"";
- $feed.= $this->items[$i]->enclosure->length;
- $feed.= "\" type=\"";
- $feed.= $this->items[$i]->enclosure->type;
- $feed.= "\"/>\n";
- }
-
-
-
- $feed.= " </item>\n";
- }
-
- $feed.= " </channel>\n";
- $feed.= "</rss>\n";
- return $feed;
- }
-}
-
-
-
-/**
- * RSSCreator20 is a FeedCreator that implements RDF Site Summary (RSS) 2.0.
- *
- * @see http://backend.userland.com/rss
- * @since 1.3
- * @author Kai Blankenhorn <kaib@bitfolge.de>
- */
-class RSSCreator20 extends RSSCreator091 {
-
- function RSSCreator20() {
- parent::_setRSSVersion("2.0");
- }
-
-}
-
-
-/**
- * PIECreator01 is a FeedCreator that implements the emerging PIE specification,
- * as in http://intertwingly.net/wiki/pie/Syntax.
- *
- * @deprecated
- * @since 1.3
- * @author Scott Reynen <scott@randomchaos.com> and Kai Blankenhorn <kaib@bitfolge.de>
- */
-class PIECreator01 extends FeedCreator {
-
- function PIECreator01() {
- $this->encoding = "utf-8";
- }
-
- function createFeed() {
- $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
- $feed.= $this->_createStylesheetReferences();
- $feed.= "<feed version=\"0.1\" xmlns=\"http://example.com/newformat#\">\n";
- $feed.= " <title>".FeedCreator::iTrunc(htmlspecialchars($this->title),100)."</title>\n";
- $this->truncSize = 500;
- $feed.= " <subtitle>".$this->getDescription()."</subtitle>\n";
- $feed.= " <link>".$this->link."</link>\n";
- for ($i=0;$i<count($this->items);$i++) {
- $feed.= " <entry>\n";
- $feed.= " <title>".FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)),100)."</title>\n";
- $feed.= " <link>".htmlspecialchars($this->items[$i]->link)."</link>\n";
- $itemDate = new FeedDate($this->items[$i]->date);
- $feed.= " <created>".htmlspecialchars($itemDate->iso8601())."</created>\n";
- $feed.= " <issued>".htmlspecialchars($itemDate->iso8601())."</issued>\n";
- $feed.= " <modified>".htmlspecialchars($itemDate->iso8601())."</modified>\n";
- $feed.= " <id>".htmlspecialchars($this->items[$i]->guid)."</id>\n";
- if ($this->items[$i]->author!="") {
- $feed.= " <author>\n";
- $feed.= " <name>".htmlspecialchars($this->items[$i]->author)."</name>\n";
- if ($this->items[$i]->authorEmail!="") {
- $feed.= " <email>".$this->items[$i]->authorEmail."</email>\n";
- }
- $feed.=" </author>\n";
- }
- $feed.= " <content type=\"text/html\" xml:lang=\"en-us\">\n";
- $feed.= " <div xmlns=\"http://www.w3.org/1999/xhtml\">".$this->items[$i]->getDescription()."</div>\n";
- $feed.= " </content>\n";
- $feed.= " </entry>\n";
- }
- $feed.= "</feed>\n";
- return $feed;
- }
-}
-
-/**
- * AtomCreator10 is a FeedCreator that implements the atom specification,
- * as in http://www.atomenabled.org/developers/syndication/atom-format-spec.php
- * Please note that just by using AtomCreator10 you won't automatically
- * produce valid atom files. For example, you have to specify either an editor
- * for the feed or an author for every single feed item.
- *
- * Some elements have not been implemented yet. These are (incomplete list):
- * author URL, item author's email and URL, item contents, alternate links,
- * other link content types than text/html. Some of them may be created with
- * AtomCreator10::additionalElements.
- *
- * @see FeedCreator#additionalElements
- * @since 1.7.2-mod (modified)
- * @author Mohammad Hafiz Ismail (mypapit@gmail.com)
- */
- class AtomCreator10 extends FeedCreator {
-
- function AtomCreator10() {
- $this->contentType = "application/atom+xml";
- $this->encoding = "utf-8";
-
- }
-
- function createFeed() {
- $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
- $feed.= $this->_createGeneratorComment();
- $feed.= $this->_createStylesheetReferences();
- $feed.= "<feed xmlns=\"http://www.w3.org/2005/Atom\"";
- if ($this->language!="") {
- $feed.= " xml:lang=\"".$this->language."\"";
- }
- $feed.= ">\n";
- $feed.= " <title>".htmlspecialchars($this->title)."</title>\n";
- $feed.= " <subtitle>".htmlspecialchars($this->description)."</subtitle>\n";
- $feed.= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->link)."\"/>\n";
- $feed.= " <id>".htmlspecialchars($this->link)."</id>\n";
- $now = new FeedDate();
- $feed.= " <updated>".htmlspecialchars($now->iso8601())."</updated>\n";
- if ($this->editor!="") {
- $feed.= " <author>\n";
- $feed.= " <name>".$this->editor."</name>\n";
- if ($this->editorEmail!="") {
- $feed.= " <email>".$this->editorEmail."</email>\n";
- }
- $feed.= " </author>\n";
- }
- if ($this->category!="") {
-
-
- $feed.= " <category term=\"" . htmlspecialchars($this->category) . "\" />\n";
- }
- if ($this->copyright!="") {
- $feed.= " <rights>".FeedCreator::iTrunc(htmlspecialchars($this->copyright),100)."</rights>\n";
- }
- $feed.= " <generator>".$this->version()."</generator>\n";
-
-
- $feed.= " <link rel=\"self\" type=\"application/atom+xml\" href=\"". htmlspecialchars($this->syndicationURL). "\" />\n";
- $feed.= $this->_createAdditionalElements($this->additionalElements, " ");
- for ($i=0;$i<count($this->items);$i++) {
- $feed.= " <entry>\n";
- $feed.= " <title>".htmlspecialchars(strip_tags($this->items[$i]->title))."</title>\n";
- $feed.= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->items[$i]->link)."\"/>\n";
- if ($this->items[$i]->date=="") {
- $this->items[$i]->date = time();
- }
- $itemDate = new FeedDate($this->items[$i]->date);
- $feed.= " <published>".htmlspecialchars($itemDate->iso8601())."</published>\n";
- $feed.= " <updated>".htmlspecialchars($itemDate->iso8601())."</updated>\n";
-
-
- $tempguid = $this->items[$i]->link;
- if ($this->items[$i]->guid!="") {
- $tempguid = $this->items[$i]->guid;
- }
-
- $feed.= " <id>". htmlspecialchars($tempguid)."</id>\n";
- $feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
- if ($this->items[$i]->author!="") {
- $feed.= " <author>\n";
- $feed.= " <name>".htmlspecialchars($this->items[$i]->author)."</name>\n";
- if ($this->items[$i]->authorEmail!="") {
- $feed.= " <email>".htmlspecialchars($this->items[$i]->authorEmail)."</email>\n";
- }
-
- if ($this->items[$i]->authorURL!="") {
- $feed.= " <uri>".htmlspecialchars($this->items[$i]->authorURL)."</uri>\n";
- }
-
- $feed.= " </author>\n";
- }
-
- if ($this->items[$i]->category!="") {
- $feed.= " <category ";
-
- if ($this->items[$i]->categoryScheme!="") {
- $feed.=" scheme=\"".htmlspecialchars($this->items[$i]->categoryScheme)."\" ";
- }
-
- $feed.="term=\"" . htmlspecialchars($this->items[$i]->category) . "\" />\n";
- }
-
- if ($this->items[$i]->description!="") {
-
-
- /*
- * ATOM should have at least summary tag, however this implementation may be inaccurate
- */
- $tempdesc = $this->items[$i]->getDescription();
- $temptype="";
-
-
- if ($this->items[$i]->descriptionHtmlSyndicated){
- $temptype=" type=\"html\"";
- $tempdesc = $this->items[$i]->getDescription();
-
- }
-
- if (empty($this->items[$i]->descriptionTruncSize)) {
- $feed.= " <content". $temptype . ">". $tempdesc ."</content>\n";
- }
-
-
- $feed.= " <summary". $temptype . ">". $tempdesc ."</summary>\n";
- } else {
-
- $feed.= " <summary>no summary</summary>\n";
-
- }
-
- if ($this->items[$i]->enclosure != NULL) {
- $feed.=" <link rel=\"enclosure\" href=\"". $this->items[$i]->enclosure->url ."\" type=\"". $this->items[$i]->enclosure->type."\" length=\"". $this->items[$i]->enclosure->length ."\"";
-
- if ($this->items[$i]->enclosure->language != ""){
- $feed .=" xml:lang=\"". $this->items[$i]->enclosure->language . "\" ";
- }
-
- if ($this->items[$i]->enclosure->title != ""){
- $feed .=" title=\"". $this->items[$i]->enclosure->title . "\" ";
- }
-
- $feed .=" /> \n";
-
-
-
- }
- $feed.= " </entry>\n";
- }
- $feed.= "</feed>\n";
- return $feed;
- }
-
-
-}
-
-
-/**
- * AtomCreator03 is a FeedCreator that implements the atom specification,
- * as in http://www.intertwingly.net/wiki/pie/FrontPage.
- * Please note that just by using AtomCreator03 you won't automatically
- * produce valid atom files. For example, you have to specify either an editor
- * for the feed or an author for every single feed item.
- *
- * Some elements have not been implemented yet. These are (incomplete list):
- * author URL, item author's email and URL, item contents, alternate links,
- * other link content types than text/html. Some of them may be created with
- * AtomCreator03::additionalElements.
- *
- * @see FeedCreator#additionalElements
- * @since 1.6
- * @author Kai Blankenhorn <kaib@bitfolge.de>, Scott Reynen <scott@randomchaos.com>
- */
-class AtomCreator03 extends FeedCreator {
-
- function AtomCreator03() {
- $this->contentType = "application/atom+xml";
- $this->encoding = "utf-8";
- }
-
- function createFeed() {
- $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
- $feed.= $this->_createGeneratorComment();
- $feed.= $this->_createStylesheetReferences();
- $feed.= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\"";
- if ($this->language!="") {
- $feed.= " xml:lang=\"".$this->language."\"";
- }
- $feed.= ">\n";
- $feed.= " <title>".htmlspecialchars($this->title)."</title>\n";
- $feed.= " <tagline>".htmlspecialchars($this->description)."</tagline>\n";
- $feed.= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->link)."\"/>\n";
- $feed.= " <id>".htmlspecialchars($this->link)."</id>\n";
- $now = new FeedDate();
- $feed.= " <modified>".htmlspecialchars($now->iso8601())."</modified>\n";
- if ($this->editor!="") {
- $feed.= " <author>\n";
- $feed.= " <name>".$this->editor."</name>\n";
- if ($this->editorEmail!="") {
- $feed.= " <email>".$this->editorEmail."</email>\n";
- }
- $feed.= " </author>\n";
- }
- $feed.= " <generator>".$this->version()."</generator>\n";
- $feed.= $this->_createAdditionalElements($this->additionalElements, " ");
- for ($i=0;$i<count($this->items);$i++) {
- $feed.= " <entry>\n";
- $feed.= " <title>".htmlspecialchars(strip_tags($this->items[$i]->title))."</title>\n";
- $feed.= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->items[$i]->link)."\"/>\n";
- if ($this->items[$i]->date=="") {
- $this->items[$i]->date = time();
- }
- $itemDate = new FeedDate($this->items[$i]->date);
- $feed.= " <created>".htmlspecialchars($itemDate->iso8601())."</created>\n";
- $feed.= " <issued>".htmlspecialchars($itemDate->iso8601())."</issued>\n";
- $feed.= " <modified>".htmlspecialchars($itemDate->iso8601())."</modified>\n";
- $feed.= " <id>".htmlspecialchars($this->items[$i]->link)."</id>\n";
- $feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
- if ($this->items[$i]->author!="") {
- $feed.= " <author>\n";
- $feed.= " <name>".htmlspecialchars($this->items[$i]->author)."</name>\n";
- $feed.= " </author>\n";
- }
- if ($this->items[$i]->description!="") {
- $feed.= " <summary>".htmlspecialchars( strip_tags($this->items[$i]->description) )."</summary>\n";
-
- }
- $feed.= " </entry>\n";
- }
- $feed.= "</feed>\n";
- return $feed;
- }
-}
-
-
-/**
- * MBOXCreator is a FeedCreator that implements the mbox format
- * as described in http://www.qmail.org/man/man5/mbox.html
- *
- * @since 1.3
- * @author Kai Blankenhorn <kaib@bitfolge.de>
- */
-class MBOXCreator extends FeedCreator {
-
- function MBOXCreator() {
- $this->contentType = "text/plain";
- $this->encoding = "ISO-8859-15";
- }
-
- function qp_enc($input = "", $line_max = 76) {
- $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
- $lines = preg_split("/(?:\r\n|\r|\n)/", $input);
- $eol = "\r\n";
- $escape = "=";
- $output = "";
- while( list(, $line) = each($lines) ) {
- //$line = rtrim($line); // remove trailing white space -> no =20\r\n necessary
- $linlen = strlen($line);
- $newline = "";
- for($i = 0; $i < $linlen; $i++) {
- $c = substr($line, $i, 1);
- $dec = ord($c);
- if ( ($dec == 32) && ($i == ($linlen - 1)) ) { // convert space at eol only
- $c = "=20";
- } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
- $h2 = floor($dec/16); $h1 = floor($dec%16);
- $c = $escape.$hex["$h2"].$hex["$h1"];
- }
- if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
- $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
- $newline = "";
- }
- $newline .= $c;
- } // end of for
- $output .= $newline.$eol;
- }
- return trim($output);
- }
-
-
- /**
- * Builds the MBOX contents.
- * @return string the feed's complete text
- */
- function createFeed() {
- for ($i=0;$i<count($this->items);$i++) {
- if ($this->items[$i]->author!="") {
- $from = $this->items[$i]->author;
- } else {
- $from = $this->title;
- }
- $itemDate = new FeedDate($this->items[$i]->date);
- $feed.= "From ".strtr(MBOXCreator::qp_enc($from)," ","_")." ".date("D M d H:i:s Y",$itemDate->unix())."\n";
- $feed.= "Content-Type: text/plain;\n";
- $feed.= " charset=\"".$this->encoding."\"\n";
- $feed.= "Content-Transfer-Encoding: quoted-printable\n";
- $feed.= "Content-Type: text/plain\n";
- $feed.= "From: \"".MBOXCreator::qp_enc($from)."\"\n";
- $feed.= "Date: ".$itemDate->rfc822()."\n";
- $feed.= "Subject: ".MBOXCreator::qp_enc(FeedCreator::iTrunc($this->items[$i]->title,100))."\n";
- $feed.= "\n";
- $body = chunk_split(MBOXCreator::qp_enc($this->items[$i]->description));
- $feed.= preg_replace("~\nFrom ([^\n]*)(\n?)~","\n>From $1$2\n",$body);
- $feed.= "\n";
- $feed.= "\n";
- }
- return $feed;
- }
-
- /**
- * Generate a filename for the feed cache file. Overridden from FeedCreator to prevent XML data types.
- * @return string the feed cache filename
- * @since 1.4
- * @access private
- */
- function _generateFilename() {
- $fileInfo = pathinfo($_SERVER["PHP_SELF"]);
- return substr($fileInfo["basename"],0,-(strlen($fileInfo["extension"])+1)).".mbox";
- }
-}
-
-
-/**
- * OPMLCreator is a FeedCreator that implements OPML 1.0.
- *
- * @see http://opml.scripting.com/spec
- * @author Dirk Clemens, Kai Blankenhorn
- * @since 1.5
- */
-class OPMLCreator extends FeedCreator {
-
- function OPMLCreator() {
- $this->encoding = "utf-8";
- }
-
- function createFeed() {
- $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
- $feed.= $this->_createGeneratorComment();
- $feed.= $this->_createStylesheetReferences();
- $feed.= "<opml xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.0\">\n";
- $feed.= " <head>\n";
- $feed.= " <title>".htmlspecialchars($this->title)."</title>\n";
- if ($this->pubDate!="") {
- $date = new FeedDate($this->pubDate);
- $feed.= " <dateCreated>".$date->rfc822()."</dateCreated>\n";
- }
- if ($this->lastBuildDate!="") {
- $date = new FeedDate($this->lastBuildDate);
- $feed.= " <dateModified>".$date->rfc822()."</dateModified>\n";
- }
- if ($this->editor!="") {
- $feed.= " <ownerName>".$this->editor."</ownerName>\n";
- }
- if ($this->editorEmail!="") {
- $feed.= " <ownerEmail>".$this->editorEmail."</ownerEmail>\n";
- }
- $feed.= " </head>\n";
- $feed.= " <body>\n";
- for ($i=0;$i<count($this->items);$i++) {
- $feed.= " <outline type=\"rss\" ";
- $title = htmlspecialchars(strip_tags(strtr($this->items[$i]->title,"\n\r"," ")));
- $feed.= " title=\"".$title."\"";
- $feed.= " text=\"".$title."\"";
- //$feed.= " description=\"".htmlspecialchars($this->items[$i]->description)."\"";
- $feed.= " url=\"".htmlspecialchars($this->items[$i]->link)."\"";
-
- if ($this->items[$i]->syndicationURL !="") {
- $feed.= " xmlUrl=\"" . $this->items[$i]->syndicationURL . "\"";
- }
-
- $feed.= " />\n";
- }
- $feed.= " </body>\n";
- $feed.= "</opml>\n";
- return $feed;
- }
-}
-
-
-
-/**
- * HTMLCreator is a FeedCreator that writes an HTML feed file to a specific
- * location, overriding the createFeed method of the parent FeedCreator.
- * The HTML produced can be included over http by scripting languages, or serve
- * as the source for an IFrame.
- * All output by this class is embedded in <div></div> tags to enable formatting
- * using CSS.
- *
- * @author Pascal Van Hecke
- * @since 1.7
- */
-class HTMLCreator extends FeedCreator {
-
- var $contentType = "text/html";
-
- /**
- * Contains HTML to be output at the start of the feed's html representation.
- */
- var $header;
-
- /**
- * Contains HTML to be output at the end of the feed's html representation.
- */
- var $footer ;
-
- /**
- * Contains HTML to be output between entries. A separator is only used in
- * case of multiple entries.
- */
- var $separator;
-
- /**
- * Used to prefix the stylenames to make sure they are unique
- * and do not clash with stylenames on the users' page.
- */
- var $stylePrefix;
-
- /**
- * Determines whether the links open in a new window or not.
- */
- var $openInNewWindow = true;
-
- var $imageAlign ="right";
-
- /**
- * In case of very simple output you may want to get rid of the style tags,
- * hence this variable. There's no equivalent on item level, but of course you can
- * add strings to it while iterating over the items ($this->stylelessOutput .= ...)
- * and when it is non-empty, ONLY the styleless output is printed, the rest is ignored
- * in the function createFeed().
- */
- var $stylelessOutput ="";
-
- /**
- * Writes the HTML.
- * @return string the scripts's complete text
- */
- function createFeed() {
- // if there is styleless output, use the content of this variable and ignore the rest
- if ($this->stylelessOutput!="") {
- return $this->stylelessOutput;
- }
-
- //if no stylePrefix is set, generate it yourself depending on the script name
- if ($this->stylePrefix=="") {
- $this->stylePrefix = str_replace(".", "_", $this->_generateFilename())."_";
- }
-
- //set an openInNewWindow_token_to be inserted or not
- if ($this->openInNewWindow) {
- $targetInsert = " target='_blank'";
- }
-
- // use this array to put the lines in and implode later with "document.write" javascript
- $feedArray = array();
- if ($this->image!=null) {
- $imageStr = "<a href='".$this->image->link."'".$targetInsert.">".
- "<img src='".$this->image->url."' border='0' alt='".
- FeedCreator::iTrunc(htmlspecialchars($this->image->title),100).
- "' align='".$this->imageAlign."' ";
- if ($this->image->width) {
- $imageStr .=" width='".$this->image->width. "' ";
- }
- if ($this->image->height) {
- $imageStr .=" height='".$this->image->height."' ";
- }
- $imageStr .="/></a>";
- $feedArray[] = $imageStr;
- }
-
- if ($this->title) {
- $feedArray[] = "<div class='".$this->stylePrefix."title'><a href='".$this->link."' ".$targetInsert." class='".$this->stylePrefix."title'>".
- FeedCreator::iTrunc(htmlspecialchars($this->title),100)."</a></div>";
- }
- if ($this->getDescription()) {
- $feedArray[] = "<div class='".$this->stylePrefix."description'>".
- str_replace("]]>", "", str_replace("<![CDATA[", "", $this->getDescription())).
- "</div>";
- }
-
- if ($this->header) {
- $feedArray[] = "<div class='".$this->stylePrefix."header'>".$this->header."</div>";
- }
-
- for ($i=0;$i<count($this->items);$i++) {
- if ($this->separator and $i > 0) {
- $feedArray[] = "<div class='".$this->stylePrefix."separator'>".$this->separator."</div>";
- }
-
- if ($this->items[$i]->title) {
- if ($this->items[$i]->link) {
- $feedArray[] =
- "<div class='".$this->stylePrefix."item_title'><a href='".$this->items[$i]->link."' class='".$this->stylePrefix.
- "item_title'".$targetInsert.">".FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)),100).
- "</a></div>";
- } else {
- $feedArray[] =
- "<div class='".$this->stylePrefix."item_title'>".
- FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)),100).
- "</div>";
- }
- }
- if ($this->items[$i]->getDescription()) {
- $feedArray[] =
- "<div class='".$this->stylePrefix."item_description'>".
- str_replace("]]>", "", str_replace("<![CDATA[", "", $this->items[$i]->getDescription())).
- "</div>";
- }
- }
- if ($this->footer) {
- $feedArray[] = "<div class='".$this->stylePrefix."footer'>".$this->footer."</div>";
- }
-
- $feed= "".join($feedArray, "\r\n");
- return $feed;
- }
-
- /**
- * Overrrides parent to produce .html extensions
- *
- * @return string the feed cache filename
- * @since 1.4
- * @access private
- */
- function _generateFilename() {
- $fileInfo = pathinfo($_SERVER["PHP_SELF"]);
- return substr($fileInfo["basename"],0,-(strlen($fileInfo["extension"])+1)).".html";
- }
-}
-
-
-/**
- * JSCreator is a class that writes a js file to a specific
- * location, overriding the createFeed method of the parent HTMLCreator.
- *
- * @author Pascal Van Hecke
- */
-class JSCreator extends HTMLCreator {
- var $contentType = "text/javascript";
-
- /**
- * writes the javascript
- * @return string the scripts's complete text
- */
- function createFeed()
- {
- $feed = parent::createFeed();
- $feedArray = explode("\n",$feed);
-
- $jsFeed = "";
- foreach ($feedArray as $value) {
- $jsFeed .= "document.write('".trim(addslashes($value))."');\n";
- }
- return $jsFeed;
- }
-
- /**
- * Overrrides parent to produce .js extensions
- *
- * @return string the feed cache filename
- * @since 1.4
- * @access private
- */
- function _generateFilename() {
- $fileInfo = pathinfo($_SERVER["PHP_SELF"]);
- return substr($fileInfo["basename"],0,-(strlen($fileInfo["extension"])+1)).".js";
- }
-
-}
-
-
-
-
-
-
-?>
diff --git a/includes/classes/class_module.php b/includes/classes/class_module.php
index 189e0e42bd..737b2749c2 100644
--- a/includes/classes/class_module.php
+++ b/includes/classes/class_module.php
@@ -118,7 +118,10 @@ abstract class WT_Module {
// Module has been deleted from disk? Remove it from the database.
AddToLog("Module {$module_name} has been deleted from disk - deleting from database", 'config');
WT_DB::prepare("DELETE FROM `##module_privacy` WHERE module_name=?")->execute(array($module_name));
- WT_DB::prepare("DELETE FROM `##module` WHERE module_name=?")->execute(array($module_name));
+ WT_DB::prepare("DELETE FROM `##module_setting` WHERE module_name=?")->execute(array($module_name));
+ WT_DB::prepare("DELETE `##block_setting` FROM `##block` JOIN `##block_setting` USING (block_id) WHERE module_name=?")->execute(array($module_name));
+ WT_DB::prepare("DELETE FROM `##block` WHERE module_name=?")->execute(array($module_name));
+ WT_DB::prepare("DELETE FROM `##module` WHERE module_name=?")->execute(array($module_name));
}
}
return $array;
diff --git a/includes/classes/class_stats.php b/includes/classes/class_stats.php
index 808116fb99..f5d52d1173 100644
--- a/includes/classes/class_stats.php
+++ b/includes/classes/class_stats.php
@@ -49,7 +49,7 @@ class stats {
var $_gedcom;
var $_gedcom_url;
var $_ged_id;
- var $_server_url; // Absolute URL for generating external links. e.g. in RSS feeds
+ var $_server_url; // Absolute URL for generating external links. (TODO: is this really needed?)
static $_not_allowed = false;
static $_media_types = array('audio', 'book', 'card', 'certificate', 'coat', 'document', 'electronic', 'magazine', 'manuscript', 'map', 'fiche', 'film', 'newspaper', 'painting', 'photo', 'tombstone', 'video', 'other');
@@ -1519,7 +1519,6 @@ class stats {
if ($type == 'list') {
return "<ul>\n{$top10}</ul>\n";
}
- // Statstics are used by RSS feeds, etc., so need absolute URLs.
return $top10;
}
diff --git a/includes/functions/functions.php b/includes/functions/functions.php
index 2854633dfc..7def401f26 100644
--- a/includes/functions/functions.php
+++ b/includes/functions/functions.php
@@ -203,7 +203,6 @@ function load_gedcom_settings($ged_id=WT_GED_ID) {
global $DISPLAY_JEWISH_THOUSANDS; $DISPLAY_JEWISH_THOUSANDS =get_gedcom_setting($ged_id, 'DISPLAY_JEWISH_THOUSANDS');
global $EDIT_AUTOCLOSE; $EDIT_AUTOCLOSE =get_gedcom_setting($ged_id, 'EDIT_AUTOCLOSE');
global $ENABLE_AUTOCOMPLETE; $ENABLE_AUTOCOMPLETE =get_gedcom_setting($ged_id, 'ENABLE_AUTOCOMPLETE');
- global $ENABLE_RSS; $ENABLE_RSS =get_gedcom_setting($ged_id, 'ENABLE_RSS');
global $EXPAND_NOTES; $EXPAND_NOTES =get_gedcom_setting($ged_id, 'EXPAND_NOTES');
global $EXPAND_RELATIVES_EVENTS; $EXPAND_RELATIVES_EVENTS =get_gedcom_setting($ged_id, 'EXPAND_RELATIVES_EVENTS');
global $EXPAND_SOURCES; $EXPAND_SOURCES =get_gedcom_setting($ged_id, 'EXPAND_SOURCES');
@@ -260,7 +259,6 @@ function load_gedcom_settings($ged_id=WT_GED_ID) {
global $REPO_FACTS_UNIQUE; $REPO_FACTS_UNIQUE =get_gedcom_setting($ged_id, 'REPO_FACTS_UNIQUE');
global $REPO_ID_PREFIX; $REPO_ID_PREFIX =get_gedcom_setting($ged_id, 'REPO_ID_PREFIX');
global $REQUIRE_AUTHENTICATION; $REQUIRE_AUTHENTICATION =get_gedcom_setting($ged_id, 'REQUIRE_AUTHENTICATION');
- global $RSS_FORMAT; $RSS_FORMAT =get_gedcom_setting($ged_id, 'RSS_FORMAT');
global $SAVE_WATERMARK_IMAGE; $SAVE_WATERMARK_IMAGE =get_gedcom_setting($ged_id, 'SAVE_WATERMARK_IMAGE');
global $SAVE_WATERMARK_THUMB; $SAVE_WATERMARK_THUMB =get_gedcom_setting($ged_id, 'SAVE_WATERMARK_THUMB');
global $SEARCH_FACTS_DEFAULT; $SEARCH_FACTS_DEFAULT =get_gedcom_setting($ged_id, 'SEARCH_FACTS_DEFAULT');
diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php
index 4f7f22e5ff..46511a98a0 100644
--- a/includes/functions/functions_db.php
+++ b/includes/functions/functions_db.php
@@ -2025,7 +2025,7 @@ function get_calendar_events($jd1, $jd2, $facts='', $ged_id=WT_GED_ID) {
* Get the list of current and upcoming events, sorted by anniversary date
*
* This function is used by the Todays and Upcoming blocks on the Index and Portal
-* pages. It is also used by the RSS feed.
+* pages.
*
* Special note on unknown day-of-month:
* When the anniversary date is imprecise, the sort will pretend that the day-of-month
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php
index 7418327a30..c8bd5065ee 100644
--- a/includes/functions/functions_print.php
+++ b/includes/functions/functions_print.php
@@ -415,7 +415,7 @@ function print_header($title, $head="", $use_alternate_styles=true) {
global $WT_IMAGE_DIR, $GEDCOM, $GEDCOM_TITLE, $COMMON_NAMES_THRESHOLD;
global $QUERY_STRING, $action, $query, $theme_name;
global $FAVICON, $stylesheet, $print_stylesheet, $rtl_stylesheet, $headerfile, $toplinks, $THEME_DIR, $print_headerfile;
- global $WT_IMAGES, $TEXT_DIRECTION, $ONLOADFUNCTION, $REQUIRE_AUTHENTICATION, $ENABLE_RSS, $RSS_FORMAT;
+ global $WT_IMAGES, $TEXT_DIRECTION, $ONLOADFUNCTION, $REQUIRE_AUTHENTICATION;
global $META_DESCRIPTION, $META_ROBOTS, $META_TITLE;
// TODO: Shouldn't this be in session.php?
@@ -451,12 +451,6 @@ function print_header($title, $head="", $use_alternate_styles=true) {
} else {
$GEDCOM_TITLE = get_gedcom_setting(WT_GED_ID, 'title');
}
- if ($ENABLE_RSS){
- $applicationType = "application/rss+xml";
- if ($RSS_FORMAT == "ATOM" || $RSS_FORMAT == "ATOM0.3"){
- $applicationType = "application/atom+xml";
- }
- }
$javascript = '';
$query_string = $QUERY_STRING;
if ($view!='preview' && $view!='simple') {
diff --git a/includes/functions/functions_rss.php b/includes/functions/functions_rss.php
deleted file mode 100644
index 163a50dff9..0000000000
--- a/includes/functions/functions_rss.php
+++ /dev/null
@@ -1,537 +0,0 @@
-<?php
-/**
-* Various functions used to generate the webtrees RSS feed.
-*
-* webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
-* Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*
-* @version $Id$
-* @package webtrees
-* @subpackage RSS
-*/
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_FUNCTIONS_RSS_PHP', '');
-
-require_once WT_ROOT.'includes/functions/functions_print_lists.php';
-require_once WT_ROOT.'includes/classes/class_stats.php';
-
-$time = client_time();
-$day = date("j", $time);
-$month = date("M", $time);
-$year = date("Y", $time);
-
-/**
-* Returns an ISO8601 formatted date used for the RSS feed
-*
-* @param $time the time in the UNIX time format (milliseconds since Jan 1, 1970)
-* @return SO8601 formatted date in the format of 2005-07-06T20:52:16+00:00
-*/
-function iso8601_date($time) {
- $tzd = date('O',$time);
- $tzd = $tzd[0].str_pad((int)($tzd/100), 2, "0", STR_PAD_LEFT).':'.str_pad((int)($tzd % 100), 2, "0", STR_PAD_LEFT);
- $date = date('Y-m-d\TH:i:s', $time) . $tzd;
- return $date;
-}
-
-/**
-* Returns the upcoming events array used for the RSS feed.
-* Uses configuration set for the blocks. If not configured, it will default to events in the
-* next 30 days, all events for living & and not living people
-*
-* @return the array with upcoming events data. the format is $dataArray[0] = title, $dataArray[1] = date,
-* $dataArray[2] = data
-*/
-function getUpcomingEvents() {
- global $month, $year, $day, $HIDE_LIVE_PEOPLE, $ctype, $TEXT_DIRECTION;
- global $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS;
- global $DAYS_TO_SHOW_LIMIT;
-
- $dataArray[0] = i18n::translate('Upcoming Events');
- $dataArray[1] = time();
-
- if (empty($config)) $config = $WT_BLOCKS["print_upcoming_events"]["config"];
- if (!isset($DAYS_TO_SHOW_LIMIT)) $DAYS_TO_SHOW_LIMIT = 30;
- if (isset($config["days"])) $daysprint = $config["days"];
- else $daysprint = 30;
- if (isset($config["filter"])) $filter = $config["filter"]; // "living" or "all"
- else $filter = "all";
- if (isset($config["onlyBDM"])) $onlyBDM = $config["onlyBDM"]; // "yes" or "no"
- else $onlyBDM = "no";
-
- if ($daysprint < 1) $daysprint = 1;
- if ($daysprint > $DAYS_TO_SHOW_LIMIT) $daysprint = $DAYS_TO_SHOW_LIMIT; // valid: 1 to limit
-
- $startjd=client_jd()+1;
- $endjd=client_jd()+$daysprint;
-
- $daytext=print_events_list($startjd, $endjd, $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', true);
- $daytext = str_replace(array("<br />", "<ul></ul>", " </a>"), array(" ", "", "</a>"), $daytext);
- $daytext = strip_tags($daytext, '<a><ul><li><b><span>');
- $dataArray[2] = $daytext;
- return $dataArray;
-}
-
-
-/**
-* Returns the today's events array used for the RSS feed
-*
-* @return the array with todays events data. the format is $dataArray[0] = title, $dataArray[1] = date,
-* $dataArray[2] = data
-*/
-function getTodaysEvents() {
- global $month, $year, $day, $HIDE_LIVE_PEOPLE, $ctype, $TEXT_DIRECTION;
- global $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS;
- global $DAYS_TO_SHOW_LIMIT;
-
- $dataArray[0] = i18n::translate('On This Day ...');
- $dataArray[1] = time();
-
- if (empty($config)) $config = $WT_BLOCKS["print_todays_events"]["config"];
- if (isset($config["filter"])) $filter = $config["filter"]; // "living" or "all"
- else $filter = "all";
- if (isset($config["onlyBDM"])) $onlyBDM = $config["onlyBDM"]; // "yes" or "no"
- else $onlyBDM = "no";
-
- $daytext=print_events_list(client_jd(), client_jd(), $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', true);
- $daytext = str_replace(array("<br />", "<ul></ul>", " </a>"), array(" ", "", "</a>"), $daytext);
- $daytext = strip_tags($daytext, '<a><ul><li><b><span>');
- $dataArray[2] = $daytext;
- return $dataArray;
-}
-
-/**
-* Returns the GEDCOM stats.
-*
-* @return the array with GEDCOM stats data. the format is $dataArray[0] = title, $dataArray[1] = date,
-* $dataArray[2] = data
-* @TODO does not print the family with most children due to the embedded html in that function.
-*/
-function getGedcomStats() {
- global $day, $month, $year, $WT_BLOCKS, $ctype, $COMMON_NAMES_THRESHOLD, $RTLOrd;
-
- if (empty($config)) $config = $WT_BLOCKS["print_gedcom_stats"]["config"];
- if (!isset($config['stat_indi'])) $config = $WT_BLOCKS["print_gedcom_stats"]["config"];
-
- $data = "";
- $dataArray[0] = i18n::translate('GEDCOM Statistics') . " - " . get_gedcom_setting(WT_GED_ID, 'title');
-
- $head = find_gedcom_record("HEAD", WT_GED_ID);
- $ct=preg_match("/1 SOUR (.*)/", $head, $match);
- if ($ct>0) {
- $softrec = get_sub_record(1, "1 SOUR", $head);
- $tt= preg_match("/2 NAME (.*)/", $softrec, $tmatch);
- if ($tt>0) $title = trim($tmatch[1]);
- else $title = trim($match[1]);
- if (!empty($title)) {
- $tt = preg_match("/2 VERS (.*)/", $softrec, $tmatch);
- if ($tt>0) $version = trim($tmatch[1]);
- else $version="";
- $data .= strip_tags(i18n::translate('This GEDCOM was created using %s %s', $title, $version));
- }
- }
- $ct=preg_match("/1 DATE (.+)/", $head, $match);
- if ($ct>0) {
- $date = trim($match[1]);
- $dataArray[1] = strtotime($date);
-
- $date=new GedcomDate($date);
- if (empty($title)){
- $data .= i18n::translate('This GEDCOM was created on <b>%s</b>', $date->Display(false));
- } else {
- $data .= i18n::translate(' on <b>%s</b>', $date->Display(false));
- }
- }
-
- $stats=new stats(WT_GEDCOM, WT_SERVER_NAME.WT_SCRIPT_PATH);
-
- $data .= " <br />";
- if (!isset($config["stat_indi"]) || $config["stat_indi"]=="yes"){
- $data .= $stats->totalIndividuals()." - " .i18n::translate('Individuals')."<br />";
- }
- if (!isset($config["stat_fam"]) || $config["stat_fam"]=="yes"){
- $data .= $stats->totalFamilies()." - ".i18n::translate('Families')."<br />";
- }
- if (!isset($config["stat_sour"]) || $config["stat_sour"]=="yes"){
- $data .= $stats->totalSources()." - ".i18n::translate('Sources')."<br /> ";
- }
- if (!isset($config["stat_other"]) || $config["stat_other"]=="yes"){
- $data .= $stats->totalOtherRecords()." - ".i18n::translate('Other records')."<br />";
- }
- if (!isset($config["stat_first_birth"]) || $config["stat_first_birth"]=="yes") {
- $data .= i18n::translate('Earliest birth year')." - ".$stats->firstBirthYear()."<br />";
- }
- if (!isset($config["stat_last_birth"]) || $config["stat_last_birth"]=="yes") {
- $data .= i18n::translate('Latest birth year')." - ".$stats->lastBirthYear()."<br />";
- }
- if (!isset($config["stat_long_life"]) || $config["stat_long_life"]=="yes") {
- $data .= i18n::translate('Person who lived the longest')." - ".$stats->LongestLifeAge()."<br />";
- }
- if (!isset($config["stat_avg_life"]) || $config["stat_avg_life"]=="yes") {
- $data .= i18n::translate('Average age at death')." - ".$stats->averageLifespan()."<br />";
- }
- if (!isset($config["stat_most_chil"]) || $config["stat_most_chil"]=="yes") {
- $data .= i18n::translate('Family with the most children') . $stats->largestFamilySize().' - '.$stats->largestFamily()."<br />";
- }
- if (!isset($config["stat_avg_chil"]) || $config["stat_avg_chil"]=="yes") {
- $data .= i18n::translate('Average number of children per family')." - ".$stats->averageChildren()."<br />";
- }
- if (!isset($config["show_common_surnames"]) || $config["show_common_surnames"]=="yes") {
- $data .="<b>".i18n::translate('Most Common Surnames')."</b><br />".$stats->commonSurnames();
- }
-
- $data = strip_tags($data, '<a><br><b>');
- $dataArray[2] = $data;
- return $dataArray;
-}
-
-/**
-* Returns the gedcom news for the RSS feed
-*
-* @return array of GEDCOM news arrays. Each GEDCOM news array contains $itemArray[0] = title, $itemArray[1] = date,
-* $itemArray[2] = data, $itemArray[3] = anchor (so that the link will load the proper part of the PGV page)
-* @TODO prepend relative URL's in news items with SERVER URL
-*/
-function getGedcomNews() {
- global $WT_IMAGE_DIR, $WT_IMAGES, $TEXT_DIRECTION, $ctype;
-
- $usernews = getUserNews(WT_GEDCOM);
-
- $dataArray = array();
- foreach($usernews as $key=>$news) {
-
- $day = date("j", $news["date"]);
- $mon = date("M", $news["date"]);
- $year = date("Y", $news["date"]);
- $data = "";
-
- // Look for $GLOBALS substitutions in the News title
- $newsTitle = embed_globals($news["title"]);
- $itemArray[0] = $newsTitle;
-
- $itemArray[1] = iso8601_date($news["date"]);
-
- // Look for $GLOBALS substitutions in the News text
- $newsText = embed_globals($news["text"]);
- $trans = get_html_translation_table(HTML_SPECIALCHARS);
- $trans = array_flip($trans);
- $newsText = strtr($newsText, $trans);
- $newsText = nl2br($newsText);
- $data .= $newsText;
- $itemArray[2] = $data;
- $itemArray[3] = $news["anchor"];
- $dataArray[] = $itemArray;
-
- }
- return $dataArray;
-}
-
-/**
-* Returns the top 10 surnames
-*
-* @return the array with the top 10 surname data. the format is $dataArray[0] = title, $dataArray[1] = date,
-* $dataArray[2] = data
-* @TODO Possibly turn list into a <ul> list
-*/
-function getTop10Surnames() {
- global $TEXT_DIRECTION;
- global $COMMON_NAMES_ADD, $COMMON_NAMES_REMOVE, $COMMON_NAMES_THRESHOLD, $WT_BLOCKS, $ctype, $WT_IMAGES, $WT_IMAGE_DIR;
-
- $data = "";
- $dataArray = array();
-
-
- function top_surname_sort($a, $b) {
- return $b["match"] - $a["match"];
- }
-
- if (empty($config)) $config = $WT_BLOCKS["print_block_name_top10"]["config"];
-
- if (isset($config["num"])) $numName = $config["num"];
- else $numName = 10;
-
- $dataArray[0] = str_replace("10", $numName, i18n::translate('Top 10 Surnames'));
- $dataArray[1] = time();
-
- $surnames = get_common_surnames($numName);
-
- // Sort the list and save for future reference
- uasort($surnames, "top_surname_sort");
-
- if (count($surnames)>0) {
- $i=0;
- foreach($surnames as $indexval => $surname) {
- $data .= "<a href=\"".encode_url(WT_SERVER_NAME.WT_SCRIPT_PATH."indilist.php?surname={$surname['name']}")."\">".PrintReady($surname["name"])."</a> ";
- if ($TEXT_DIRECTION=="rtl") $data .= getRLM() . "[" . getRLM() .$surname["match"].getRLM() . "]" . getRLM() . "<br />";
- else $data .= "[".$surname["match"]."]<br />";
- $i++;
- if ($i>=$numName) break;
- }
- }
- $dataArray[2] = $data;
- return $dataArray;
-}
-
-/**
-* Returns the recent changes list for the RSS feed
-*
-* @return the array with recent changes data. the format is $dataArray[0] = title, $dataArray[1] = date,
-* $dataArray[2] = data
-* @TODO merge many changes from recent changes block
-* @TODO use date of most recent change instead of curent time
-*/
-function getRecentChanges() {
- global $month, $year, $day, $HIDE_LIVE_PEOPLE, $ctype, $TEXT_DIRECTION;
- global $WT_IMAGE_DIR, $WT_IMAGES, $ASC, $IGNORE_FACTS, $IGNORE_YEAR, $LAST_QUERY, $WT_BLOCKS;
- global $objectlist;
-
- if ($ctype=="user") $filter = "living";
- else $filter = "all";
-
- if (empty($config)) $config = $WT_BLOCKS["print_recent_changes"]["config"];
- $configDays = 30;
- if(isset($config["days"]) && $config["days"] > 0) $configDays = $config["days"];
- if (isset($config["hide_empty"])) $HideEmpty = $config["hide_empty"];
- else $HideEmpty = "no";
-
- $dataArray[0] = i18n::translate('Recent Changes');
- $dataArray[1] = time();//FIXME - get most recent change time
-
- $recentText = "<ul>";
-
- $action = "today";
- $found_facts = array();
- $changes=get_recent_changes(client_jd()-$configDays);
-
- if (count($changes)>0) {
- $found_facts = array();
- foreach($changes as $gid) {
- $gedrec = find_gedcom_record($gid, WT_GED_ID, true);
-
- if (!empty($gedrec)) {
- $type = "INDI";
- $match = array();
- $ct = preg_match('/0 @'.WT_REGEX_XREF.'@ ('.WT_REGEX_TAG.')/', $gedrec, $match);
- if ($ct>0) $type = $match[1];
- $disp = true;
- switch($type) {
- case 'INDI':
- $person=Person::getInstance($gid);
- if ($filter=="living" && $person->isDead()) {
- $disp = false;
- } else {
- $disp = $person->canDisplayDetails();
- }
- break;
- case 'FAM':
- if ($filter=="living") {
- $parents = find_parents_in_record($gedrec);
- $husb=Person::getInstance($parents['HUSB']);
- $wife=Person::getInstance($parents['HUSB']);
- if ($husb->isDead()) {
- $disp = false;
- } elseif ($HIDE_LIVE_PEOPLE) {
- $disp = $husb->canDisplayDetails();
- }
- if ($disp) {
- if ($wife->isDead()) {
- $disp = false;
- } elseif ($HIDE_LIVE_PEOPLE) {
- $disp = $wife->canDisplayDetails();
- }
- }
- } else {
- if ($HIDE_LIVE_PEOPLE) $disp = canDisplayRecord(WT_GED_ID, $gedrec);
- }
- break;
- default:
- $disp = canDisplayRecord(WT_GED_ID, $gedrec);
- break;
- }
- if ($disp) {
- $factrec = get_sub_record(1, "1 CHAN", $gedrec);
- $found_facts[$gid] = array($gid, $factrec, $type);
- }
- }
- }
- }
-
-// Start output
- if (count($found_facts)==0 and $HideEmpty=="yes") return false;
-// Print block content
- if (count($found_facts)==0) {
- echo i18n::translate('<b>There have been no changes within the last %s days.</b>', $configDays);
- } else {
- echo i18n::translate('<b>Changes made within the last %s days</b>', $configDays);
- foreach($found_facts as $gid=>$factarr) {
- $record=GedcomRecord::getInstance($gid);
- if ($record && $record->canDisplayDetails()) {
- $recentText.='<li>';
- $recentText.='<a href="'.encode_url($record->getAbsoluteLinkUrl()).'"><b>'.PrintReady($record->getFullName()).'</b>';
- $recentText.='</a> '.translate_fact('CHAN').' - '.$record->LastChangeTimestamp(false).'</li>';
- }
- }
- }
- $recentText.='</ul>';
- $recentText = strip_tags($recentText, '<a><ul><li><b><span>');
- $dataArray[2] = $recentText;
- return $dataArray;
-}
-
-/**
-* Returns a random media for the RSS feed
-*
-* @return the array with random media data. the format is $dataArray[0] = title, $dataArray[1] = date,
-* $dataArray[2] = data, $dataArray[3] = file path, $dataArray[4] = mime type,
-* $dataArray[5] = file size, $dataArray[5] = media title
-*/
-function getRandomMedia() {
- global $foundlist, $MULTI_MEDIA, $TEXT_DIRECTION, $WT_IMAGE_DIR, $WT_IMAGES;
- global $MEDIA_EXTERNAL, $MEDIA_DIRECTORY;
- global $MEDIATYPE, $THUMBNAIL_WIDTH, $USE_MEDIA_VIEWER;
- global $WT_BLOCKS, $ctype, $action;
- global $WT_IMAGE_DIR, $WT_IMAGES;
- if (empty($config)) $config = $WT_BLOCKS["print_random_media"]["config"];
- if (isset($config["filter"])) $filter = $config["filter"]; // indi, event, or all
- else $filter = "all";
-
- $dataArray[0] = i18n::translate('Random Picture');
- $dataArray[1] = time();//FIXME - get most recent change time
-
- $randomMedia = "";
-
-
- if (!$MULTI_MEDIA) return;
- $medialist = array();
- $foundlist = array();
-
- $medialist = get_medialist(false, '', true, true);
- $ct = count($medialist);
- if ($ct>0) {
- $i=0;
- $disp = false;
- //-- try up to 40 times to get a media to display
- while($i<40) {
- $error = false;
- $value = array_rand($medialist);
- $links = $medialist[$value]["LINKS"];
- $disp = ($medialist[$value]["EXISTS"]>0) && $medialist[$value]["LINKED"] && $medialist[$value]["CHANGE"]!="delete" ;
- $disp &= canDisplayRecord($value["GEDFILE"], $value["GEDCOM"]);
- $disp &= canDisplayFact($value["XREF"], $value["GEDFILE"], $value["GEDCOM"]);
-
- $isExternal = isFileExternal($medialist[$value]["FILE"]);
-
- if (!$isExternal) $disp &= ($medialist[$value]["THUMBEXISTS"]>0);
-
- // Filter according to format and type (Default: unless configured otherwise, don't filter)
- if (!empty($medialist[$value]["FORM"]) && isset($config["filter_".$medialist[$value]["FORM"]]) && $config["filter_".$medialist[$value]["FORM"]]!="yes") $disp = false;
- if (!empty($medialist[$value]["TYPE"]) && isset($config["filter_".$medialist[$value]["TYPE"]]) && $config["filter_".$medialist[$value]["TYPE"]]!="yes") $disp = false;
-
- if ($disp && count($links) != 0){
- foreach($links as $key=>$type) {
- $gedrec = find_gedcom_record($key, WT_GED_ID);
- $disp &= !empty($gedrec);
- //-- source privacy is now available through the display details by id method
- // $disp &= $type!="SOUR";
- $disp &= canDisplayRecord(WT_GED_ID, $gedrec);
- }
- if ($disp && $filter!="all") {
- // Apply filter criteria
- $ct = preg_match("/0 (@.*@) OBJE/", $medialist[$value]["GEDCOM"], $match);
- $objectID = $match[1];
- $ct2 = preg_match("/(\d) OBJE {$objectID}/", $gedrec, $match2);
- if ($ct2>0) {
- $objectRefLevel = $match2[1];
- if ($filter=="indi" && $objectRefLevel!="1") $disp = false;
- if ($filter=="event" && $objectRefLevel=="1") $disp = false;
- }
- else $disp = false;
- }
- }
- //-- leave the loop if we find an image that works
- if ($disp) {
- break;
- }
- //-- otherwise remove the private media item from the list
- else {
- unset($medialist[$value]);
- }
- //-- if there are no more media items, then try to get some more
- if (count($medialist)==0) $medialist = get_medialist(false, '', true, true);
- $i++;
- }
- if (!$disp) return false;
-
- $imgsize = findImageSize($medialist[$value]["FILE"]);
- $imgwidth = $imgsize[0]+40;
- $imgheight = $imgsize[1]+150;
-
- $mediaid = $medialist[$value]["XREF"];
- $randomMedia .= "<a href=\"".encode_url("mediaviewer.php?mid={$mediaid}")."\">";
- $mediaTitle = "";
- if (!empty($medialist[$value]["TITL"])) {
- $mediaTitle = PrintReady($medialist[$value]["TITL"]);
- } else {
- $mediaTitle = basename($medialist[$value]["FILE"]);
- }
- //if ($block) {
- $randomMedia .= "<img src=\"".$medialist[$value]["THUMB"]."\" border=\"0\" class=\"thumbnail\"";
- if ($isExternal) $randomMedia .= " width=\"".$THUMBNAIL_WIDTH."\"";
- $randomMedia .= " alt=\"" . $mediaTitle . "\" title=\"" . $mediaTitle . "\" />";
- /*} else {
- print "<img src=\"".$medialist[$value]["FILE"]."\" border=\"0\" class=\"thumbnail\" ";
- $imgsize = findImageSize($medialist[$value]["FILE"]);
- if ($imgsize[0] > 175) print "width=\"175\" ";
- print " alt=\"" . $mediaTitle . "\" title=\"" . $mediaTitle . "\" />";
- }*/
- $randomMedia .= "</a>\n";
- $randomMedia .= "<br />";
- $randomMedia .= "<a href=\"".encode_url("mediaviewer.php?mid={$mediaid}")."\">";
- $randomMedia .= "<b>". $mediaTitle ."</b>";
- $randomMedia .= "</a>";
-
- $dataArray[2] = $randomMedia;
- $dataArray[3] = $medialist[$value]["FILE"];
- $dataArray[4] = image_type_to_mime_type($imgsize[2]);
- if ($dataArray[4] == false){
- $dataArray[4] ="";
- $parts = pathinfo($filename);
- if (isset ($parts["extension"])) {
- $ext = strtolower($parts["extension"]);
- } else {
- $ext="";
- }
- if($ext == "pdf"){
- $dataArray[4] = "application/pdf";
- }
- }
- $dataArray[5] = @filesize($medialist[$value]["FILE"]);
- $dataArray[6] = $mediaTitle;
- //$dataArray[7] = $medialist[$value]["XREF"];
- }
- return $dataArray;
-}
-
-
-?>
diff --git a/includes/set_gedcom_defaults.php b/includes/set_gedcom_defaults.php
index 918ea0fa35..13006655e1 100644
--- a/includes/set_gedcom_defaults.php
+++ b/includes/set_gedcom_defaults.php
@@ -58,7 +58,6 @@ set_gedcom_setting($ged_id, 'DISPLAY_JEWISH_GERESHAYIM', true);
set_gedcom_setting($ged_id, 'DISPLAY_JEWISH_THOUSANDS', false);
set_gedcom_setting($ged_id, 'EDIT_AUTOCLOSE', true);
set_gedcom_setting($ged_id, 'ENABLE_AUTOCOMPLETE', true);
-set_gedcom_setting($ged_id, 'ENABLE_RSS', true);
set_gedcom_setting($ged_id, 'EXPAND_NOTES', false);
set_gedcom_setting($ged_id, 'EXPAND_RELATIVES_EVENTS', false);
set_gedcom_setting($ged_id, 'EXPAND_SOURCES', false);
@@ -115,7 +114,6 @@ set_gedcom_setting($ged_id, 'REPO_FACTS_QUICK', '');
set_gedcom_setting($ged_id, 'REPO_FACTS_UNIQUE', 'NAME,ADDR');
set_gedcom_setting($ged_id, 'REPO_ID_PREFIX', 'R');
set_gedcom_setting($ged_id, 'REQUIRE_AUTHENTICATION', false);
-set_gedcom_setting($ged_id, 'RSS_FORMAT', 'ATOM');
set_gedcom_setting($ged_id, 'SAVE_WATERMARK_IMAGE', false);
set_gedcom_setting($ged_id, 'SAVE_WATERMARK_THUMB', false);
set_gedcom_setting($ged_id, 'SEARCH_FACTS_DEFAULT', 'NAME:GIVN:SDX,NAME:SURN:SDX,BIRT:DATE,BIRT:PLAC,FAMS:MARR:DATE,FAMS:MARR:PLAC,DEAT:DATE,DEAT:PLAC');