Subversion Repositories Applications.bazar

Compare Revisions

Regard whitespace Rev 455 → Rev 456

/trunk/bibliotheque/bazar.fonct.rss.php
675,7 → 675,6
$requete .= ') and bf_ce_nature=bn_id_nature ';
}
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
if ($valide!=0) {
 
if ($utilisateur->isSuperAdmin()) {
$req_where=1;
683,11 → 682,11
if ($req_where==1) {
$requete .= ' AND ';
}
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
 
}
}
else $nomflux .= BAZ_A_MODERER;
 
$requete .= 'bf_date_debut_evenement >= NOW() AND bn_id_nature=bf_ce_nature';
 
if ($emetteur!='' && $emetteur!='tous') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_utilisateur='.$emetteur;
718,7 → 717,8
$requete .= ' bf_cp_lieu_evenement LIKE "'.$_REQUEST['departement'].'%" ';
}
 
$requete .= ' ORDER BY bf_date_creation_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
$requete .= ' ORDER BY bf_date_debut_evenement ASC ';
 
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
 
789,7 → 789,7
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('item');
$xml .= "\r\n ";
$xml .= XML_Util::createTag('title', null, encoder_en_utf8($ligne['bf_titre']));
$xml .= XML_Util::createTag('title', null, transformerTxtPourRss($ligne['bf_titre']));
$xml .= "\r\n ";
$lien=$GLOBALS['_BAZAR_']['url'];
$lien->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE);
798,14 → 798,14
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('category', null, encoder_en_utf8($ligne['bn_label_nature']));
$xml .= XML_Util::createTag ('category', null, transformerTxtPourRss($ligne['bn_label_nature']));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('author', null, encoder_en_utf8($nomprenom[BAZ_CHAMPS_NOM].' '.$nomprenom[BAZ_CHAMPS_PRENOM]));
$xml .= XML_Util::createTag ('author', null, transformerTxtPourRss($nomprenom[BAZ_CHAMPS_NOM].' '.$nomprenom[BAZ_CHAMPS_PRENOM]));
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('description');
$xml .= "\r\n ";
if ($_GET[BAZ_VARIABLE_ACTION] != BAZ_VOIR_TOUTES_ANNONCES) {
$xml .= XML_Util::createCDataSection(encoder_en_utf8($ligne['bf_description']));
$xml .= XML_Util::createCDataSection(transformerTxtPourRss(subtext($ligne['bf_description'])));
}
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('description');
1134,10 → 1134,7
AND bf_statut_fiche = 1
AND bf_date_debut_evenement >= NOW()
GROUP BY bf_titre
ORDER BY bf_date_debut_evenement DESC,
bf_date_creation_fiche DESC,
bf_date_fin_validite_fiche DESC,
bf_date_maj_fiche DESC
ORDER BY bf_date_debut_evenement ASC
LIMIT 0 , 12';
 
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete);
1145,7 → 1142,8
return ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if($resultat->numRows() != 0) {
$res .= '<h2>'.BAZ_DERNIERES_FICHES.'</h2>';
$res .= '<h2>'.BAZ_PROCHAINS_EVENEMENTS.'</h2>';
 
$res .= '<ul class="liste_rss">';
while($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE);
1208,6 → 1206,12
$_REQUEST['personnes']='tous';
}
if($_SERVER['REMOTE_ADDR'] == '162.38.234.9') {
if (isset($_REQUEST['departement'])) {
$requeteWhere = ' bf_cp_lieu_evenement LIKE "'.$_REQUEST['departement'].'%" AND ';
}
}
 
