Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 1277 → Rev 1278

/trunk/api/pear/XML/Util.php
New file
0,0 → 1,752
<?PHP
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Stephan Schmidt <schst@php-tools.net> |
// +----------------------------------------------------------------------+
//
// $Id: Util.php,v 1.1 2007-03-28 08:51:22 neiluj Exp $
 
/**
* error code for invalid chars in XML name
*/
define("XML_UTIL_ERROR_INVALID_CHARS", 51);
 
/**
* error code for invalid chars in XML name
*/
define("XML_UTIL_ERROR_INVALID_START", 52);
 
/**
* error code for non-scalar tag content
*/
define("XML_UTIL_ERROR_NON_SCALAR_CONTENT", 60);
 
/**
* error code for missing tag name
*/
define("XML_UTIL_ERROR_NO_TAG_NAME", 61);
 
/**
* replace XML entities
*/
define("XML_UTIL_REPLACE_ENTITIES", 1);
 
/**
* embedd content in a CData Section
*/
define("XML_UTIL_CDATA_SECTION", 5);
 
/**
* do not replace entitites
*/
define("XML_UTIL_ENTITIES_NONE", 0);
 
/**
* replace all XML entitites
* This setting will replace <, >, ", ' and &
*/
define("XML_UTIL_ENTITIES_XML", 1);
 
/**
* replace only required XML entitites
* This setting will replace <, " and &
*/
define("XML_UTIL_ENTITIES_XML_REQUIRED", 2);
 
/**
* replace HTML entitites
* @link http://www.php.net/htmlentities
*/
define("XML_UTIL_ENTITIES_HTML", 3);
 
/**
* Collapse all empty tags.
*/
define("XML_UTIL_COLLAPSE_ALL", 1);
 
/**
* Collapse only empty XHTML tags that have no end tag.
*/
define("XML_UTIL_COLLAPSE_XHTML_ONLY", 2);
 
/**
* utility class for working with XML documents
*
* @category XML
* @package XML_Util
* @version 1.1.0
* @author Stephan Schmidt <schst@php.net>
*/
class XML_Util {
 
/**
* return API version
*
* @access public
* @static
* @return string $version API version
*/
function apiVersion()
{
return '1.1';
}
 
/**
* replace XML entities
*
* With the optional second parameter, you may select, which
* entities should be replaced.
*
* <code>
* require_once 'XML/Util.php';
*
* // replace XML entites:
* $string = XML_Util::replaceEntities("This string contains < & >.");
* </code>
*
* @access public
* @static
* @param string string where XML special chars should be replaced
* @param integer setting for entities in attribute values (one of XML_UTIL_ENTITIES_XML, XML_UTIL_ENTITIES_XML_REQUIRED, XML_UTIL_ENTITIES_HTML)
* @return string string with replaced chars
* @see reverseEntities()
*/
function replaceEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML)
{
switch ($replaceEntities) {
case XML_UTIL_ENTITIES_XML:
return strtr($string,array(
'&' => '&amp;',
'>' => '&gt;',
'<' => '&lt;',
'"' => '&quot;',
'\'' => '&apos;' ));
break;
case XML_UTIL_ENTITIES_XML_REQUIRED:
return strtr($string,array(
'&' => '&amp;',
'<' => '&lt;',
'"' => '&quot;' ));
break;
case XML_UTIL_ENTITIES_HTML:
return htmlentities($string);
break;
}
return $string;
}
 
/**
* reverse XML entities
*
* With the optional second parameter, you may select, which
* entities should be reversed.
*
* <code>
* require_once 'XML/Util.php';
*
* // reverse XML entites:
* $string = XML_Util::reverseEntities("This string contains &lt; &amp; &gt;.");
* </code>
*
* @access public
* @static
* @param string string where XML special chars should be replaced
* @param integer setting for entities in attribute values (one of XML_UTIL_ENTITIES_XML, XML_UTIL_ENTITIES_XML_REQUIRED, XML_UTIL_ENTITIES_HTML)
* @return string string with replaced chars
* @see replaceEntities()
*/
function reverseEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML)
{
switch ($replaceEntities) {
case XML_UTIL_ENTITIES_XML:
return strtr($string,array(
'&amp;' => '&',
'&gt;' => '>',
'&lt;' => '<',
'&quot;' => '"',
'&apos;' => '\'' ));
break;
case XML_UTIL_ENTITIES_XML_REQUIRED:
return strtr($string,array(
'&amp;' => '&',
'&lt;' => '<',
'&quot;' => '"' ));
break;
case XML_UTIL_ENTITIES_HTML:
$arr = array_flip(get_html_translation_table(HTML_ENTITIES));
return strtr($string, $arr);
break;
}
return $string;
}
 
