Surcharge de #URL_DOCUMENT : si le document à son champ protected à oui,

l'url est de la forme : spip.php?action=charger_document&id_document=542
This commit is contained in:
Christophe 2020-03-21 09:01:22 +01:00
parent f08682bed9
commit f8850765de

View file

@ -12,3 +12,16 @@
if (!defined('_ECRIRE_INC_VERSION')) { if (!defined('_ECRIRE_INC_VERSION')) {
return; return;
} }
// https://code.spip.net/@urls_propres2_dist
function urls_propres2($i, &$entite, $args = '', $ancre = '') {
if ($entite === 'document' and intval($i)) {
if (sql_countsel('spip_documents',['id_document='.$i, 'protected="oui"'])) {
return generer_url_action('charger_document','id_document='.$i);
}
}
$f = charger_fonction('propres', 'urls');
return $f($i, $entite, $args, $ancre);
}