/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
- * Copyright (c) 2001-2011 *
+ * Copyright (c) 2001-2014 *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
$class = "spip_mail";
elseif (preg_match('/^<html>/',$texte)) # cf traiter_lien_explicite
$class = "spip_url spip_out";
- elseif (!$class) $class = "spip_out"; # si pas spip_in|spip_glossaire
+ elseif (!$class) {
+ # spip_out sur les URLs externes
+ if (preg_match(',^\w+://,iS', $lien)
+ AND strncasecmp($lien, url_de_base(), strlen(url_de_base()))
+ )
+ $class = "spip_out"; # si pas spip_in|spip_glossaire
+ }
// Si l'objet n'est pas de la langue courante, on ajoute hreflang
if (!$hlang AND $lang!==$GLOBALS['spip_lang'])
$lang = ($hlang ? " hreflang='$hlang'" : '');
- if ($title) $title = ' title="'.texte_backend($title).'"';
+ if ($title)
+ $title = ' title="'.texte_backend($title).'"';
+ else
+ $title = ''; // $title peut etre 'false'
// rel=external pour les liens externes
if (preg_match(',^https?://,S', $lien)
// http://doc.spip.org/@traiter_raccourci_lien_atts
function traiter_raccourci_lien_atts($texte) {
- $bulle = $hlang = '';
+ $bulle = $hlang = false;
// title et hreflang donnes par le raccourci ?
if (preg_match(_RACCOURCI_ATTRIBUTS, $texte, $m)) {
return $r ? $r : traiter_lien_explicite($ref, $texte, $pour, $connect);
}
-define('_EXTRAIRE_LIEN', ",^\s*(http:?/?/?|mailto:?)\s*$,iS");
+define('_EXTRAIRE_LIEN', ',^\s*(?:' . _PROTOCOLES_STD . '):?/?/?\s*$,iS');
// http://doc.spip.org/@traiter_lien_explicite
function traiter_lien_explicite ($ref, $texte='', $pour='url', $connect='')
// dans le cas d'un lien vers un doc, ajouter le type='mime/type'
if ($type == 'document'
- AND $mime = sql_getfetsel('mime_type', 'spip_types_documents',
- "extension IN (SELECT extension FROM spip_documents where id_document =".sql_quote($id).")",
- '','','','',$connect)
+ AND $extension = sql_getfetsel("extension","spip_documents", " id_document =".sql_quote($id), '', '', '', '', $connect)
+ AND $mime = sql_getfetsel('mime_type', 'spip_types_documents',"extension=".sql_quote($extension),'','','','',$connect)
)
$r['mime'] = $mime;
$gloss = $m[1] ? ('#' . $m[1]) : '';
$t = $r[1] . $r[2] . $r[5];
list($t, $bulle, $hlang) = traiter_raccourci_lien_atts($t);
+ if ($bulle===false) $bulle = $m[1];
$t = unicode2charset(charset2unicode($t), 'utf-8');
$ref = $lien("glose$_n$gloss", $t, 'spip_glossaire', $bulle, $hlang);
$texte = str_replace($regs[0], $ref, $texte);