/**
* build an xml declaration
*
* <code>
* require_once 'XML/Util.php';
*
* // get an XML declaration:
* $xmlDecl = XML_Util::getXMLDeclaration("1.0", "UTF-8", true);
* </code>
*
* @access public
* @static
* @param string $version xml version
* @param string $encoding character encoding
* @param boolean $standAlone document is standalone (or not)
* @return string $decl xml declaration
* @uses XML_Util::attributesToString() to serialize the attributes of the XML declaration
*/
function getXMLDeclaration($version = "1.0", $encoding = null, $standalone = null)
{
$attributes = array(
"version" => $version,
);
// add encoding
if ($encoding !== null) {
$attributes["encoding"] = $encoding;
}
// add standalone, if specified
if ($standalone !== null) {
$attributes["standalone"] = $standalone ? "yes" : "no";
}
 
return sprintf("<?xml%s?>", XML_Util::attributesToString($attributes, false));
}
 
/**
* build a document type declaration
*
* <code>
* require_once 'XML/Util.php';
*
* // get a doctype declaration:
* $xmlDecl = XML_Util::getDocTypeDeclaration("rootTag","myDocType.dtd");
* </code>
*
* @access public
* @static
* @param string $root name of the root tag
* @param string $uri uri of the doctype definition (or array with uri and public id)
* @param string $internalDtd internal dtd entries
* @return string $decl doctype declaration
* @since 0.2
*/
function getDocTypeDeclaration($root, $uri = null, $internalDtd = null)
{
if (is_array($uri)) {
$ref = sprintf( ' PUBLIC "%s" "%s"', $uri["id"], $uri["uri"] );
} elseif (!empty($uri)) {
$ref = sprintf( ' SYSTEM "%s"', $uri );
} else {
$ref = "";
}
 
if (empty($internalDtd)) {
return sprintf("<!DOCTYPE %s%s>", $root, $ref);
} else {
return sprintf("<!DOCTYPE %s%s [\n%s\n]>", $root, $ref, $internalDtd);
}
}
 
/**
* create string representation of an attribute list
*
* <code>
* require_once 'XML/Util.php';
*
* // build an attribute string
* $att = array(
* "foo" => "bar",
* "argh" => "tomato"
* );
*
* $attList = XML_Util::attributesToString($att);
* </code>
*
* @access public
* @static
* @param array $attributes attribute array
* @param boolean|array $sort sort attribute list alphabetically, may also be an assoc array containing the keys 'sort', 'multiline', 'indent', 'linebreak' and 'entities'
* @param boolean $multiline use linebreaks, if more than one attribute is given
* @param string $indent string used for indentation of multiline attributes
* @param string $linebreak string used for linebreaks of multiline attributes
* @param integer $entities setting for entities in attribute values (one of XML_UTIL_ENTITIES_NONE, XML_UTIL_ENTITIES_XML, XML_UTIL_ENTITIES_XML_REQUIRED, XML_UTIL_ENTITIES_HTML)
* @return string string representation of the attributes
* @uses XML_Util::replaceEntities() to replace XML entities in attribute values
* @todo allow sort also to be an options array
*/
function attributesToString($attributes, $sort = true, $multiline = false, $indent = ' ', $linebreak = "\n", $entities = XML_UTIL_ENTITIES_XML)
{
/**
* second parameter may be an array
*/
if (is_array($sort)) {
if (isset($sort['multiline'])) {
$multiline = $sort['multiline'];
}
if (isset($sort['indent'])) {
$indent = $sort['indent'];
}
if (isset($sort['linebreak'])) {
$multiline = $sort['linebreak'];
}
if (isset($sort['entities'])) {
$entities = $sort['entities'];
}
if (isset($sort['sort'])) {
$sort = $sort['sort'];
} else {
$sort = true;
}
}
$string = '';
if (is_array($attributes) && !empty($attributes)) {
if ($sort) {
ksort($attributes);
}
if( !$multiline || count($attributes) == 1) {
foreach ($attributes as $key => $value) {
if ($entities != XML_UTIL_ENTITIES_NONE) {
if ($entities === XML_UTIL_CDATA_SECTION) {
$entities = XML_UTIL_ENTITIES_XML;
}
$value = XML_Util::replaceEntities($value, $entities);
}
$string .= ' '.$key.'="'.$value.'"';
}
} else {
$first = true;
foreach ($attributes as $key => $value) {
if ($entities != XML_UTIL_ENTITIES_NONE) {
$value = XML_Util::replaceEntities($value, $entities);
}
if ($first) {
$string .= " ".$key.'="'.$value.'"';
$first = false;
} else {
$string .= $linebreak.$indent.$key.'="'.$value.'"';
}
}
}
}
return $string;
}
 
/**
* Collapses empty tags.
*
* @access public
* @static
* @param string $xml XML
* @param integer $mode Whether to collapse all empty tags (XML_UTIL_COLLAPSE_ALL) or only XHTML (XML_UTIL_COLLAPSE_XHTML_ONLY) ones.
* @return string $xml XML
*/
function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL) {
if ($mode == XML_UTIL_COLLAPSE_XHTML_ONLY) {
return preg_replace(
'/<(area|base|br|col|hr|img|input|link|meta|param)([^>]*)><\/\\1>/s',
'<\\1\\2 />',
$xml
);
} else {
return preg_replace(
'/<(\w+)([^>]*)><\/\\1>/s',
'<\\1\\2 />',
$xml
);
}
}
 
/**
* create a tag
*
* This method will call XML_Util::createTagFromArray(), which
* is more flexible.
*
* <code>
* require_once 'XML/Util.php';
*
* // create an XML tag:
* $tag = XML_Util::createTag("myNs:myTag", array("foo" => "bar"), "This is inside the tag", "http://www.w3c.org/myNs#");
* </code>
*
* @access public
* @static
* @param string $qname qualified tagname (including namespace)
* @param array $attributes array containg attributes
* @param mixed $content
* @param string $namespaceUri URI of the namespace
* @param integer $replaceEntities whether to replace XML special chars in content, embedd it in a CData section or none of both
* @param boolean $multiline whether to create a multiline tag where each attribute gets written to a single line
* @param string $indent string used to indent attributes (_auto indents attributes so they start at the same column)
* @param string $linebreak string used for linebreaks
* @param boolean $sortAttributes Whether to sort the attributes or not
* @return string $string XML tag
* @see XML_Util::createTagFromArray()
* @uses XML_Util::createTagFromArray() to create the tag
*/
function createTag($qname, $attributes = array(), $content = null, $namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, $multiline = false, $indent = "_auto", $linebreak = "\n", $sortAttributes = true)
{
$tag = array(
"qname" => $qname,
"attributes" => $attributes
);
 
// add tag content
if ($content !== null) {
$tag["content"] = $content;
}
 
// add namespace Uri
if ($namespaceUri !== null) {
$tag["namespaceUri"] = $namespaceUri;
}
 
return XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, $indent, $linebreak, $sortAttributes);
}
 
/**
* create a tag from an array
* this method awaits an array in the following format
* <pre>
* array(
* "qname" => $qname // qualified name of the tag
* "namespace" => $namespace // namespace prefix (optional, if qname is specified or no namespace)
* "localpart" => $localpart, // local part of the tagname (optional, if qname is specified)
* "attributes" => array(), // array containing all attributes (optional)
* "content" => $content, // tag content (optional)
* "namespaceUri" => $namespaceUri // namespaceUri for the given namespace (optional)
* )
* </pre>
*
* <code>
* require_once 'XML/Util.php';
*
* $tag = array(
* "qname" => "foo:bar",
* "namespaceUri" => "http://foo.com",
* "attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
* "content" => "I'm inside the tag",
* );
* // creating a tag with qualified name and namespaceUri
* $string = XML_Util::createTagFromArray($tag);
* </code>
*
* @access public
* @static
* @param array $tag tag definition
* @param integer $replaceEntities whether to replace XML special chars in content, embedd it in a CData section or none of both
* @param boolean $multiline whether to create a multiline tag where each attribute gets written to a single line
* @param string $indent string used to indent attributes (_auto indents attributes so they start at the same column)
* @param string $linebreak string used for linebreaks
* @param boolean $sortAttributes Whether to sort the attributes or not
* @return string $string XML tag
* @see XML_Util::createTag()
* @uses XML_Util::attributesToString() to serialize the attributes of the tag
* @uses XML_Util::splitQualifiedName() to get local part and namespace of a qualified name
*/
function createTagFromArray($tag, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, $multiline = false, $indent = "_auto", $linebreak = "\n", $sortAttributes = true)
{
if (isset($tag['content']) && !is_scalar($tag['content'])) {
return XML_Util::raiseError( 'Supplied non-scalar value as tag content', XML_UTIL_ERROR_NON_SCALAR_CONTENT );
}
 
if (!isset($tag['qname']) && !isset($tag['localPart'])) {
return XML_Util::raiseError( 'You must either supply a qualified name (qname) or local tag name (localPart).', XML_UTIL_ERROR_NO_TAG_NAME );
}
 
// if no attributes hav been set, use empty attributes
if (!isset($tag["attributes"]) || !is_array($tag["attributes"])) {
$tag["attributes"] = array();
}
 
if (isset($tag['namespaces'])) {
foreach ($tag['namespaces'] as $ns => $uri) {
$tag['attributes']['xmlns:'.$ns] = $uri;
}
}
 
// qualified name is not given
if (!isset($tag["qname"])) {
// check for namespace
if (isset($tag["namespace"]) && !empty($tag["namespace"])) {
$tag["qname"] = $tag["namespace"].":".$tag["localPart"];
} else {
$tag["qname"] = $tag["localPart"];
}
// namespace URI is set, but no namespace
} elseif (isset($tag["namespaceUri"]) && !isset($tag["namespace"])) {
$parts = XML_Util::splitQualifiedName($tag["qname"]);
$tag["localPart"] = $parts["localPart"];
if (isset($parts["namespace"])) {
$tag["namespace"] = $parts["namespace"];
}
}
 
if (isset($tag["namespaceUri"]) && !empty($tag["namespaceUri"])) {
// is a namespace given
if (isset($tag["namespace"]) && !empty($tag["namespace"])) {
$tag["attributes"]["xmlns:".$tag["namespace"]] = $tag["namespaceUri"];
} else {
// define this Uri as the default namespace
$tag["attributes"]["xmlns"] = $tag["namespaceUri"];
}
}
 
// check for multiline attributes
if ($multiline === true) {
if ($indent === "_auto") {
$indent = str_repeat(" ", (strlen($tag["qname"])+2));
}
}
 
// create attribute list
$attList = XML_Util::attributesToString($tag['attributes'], $sortAttributes, $multiline, $indent, $linebreak, $replaceEntities );
if (!isset($tag['content']) || (string)$tag['content'] == '') {
$tag = sprintf('<%s%s />', $tag['qname'], $attList);
} else {
switch ($replaceEntities) {
case XML_UTIL_ENTITIES_NONE:
break;
case XML_UTIL_CDATA_SECTION:
$tag['content'] = XML_Util::createCDataSection($tag['content']);
break;
default:
$tag['content'] = XML_Util::replaceEntities($tag['content'], $replaceEntities);
break;
}
$tag = sprintf('<%s%s>%s</%s>', $tag['qname'], $attList, $tag['content'], $tag['qname'] );
}
return $tag;
}
 
/**
* create a start element
*
* <code>
* require_once 'XML/Util.php';
*
* // create an XML start element:
* $tag = XML_Util::createStartElement("myNs:myTag", array("foo" => "bar") ,"http://www.w3c.org/myNs#");
* </code>
*
* @access public
* @static
* @param string $qname qualified tagname (including namespace)
* @param array $attributes array containg attributes
* @param string $namespaceUri URI of the namespace
* @param boolean $multiline whether to create a multiline tag where each attribute gets written to a single line
* @param string $indent string used to indent attributes (_auto indents attributes so they start at the same column)
* @param string $linebreak string used for linebreaks
* @param boolean $sortAttributes Whether to sort the attributes or not
* @return string $string XML start element
* @see XML_Util::createEndElement(), XML_Util::createTag()
*/
function createStartElement($qname, $attributes = array(), $namespaceUri = null, $multiline = false, $indent = '_auto', $linebreak = "\n", $sortAttributes = true)
{
// if no attributes hav been set, use empty attributes
if (!isset($attributes) || !is_array($attributes)) {
$attributes = array();
}
 
if ($namespaceUri != null) {
$parts = XML_Util::splitQualifiedName($qname);
}
 
// check for multiline attributes
if ($multiline === true) {
if ($indent === "_auto") {
$indent = str_repeat(" ", (strlen($qname)+2));
}
}
 
if ($namespaceUri != null) {
// is a namespace given
if (isset($parts["namespace"]) && !empty($parts["namespace"])) {
$attributes["xmlns:".$parts["namespace"]] = $namespaceUri;
} else {
// define this Uri as the default namespace
$attributes["xmlns"] = $namespaceUri;
}
}
 
// create attribute list
$attList = XML_Util::attributesToString($attributes, $sortAttributes, $multiline, $indent, $linebreak);
$element = sprintf("<%s%s>", $qname, $attList);
return $element;
}
 
/**
* create an end element
*
* <code>
* require_once 'XML/Util.php';
*
* // create an XML start element:
* $tag = XML_Util::createEndElement("myNs:myTag");
* </code>
*
* @access public
* @static
* @param string $qname qualified tagname (including namespace)
* @return string $string XML end element
* @see XML_Util::createStartElement(), XML_Util::createTag()
*/
function createEndElement($qname)
{
$element = sprintf("</%s>", $qname);
return $element;
}
 
/**
* create an XML comment
*
* <code>
* require_once 'XML/Util.php';
*
* // create an XML start element:
* $tag = XML_Util::createComment("I am a comment");
* </code>
*
* @access public
* @static
* @param string $content content of the comment
* @return string $comment XML comment
*/
function createComment($content)
{
$comment = sprintf("<!-- %s -->", $content);
return $comment;
}
 
/**
* create a CData section
*
* <code>
* require_once 'XML/Util.php';
*
* // create a CData section
* $tag = XML_Util::createCDataSection("I am content.");
* </code>
*
* @access public
* @static
* @param string $data data of the CData section
* @return string $string CData section with content
*/
function createCDataSection($data)
{
return sprintf("<![CDATA[%s]]>", $data);
}
 
/**
* split qualified name and return namespace and local part
*
* <code>
* require_once 'XML/Util.php';
*
* // split qualified tag
* $parts = XML_Util::splitQualifiedName("xslt:stylesheet");
* </code>
* the returned array will contain two elements:
* <pre>
* array(
* "namespace" => "xslt",
* "localPart" => "stylesheet"
* );
* </pre>
*
* @access public
* @static
* @param string $qname qualified tag name
* @param string $defaultNs default namespace (optional)
* @return array $parts array containing namespace and local part
*/
function splitQualifiedName($qname, $defaultNs = null)
{
if (strstr($qname, ':')) {
$tmp = explode(":", $qname);
return array(
"namespace" => $tmp[0],
"localPart" => $tmp[1]
);
}
return array(
"namespace" => $defaultNs,
"localPart" => $qname
);
}
 
/**
* check, whether string is valid XML name
*
* <p>XML names are used for tagname, attribute names and various
* other, lesser known entities.</p>
* <p>An XML name may only consist of alphanumeric characters,
* dashes, undescores and periods, and has to start with a letter
* or an underscore.
* </p>
*
* <code>
* require_once 'XML/Util.php';
*
* // verify tag name
* $result = XML_Util::isValidName("invalidTag?");
* if (XML_Util::isError($result)) {
* print "Invalid XML name: " . $result->getMessage();
* }
* </code>
*
* @access public
* @static
* @param string $string string that should be checked
* @return mixed $valid true, if string is a valid XML name, PEAR error otherwise
* @todo support for other charsets
*/
function isValidName($string)
{
// check for invalid chars
if (!preg_match('/^[[:alpha:]_]$/', $string{0})) {
return XML_Util::raiseError('XML names may only start with letter or underscore', XML_UTIL_ERROR_INVALID_START);
}
 
// check for invalid chars
if (!preg_match('/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?[[:alpha:]_]([[:alnum:]\_\-\.]+)?$/', $string)) {
return XML_Util::raiseError('XML names may only contain alphanumeric chars, period, hyphen, colon and underscores', XML_UTIL_ERROR_INVALID_CHARS);
}
// XML name is valid
return true;
}
 
/**
* replacement for XML_Util::raiseError
*
* Avoids the necessity to always require
* PEAR.php
*
* @access public
* @param string error message
* @param integer error code
* @return object PEAR_Error
*/
function raiseError($msg, $code)
{
require_once 'PEAR.php';
return PEAR::raiseError($msg, $code);
}
}
?>
/trunk/client/bazar/bibliotheque/bazar.fonct.rss.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.rss.php,v 1.71 2007-03-19 15:17:37 alexandre_tb Exp $
// CVS : $Id: bazar.fonct.rss.php,v 1.72 2007-03-28 08:51:22 neiluj Exp $
/**
*
*@package bazar
28,7 → 28,7
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.71 $
*@version $Revision: 1.72 $
// +------------------------------------------------------------------------------------------------------+
*/
 
207,7 → 207,7
}
//on affiche ligne par ligne sinon
else {
//cas d'une image personalisée
//cas d'une image personnalisée
if (isset($ligne['bf_url_image'])) {
$res .= '<div id="fiche_image">'."\n";
$res .= '<img src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n";
637,64 → 637,102
return $s;
}
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ;
include_once PAP_CHEMIN_API_PEAR . 'XML/Util.php' ;
// passage en utf-8 --julien
// --
// TODO: retour à la ligne (CRLF) et indentation du code pour la lisibilité
// setlocale() pour avoir les formats de date valides (w3c) --julien
setlocale(LC_TIME, "C");
$xml = XML_Util::getXMLDeclaration('1.0', 'UTF-8', 'yes') ;
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('channel');
$xml .= XML_Util::createTag ('title', null, $nomflux, null, false);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode($nomflux));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('language', null, 'fr-FR');
$xml .= XML_Util::createTag ('copyright', null, 'Copyright 2005 '.BAZ_RSS_NOMSITE);
$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%d %b %Y %H:%M:%S GMT'));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('copyright', null, 'Copyright (c) '. date('Y') .' '. BAZ_RSS_NOMSITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT'));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('ttl', null, '60');
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('image');
$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode(BAZ_RSS_NOMSITE));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('image');
if ($resultat->numRows()>0) {
if ($resultat->numRows() > 0) {
// Creation des items : titre + lien + description + date de publication
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('item');
$caractere = array('/\x92/', '/\x85/', '/\x80/', '/\x97/', '/\x96/');
$caractere_remplacement = array ('&#8217;', '&#8230;', '&#8364;', '&#8212;', '&#8211;');
$xml .= XML_Util::createTag ('title', null, preg_replace ($caractere, $caractere_remplacement,
XML_Util::replaceEntities($ligne['bf_titre'])));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode($ligne['bf_titre']) );
$xml .= "\r\n ";
$lien=$GLOBALS['_BAZAR_']['url'];
$lien->addQueryString('action', BAZ_VOIR_FICHE);
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$xml .= XML_Util::createTag ('link', null, $lien->getURL());
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('description');
$xml .= "\r\n ";
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
$xml .= XML_Util::createCDataSection (preg_replace ($caractere, $caractere_remplacement, $ligne['bf_description']));
$xml .= XML_Util::createCDataSection ( utf8_encode($ligne['bf_description']) );
}
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('description');
$xml .= "\r\n ";
if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else
$date_pub = $ligne['bf_date_debut_validite_fiche'];
$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
$xml .= XML_Util::createTag ('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('item');
}
}
else {//pas d'annonces
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('item');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
$xml .= XML_Util::createTag ('link', null, '#');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, $GLOBALS['_BAZAR_']['url']->getUrl());
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('guid', null, $GLOBALS['_BAZAR_']['url']->getUrl());
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT',strtotime("01/01/%Y")));
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('item');
 
}
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('channel');
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement('rss') ;
$xml .= XML_Util::createEndElement ('channel');
$xml .= XML_Util::createEndElement('rss') ;
 
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
1076,6 → 1114,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.71 2007/03/19 15:17:37 alexandre_tb
* correction de la requete de recherche
*
* Revision 1.70 2007/03/08 15:12:13 jp_milcent
* Fusion avec la livraison Menes : 08 mars 2007
*
/trunk/client/bazar/bazarRSS.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazarRSS.php,v 1.4 2006-05-19 13:54:32 florian Exp $
// CVS : $Id: bazarRSS.php,v 1.5 2007-03-28 08:51:22 neiluj Exp $
/**
* Générateur de flux RSS à partir du bazar
*
29,7 → 29,7
*@author Alexandre Granier <alexandre@tela-botanica.org>
*
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
86,12 → 86,15
$requeteSQL='';
}
 
echo html_entity_decode(gen_RSS($annonce, $nbitem, $emetteur, $valide, $requeteSQL, '', '', $categorie_nature));
echo gen_RSS($annonce, $nbitem, $emetteur, $valide, $requeteSQL, '', '', $categorie_nature);
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2006/05/19 13:54:32 florian
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
*
* Revision 1.3 2005/07/21 19:03:12 florian
* nouveautés bazar: templates fiches, correction de bugs, ...
*
/trunk/client/bazar/bazar.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.php,v 1.37 2007-03-08 15:12:13 jp_milcent Exp $
// CVS : $Id: bazar.php,v 1.38 2007-03-28 08:51:22 neiluj Exp $
/**
*
*@package bazar
28,7 → 28,7
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.37 $ $Date: 2007-03-08 15:12:13 $
*@version $Revision: 1.38 $ $Date: 2007-03-28 08:51:22 $
// +------------------------------------------------------------------------------------------------------+
*/
 