if ((isset($_REQUEST['date_debut']) && $_REQUEST['date_debut'] != '') || (isset($_REQUEST['date_fin']) && $_REQUEST['date_fin'] != '')) {
 
if (isset($_REQUEST['date_debut']) && $_REQUEST['date_debut'] != '' && isset($_REQUEST['date_fin']) && $_REQUEST['date_fin'] != '') {
1371,59 → 1375,102
return $res ;
}
 
function encoder_en_utf8($txt) {
// Nous remplaçons l'apostrophe de type RIGHT SINGLE QUOTATION MARK et les & isolées qui n'auraient pas été
// remplacées par une entitée HTML et les autres caractères incompatibles provenant de cp1252 sous Windows
/*$cp1252_map = array (
"\xc2\x80" => "\xe2\x82\xac", /* EURO SIGN */
"\xc2\x82" => "\xe2\x80\x9a", /* SINGLE LOW-9 QUOTATION MARK */
"\xc2\x83" => "\xc6\x92", /* LATIN SMALL LETTER F WITH HOOK */
"\xc2\x84" => "\xe2\x80\x9e", /* DOUBLE LOW-9 QUOTATION MARK */
"\xc2\x85" => "\xe2\x80\xa6", /* HORIZONTAL ELLIPSIS */
"\xc2\x86" => "\xe2\x80\xa0", /* DAGGER */
"\xc2\x87" => "\xe2\x80\xa1", /* DOUBLE DAGGER */
"\xc2\x88" => "\xcb\x86", /* MODIFIER LETTER CIRCUMFLEX ACCENT */
"\xc2\x89" => "\xe2\x80\xb0", /* PER MILLE SIGN */
"\xc2\x8a" => "\xc5\xa0", /* LATIN CAPITAL LETTER S WITH CARON */
"\xc2\x8b" => "\xe2\x80\xb9", /* SINGLE LEFT-POINTING ANGLE QUOTATION */
"\xc2\x8c" => "\xc5\x92", /* LATIN CAPITAL LIGATURE OE */
"\xc2\x8e" => "\xc5\xbd", /* LATIN CAPITAL LETTER Z WITH CARON */
"\xc2\x91" => "\xe2\x80\x98", /* LEFT SINGLE QUOTATION MARK */
"\xc2\x92" => "\xe2\x80\x99", /* RIGHT SINGLE QUOTATION MARK */
"\xc2\x93" => "\xe2\x80\x9c", /* LEFT DOUBLE QUOTATION MARK */
"\xc2\x94" => "\xe2\x80\x9d", /* RIGHT DOUBLE QUOTATION MARK */
"\xc2\x95" => "\xe2\x80\xa2", /* BULLET */
"\xc2\x96" => "\xe2\x80\x93", /* EN DASH */
"\xc2\x97" => "\xe2\x80\x94", /* EM DASH */
"\xc2\x98" => "\xcb\x9c", /* SMALL TILDE */
"\xc2\x99" => "\xe2\x84\xa2", /* TRADE MARK SIGN */
"\xc2\x9a" => "\xc5\xa1", /* LATIN SMALL LETTER S WITH CARON */
"\xc2\x9b" => "\xe2\x80\xba", /* SINGLE RIGHT-POINTING ANGLE QUOTATION*/
"\xc2\x9c" => "\xc5\x93", /* LATIN SMALL LIGATURE OE */
"\xc2\x9e" => "\xc5\xbe", /* LATIN SMALL LETTER Z WITH CARON */
"\xc2\x9f" => "\xc5\xb8" /* LATIN CAPITAL LETTER Y WITH DIAERESIS*/
);*/
function transformerTxtPourRss($txt) {
$txt_utf8 = encoderEnUtf8($txt);
$txt_utf8 = remplacerEsperluettesIsoleesParEntiteHtml($txt_utf8);
$txt_utf8 = remplacerCaracteresAsciiInvisibles($txt_utf8);
$txt_utf8 = remplacerCaracteresCp1252Problematiques($txt_utf8);
return $txt_utf8;
$badlatin1_cp1252_to_htmlent =
array(
'\x80'=>'&#x20AC;', '\x81'=>'?', '\x82'=>'&#x201A;', '\x83'=>'&#x0192;',
'\x84'=>'&#x201E;', '\x85'=>'&#x2026;', '\x86'=>'&#x2020;', '\x87'=>'&#x2021;',
'\x88'=>'&#x02C6;', '\x89'=>'&#x2030;', '\x8A'=>'&#x0160;', '\x8B'=>'&#x2039;',
'\x8C'=>'&#x0152;', '\x8D'=>'?', '\x8E'=>'&#x017D;', '\x8F'=>'?',
'\x90'=>'?', '\x91'=>'&#x2018;', '\x92'=>'&#x2019;', '\x93'=>'&#x201C;',
'\x94'=>'&#x201D;', '\x95'=>'&#x2022;', '\x96'=>'&#x2013;', '\x97'=>'&#x2014;',
'\x98'=>'&#x02DC;', '\x99'=>'&#x2122;', '\x9A'=>'&#x0161;', '\x9B'=>'&#x203A;',
'\x9C'=>'&#x0153;', '\x9D'=>'?', '\x9E'=>'&#x017E;', '\x9F'=>'&#x0178;'
);
$txt = strtr($txt, $badlatin1_cp1252_to_htmlent);
}
return utf8_encode($txt);
function encoderEnUtf8($txtEnIso88591) {
$txt_utf8 = utf8_encode($txt);
return $txt_utf8;
}
 
//return strtr(preg_replace('/ \x{0026} /u', ' &#38; ', mb_convert_encoding($txt, 'UTF-8','HTML-ENTITIES')), $cp1252_map);
//return strtr(preg_replace('/ \x{0026} /u', ' &#38; ', utf8_encode($txt)), $cp1252_map);
function remplacerEsperluettesIsoleesParEntiteHtml($txtEnUtf8) {
$txtEnUtf8 = preg_replace('/ \x{0026} /u', ' &#38; ', $txtEnUtf8);// Remplacement des & isolés
return $txtEnUtf8;
}
 
function remplacerCaracteresAsciiInvisibles($txtEnUtf8) {
$ascii_remplacements = array (
'\x00' => '', // NUL : Null (nul)
'\x01' => '', // SOH : Start of Header (début d'en-tête)
'\x02' => '', // STX : Start of Text (début du texte)
'\x03' => '', // ETX : End of Text (fin du texte)
'\x04' => '', // EOT : End of Transmission (fin de transmission)
'\x05' => '', // ENQ : Enquiry (End of Line) (demande, fin de ligne)
'\x06' => '', // ACK : Acknowledge (accusé de réception)
'\x07' => '', // BEL : Bell (caractère d'appel)
'\x08' => '', // BS : Backspace (espacement arrière)
'\x09' => ' ', // HT : Horizontal Tab (tabulation horizontale)
'\x0A' => '', // LF : Line Feed (saut de ligne)
'\x0B' => '', // VT : Vertical Tab (tabulation verticale)
'\x0C' => '', // FF : Form Feed (saut de page)
'\x0D' => '', // CR : Carriage Return (retour chariot)
'\x0E' => '', // SO : Shift Out (fin d'extension)
'\x0F' => '', // SI : Shift In (démarrage d'extension)
'\x10' => '', // DLE : Data Link Escape
'\x11' => '', // DC1 : Device Control 1 à 4 (DC1 et DC3 sont généralement utilisés pour coder XON et XOFF dans un canal de communication duplex)
'\x12' => '', // DC2 :
'\x13' => '', // DC3 :
'\x14' => '', // DC4 :
'\x15' => '', // NAK : Negative Acknowledge (accusé de réception négatif)
'\x16' => '', // SYN : Synchronous Idle
'\x17' => '', // ETB : End of Transmission Block (fin du bloc de transmission)
'\x18' => '', // CAN : Cancel (annulation)
'\x19' => '', // EM : End of Medium (fin de support)
'\x1A' => '', // SUB : Substitute (substitution)
'\x1B' => '', // ESC : Escape (échappement)
'\x1C' => '', // FS : File Separator (séparateur de fichier)
'\x1D' => '', // GS : Group Separator (séparateur de groupe)
'\x1E' => '', // RS : Record Separator (séparateur d'enregistrement)
'\x1F' => '', // US : Unit Separator (séparateur d'unité)
'\x20' => ' '); // SP : Espace (Space en anglais)
$txtEnUtf8 = strtr($txtEnUtf8, $ascii_remplacements);
return $txtEnUtf8;
}
 
function remplacerCaracteresCp1252Problematiques($txtEnUtf8) {
$cp1252_remplacements = array (
'\xc2\x80' => '\xe2\x82\xac', // EURO SIGN
'\xc2\x82' => '\xe2\x80\x9a', // SINGLE LOW-9 QUOTATION MARK
'\xc2\x83' => '\xc6\x92', // LATIN SMALL LETTER F WITH HOOK
'\xc2\x84' => '\xe2\x80\x9e', // DOUBLE LOW-9 QUOTATION MARK
'\xc2\x85' => '\xe2\x80\xa6', // HORIZONTAL ELLIPSIS
'\xc2\x86' => '\xe2\x80\xa0', // DAGGER
'\xc2\x87' => '\xe2\x80\xa1', // DOUBLE DAGGER
'\xc2\x88' => '\xcb\x86', // MODIFIER LETTER CIRCUMFLEX ACCENT
'\xc2\x89' => '\xe2\x80\xb0', // PER MILLE SIGN
'\xc2\x8a' => '\xc5\xa0', // LATIN CAPITAL LETTER S WITH CARON
'\xc2\x8b' => '\xe2\x80\xb9', // SINGLE LEFT-POINTING ANGLE QUOTATION
'\xc2\x8c' => '\xc5\x92', // LATIN CAPITAL LIGATURE OE
'\xc2\x8e' => '\xc5\xbd', // LATIN CAPITAL LETTER Z WITH CARON
'\xc2\x91' => '\xe2\x80\x98', // LEFT SINGLE QUOTATION MARK
'\xc2\x92' => '\xe2\x80\x99', // RIGHT SINGLE QUOTATION MARK
'\xc2\x93' => '\xe2\x80\x9c', // LEFT DOUBLE QUOTATION MARK
'\xc2\x94' => '\xe2\x80\x9d', // RIGHT DOUBLE QUOTATION MARK
'\xc2\x95' => '\xe2\x80\xa2', // BULLET
'\xc2\x96' => '\xe2\x80\x93', // EN DASH
'\xc2\x97' => '\xe2\x80\x94', // EM DASH
'\xc2\x98' => '\xcb\x9c', // SMALL TILDE
'\xc2\x99' => '\xe2\x84\xa2', // TRADE MARK SIGN
'\xc2\x9a' => '\xc5\xa1', // LATIN SMALL LETTER S WITH CARON
'\xc2\x9b' => '\xe2\x80\xba', // SINGLE RIGHT-POINTING ANGLE QUOTATION*/
'\xc2\x9c' => '\xc5\x93', // LATIN SMALL LIGATURE OE
'\xc2\x9e' => '\xc5\xbe', // LATIN SMALL LETTER Z WITH CARON
'\xc2\x9f' => '\xc5\xb8'); // LATIN CAPITAL LETTER Y WITH DIAERESIS*/
$txtEnUtf8 = strtr($txtEnUtf8, $cp1252_remplacements);
return $txtEnUtf8;
}
 
function subtext($text, $offset = 500) {
preg_match('!.{0,'.$offset.'}\s!si', $text, $match);
return $match[0].'...';
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $