X-Git-Url: http://git.cyclocoop.org/?p=lhc%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fplugins-dist%2Furls_etendues%2Furls%2Fpropres.php;h=69884e0047306399b03039d9c851673441ebd27a;hp=d551ebf75b418ded93040ea2dd3cc8670573a5a0;hb=122c920eb07e3f665789f8734965b576e6c25515;hpb=226942065cd4f604eb464addf45a065c9e5bc916 diff --git a/www/plugins-dist/urls_etendues/urls/propres.php b/www/plugins-dist/urls_etendues/urls/propres.php index d551ebf7..69884e00 100644 --- a/www/plugins-dist/urls_etendues/urls/propres.php +++ b/www/plugins-dist/urls_etendues/urls/propres.php @@ -3,7 +3,7 @@ /***************************************************************************\ * SPIP, Systeme de publication pour l'internet * * * - * Copyright (c) 2001-2013 * + * Copyright (c) 2001-2014 * * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * * * * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * @@ -121,7 +121,13 @@ function declarer_url_propre($type, $id_objet) { $row = sql_fetsel("U.url, U.date, U.perma, $champ_titre", "$table AS O LEFT JOIN spip_urls AS U ON (U.type='$type' AND U.id_objet=O.$col_id)", "O.$col_id=$id_objet AND (U.segments IS NULL OR U.segments=1)", '', 'U.date DESC', 1); - + + // en SQLite le left join retourne du vide si il y a une url mais qui ne correspond pas pour la condition sur le segment + // on verifie donc que l'objet existe bien avant de sortir ou de creer une url pour cet objet + if (!$row) + $row = sql_fetsel("'' as url, '' as date, 0 as perma, $champ_titre", + "$table AS O", + "O.$col_id=$id_objet"); if (!$row) return ""; # Quand $id_objet n'est pas un numero connu $url_propre = $row['url']; @@ -168,7 +174,7 @@ function declarer_url_propre($type, $id_objet) { if ($modifier_url AND CONFIRMER_MODIFIER_URL AND $url_propre - AND $url != preg_replace('/,.*/', '', $url_propre)) + AND $url != preg_replace('/'.preg_quote(_url_propres_sep_id,'/').'.*/', '', $url_propre)) $confirmer = true; else $confirmer = false;