48,7 → 48,7
}
 
//**********************************************************************************************************
//initialisation des paramêtres papyrus
//initialisation des paramètres papyrus
//**********************************************************************************************************
//si un parametre est précisé dans le gestionnaire de menus papyrus, on le prends en compte
 
211,7 → 211,7
case BAZ_ACTION_PAS_PUBLIER : publier_fiche(0) ;$res .= fiches_a_valider(); break;
case BAZ_GERER_DROITS : $res .= baz_gestion_droits(); break;
case BAZ_S_INSCRIRE : $res .= baz_s_inscrire(); break;
case BAZ_VOIR_FLUX_RSS : header('Content-type: text/xml; charset=ISO-8859-1');include("bazarRSS.php");exit(0);break;
case BAZ_VOIR_FLUX_RSS : header('Content-type: text/xml; charset=UTF-8');include("bazarRSS.php");exit(0);break;
default : $res .= baz_liste($GLOBALS['_BAZAR_']['id_typeannonce']) ;
}
}
225,6 → 225,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.37 2007/03/08 15:12:13 jp_milcent
* Fusion avec la livraison Menes : 08 mars 2007
*
* Revision 1.35.2.2 2007/03/07 16:53:17 jp_milcent
* Suppression du query string "action" et non pas "nature"
*
/trunk/client/bazar/langues/baz_langue_fr.inc.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: baz_langue_fr.inc.php,v 1.44 2007-03-08 15:12:13 jp_milcent Exp $
// CVS : $Id: baz_langue_fr.inc.php,v 1.45 2007-03-28 08:51:22 neiluj Exp $
/**
* Fichier de traduction en français de l'application Bazar
*
30,7 → 30,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.44 $ $Date: 2007-03-08 15:12:13 $
*@version $Revision: 1.45 $ $Date: 2007-03-28 08:51:22 $
// +------------------------------------------------------------------------------------------------------+
*/
 
53,7 → 53,7
define ('BAZ_TOUS', 'Tous');
define ('BAZ_TOUTES', 'Toutes');
define ('BAZ_MOT_CLE', 'Mots clés (facultatif)');
define ('BAZ_EMETTEUR', 'Émetteur');
define ('BAZ_EMETTEUR', 'émetteur');
define ('BAZ_NATURE', 'Nature de la fiche' );
define ('BAZ_STATUT', 'Statut' );
define ('BAZ_DATE_CREATION', 'Date de cr&eacute;ation' );
115,7 → 115,7
define ('BAZ_RECHERCHE_AVANCEE', 'Recherche avanc&eacute;e >>');
define ('BAZ_RECHERCHE_DE_BASE','<< Recherche simple');
define ('BAZ_DESCRIPTION_RECHERCHE', 'En pr&eacute;cisant, ci dessus, le type de fiche cherch&eacute;, vous pourrez obtenir des fonctions de recherche avanc&eacute;.');
define ('BAZ_PAS_D_ANNONCES', 'Pas de fiches trouv&eacute;es.');
define ('BAZ_PAS_D_ANNONCES', 'Pas de fiches trouvées.');
define ('BAZ_S_INSCRIRE_AUX_ANNONCES', 'S\'abonner &agrave; un type de fiche');
define ('BAZ_ABONNE', 'Abonn&eacute;');
define ('BAZ_PAS_ABONNE', 'Pas abonn&eacute;');
155,7 → 155,7
define ('BAZ_CONFIRMATION_SUPPRESSION_IMAGE', 'Etes-vous s&ucirc;r de vouloir supprimer cette image ?') ;
define ('BAZ_VALIDER_PUBLICATION', 'Valider la publication');
define ('BAZ_ENTRER_PROJET', 'ENTRER SUR L\'ESPACE DU PROJET');
//================Textes pour les libellés======================================
//================Textes pour les libellàs======================================
define ('BAZ_ANNONCES','annonces');
define ('BAZ_PUBLICATIONS','publications');
define ('BAZ_EVENEMENTS','&eacute;v&egrave;nements');
445,6 → 445,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.44 2007/03/08 15:12:13 jp_milcent
* Fusion avec la livraison Menes : 08 mars 2007
*
* Revision 1.42.2.2 2007/03/07 17:20:47 jp_milcent
* Ajout d'une majuscule accentuée.
*
/trunk/client/bazar/configuration/baz_config.inc.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: baz_config.inc.php,v 1.22 2007-02-15 14:18:38 jp_milcent Exp $
// CVS : $Id: baz_config.inc.php,v 1.23 2007-03-28 08:51:22 neiluj Exp $
/**
* Fichier de configuration du bazar
*
31,7 → 31,7
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.22 $ $Date: 2007-02-15 14:18:38 $
*@version $Revision: 1.23 $ $Date: 2007-03-28 08:51:22 $
// +------------------------------------------------------------------------------------------------------+
*/
 
65,10 → 65,10
define('BAZ_CREER_FICHIERS_XML',0); //0=ne cree pas le fichier XML dans rss/; 1=cree le fichier XML dans rss/
define('BAZ_RSS_NOMSITE','Educ-Envir.org'); //Nom du site indiqué dans les flux rss
define('BAZ_RSS_ADRESSESITE','http://educ-envir.org'); //Adresse Internet du site indiqué dans les flux rss
define('BAZ_RSS_DESCRIPTIONSITE','Educ-Envir.org, pour mutualiser l\'information en éducation à l\'environnement.'); //Description du site indiquée dans les flux rss
define('BAZ_RSS_DESCRIPTIONSITE','Educ-Envir.org, pour mutualiser l\'information en l\'éducation à l\'environnement.'); //Description du site indiquée dans les flux rss
define('BAZ_RSS_LOGOSITE','http://ecole-et-nature.org/images/Logo_REN-Site.png'); //Logo du site indiqué dans les flux rss
define('BAZ_RSS_MANAGINGEDITOR', '') ; //Managing editor du site
define('BAZ_RSS_WEBMASTER', '') ; //Mail Webmaster du site
define('BAZ_RSS_MANAGINGEDITOR', 'baz@domain.tld') ; //Managing editor du site
define('BAZ_RSS_WEBMASTER', 'baz@domain.tld') ; //Mail Webmaster du site
define('BAZ_RSS_CATEGORIE', 'Education a l\'environnement'); //catégorie du flux RSS
 
 
82,7 → 82,7
//Mettre 1 pour 'directement validée en ligne'
 
define ('BAZ_TAILLE_MAX_FICHIER',2000*1024);
//Valeur maximale en octets pour la taille d'un fichier joint à télécharger
//Valeur maximale en octets pour la taille d'un fichier joint à tàlàcharger
 
define ('BAZ_TYPE_AFFICHAGE_LISTE', 'jma');
$GLOBALS['_BAZAR_']['db'] = & $GLOBALS['_GEN_commun']['pear_db'];
97,7 → 97,7
define ('BAZ_CHAMPS_NOM_WIKI','a_nom_wikini'); //Champs nom wikini sur la table annuaire
 
/** Réglage des droits pour déposer des annonces */
// Mettre à true pour limiter le dépot aux rédacteurs
// Mettre à true pour limiter le dépôt aux rédacteurs
define ('BAZ_RESTREINDRE_DEPOT', 0) ;
 
/** Réglage de l'affichage de la liste deroulante pour la saisie des dates */
147,6 → 147,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.22 2007/02/15 14:18:38 jp_milcent
* Fusion avec la livraison Menes : 15 février 2007
*
* Revision 1.21.2.1 2007/02/15 13:43:54 jp_milcent
* Ajout de commentaire pour la constante utilisée par le Calendrier.
*
217,7 → 220,7
* ajout constantes pour flux RSS
*
* Revision 1.4 2004/07/06 16:21:54 florian
* débuggage modification + MAJ flux RSS
* débogage modification + MAJ flux RSS
*
* Revision 1.3 2004/07/02 14:50:47 florian
* ajout configuration de l'etat de l'annonce (visible,masquée,...)
/trunk/client/projet/bibliotheque/projet.fonct.rss.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.fonct.rss.php,v 1.1 2005-10-25 13:50:54 alexandre_tb Exp $
// CVS : $Id: projet.fonct.rss.php,v 1.2 2007-03-28 08:51:22 neiluj Exp $
/**
* Générateur de flux RSS à partir de l'application projet
*
99,6 → 99,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/10/25 13:50:54 alexandre_tb
* version initiale
*
 
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/