Skip to content
Extraits de code Groupes Projets
Valider 61bf8b8d rédigé par Fil's avatar Fil
Parcourir les fichiers

Ne passe plus les titres des forums dans l'URL (future compatibilite autres...

Ne passe plus les titres des forums dans l'URL (future compatibilite autres charsets + URLs moins charges)
parent 308d68a2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -1380,38 +1380,27 @@ function calculer_champ($id_champ, $id_boucle, $nom_var) ...@@ -1380,38 +1380,27 @@ function calculer_champ($id_champ, $id_boucle, $nom_var)
$milieu = ' $milieu = '
switch ($pile_boucles[$id_instance]->type_requete) { switch ($pile_boucles[$id_instance]->type_requete) {
case "articles": case "articles":
$titre = "> ".$pile_boucles[$id_instance]->row["titre"]; $'.$nom_var.' = retour_forum(0, 0, $contexte["id_article"], 0, 0);
$'.$nom_var.' = retour_forum(0, 0, $contexte["id_article"], 0, 0, $titre);
break; break;
case "breves": case "breves":
$titre = "> ".$pile_boucles[$id_instance]->row["titre"]; $'.$nom_var.' = retour_forum(0, 0, 0, $contexte["id_breve"], 0);
$'.$nom_var.' = retour_forum(0, 0, 0, $contexte["id_breve"], 0, $titre);
break; break;
case "forums": case "forums":
$titre = "> ".$pile_boucles[$id_instance]->row["titre"]; $'.$nom_var.' = retour_forum($contexte["id_rubrique"], $contexte["id_forum"], $contexte["id_article"], $contexte["id_breve"], $contexte["id_syndic"]);
$'.$nom_var.' = retour_forum($contexte["id_rubrique"], $contexte["id_forum"], $contexte["id_article"], $contexte["id_breve"], $contexte["id_syndic"], $titre);
break; break;
case "rubriques": case "rubriques":
$titre = "> ".$pile_boucles[$id_instance]->row["titre"]; $'.$nom_var.' = retour_forum($contexte["id_rubrique"], 0, 0, 0, 0);
$'.$nom_var.' = retour_forum($contexte["id_rubrique"], 0, 0, 0, 0, $titre);
break; break;
case "syndication": case "syndication":
$titre = "> ".$pile_boucles[$id_instance]->row["nom_site"]; $'.$nom_var.' = retour_forum(0, 0, 0, 0, $contexte["id_syndic"]);
$'.$nom_var.' = retour_forum(0, 0, 0, 0, $contexte["id_syndic"], $titre);
break; break;
default: default:
if ($http_get_vars["titre"]) { $'.$nom_var.' = retour_forum($contexte["id_rubrique"], $contexte["id_forum"], $contexte["id_article"], $contexte["id_breve"], $contexte["id_syndic"]);
$titre = "> ".rawurldecode($http_get_vars["titre"]);
}
else {
$titre = "";
}
$'.$nom_var.' = retour_forum($contexte["id_rubrique"], $contexte["id_forum"], $contexte["id_article"], $contexte["id_breve"], $contexte["id_syndic"], $titre);
break; break;
} }
'; ';
...@@ -1429,44 +1418,37 @@ function calculer_champ($id_champ, $id_boucle, $nom_var) ...@@ -1429,44 +1418,37 @@ function calculer_champ($id_champ, $id_boucle, $nom_var)
if ($forums_publics != "non" AND $contexte["accepter_forum"] != "non") { if ($forums_publics != "non" AND $contexte["accepter_forum"] != "non") {
$lien = substr($request_uri, strrpos($request_uri, "/") + 1); $lien = substr($request_uri, strrpos($request_uri, "/") + 1);
if (!$lien_retour = $http_get_vars["retour"]) if (!$lien_retour = $http_get_vars["retour"])
$lien_retour = rawurlencode($lien); $lien_retour = $lien;
$lien_retour = rawurlencode($lien_retour);
switch ($pile_boucles[$id_instance]->type_requete) { switch ($pile_boucles[$id_instance]->type_requete) {
case "articles": case "articles":
$titre = $pile_boucles[$id_instance]->row["titre"];
$'.$nom_var.' = "id_article=$contexte[id_article]"; $'.$nom_var.' = "id_article=$contexte[id_article]";
break; break;
case "breves": case "breves":
$titre = $pile_boucles[$id_instance]->row["titre"];
$'.$nom_var.' = "id_breve=$contexte[id_breve]"; $'.$nom_var.' = "id_breve=$contexte[id_breve]";
break; break;
case "forums":
$titre = $pile_boucles[$id_instance]->row["titre"];
$'.$nom_var.' = "id_article=$contexte[id_article]&id_breve=$contexte[id_breve]&id_rubrique=$contexte[id_rubrique]&id_syndic=$contexte[id_syndic]&id_forum=$contexte[id_forum]";
break;
case "rubriques": case "rubriques":
$titre = $pile_boucles[$id_instance]->row["titre"];
$'.$nom_var.' = "id_rubrique=$contexte[id_rubrique]"; $'.$nom_var.' = "id_rubrique=$contexte[id_rubrique]";
break; break;
case "syndication": case "syndication":
$titre = $pile_boucles[$id_instance]->row["nom_site"];
$'.$nom_var.' = "id_syndic=$contexte[id_syndic]"; $'.$nom_var.' = "id_syndic=$contexte[id_syndic]";
break; break;
case "forums":
default: default:
$titre = ""; $liste_champs = array ("id_article","id_breve","id_rubrique","id_syndic","id_forum");
$'.$nom_var.' = "id_article=$contexte[id_article]&id_breve=$contexte[id_breve]&id_rubrique=$contexte[id_rubrique]&id_syndic=$contexte[id_syndic]&id_forum=$contexte[id_forum]"; while (list(,$champ) = each ($liste_champs)) {
if ($contexte[$champ]) $element[] = "$champ=$contexte[$champ]";
}
$'.$nom_var.' = join("&",$element);
break; break;
} }
if ($http_get_vars["titre"]) { $'.$nom_var.' .= "&retour=$lien_retour";
$titre = "> ".rawurldecode($http_get_vars["titre"]);
}
$'.$nom_var.' .= "&titre=".rawurlencode(substr($titre, 0, 25))."&retour=$lien_retour";
} }
else { else {
$'.$nom_var.' = ""; $'.$nom_var.' = "";
......
...@@ -86,7 +86,7 @@ function forum_abonnement() { ...@@ -86,7 +86,7 @@ function forum_abonnement() {
} }
function retour_forum($id_rubrique, $id_parent, $id_article, $id_breve, $id_syndic, $titre) { function retour_forum($id_rubrique, $id_parent, $id_article, $id_breve, $id_syndic) {
global $REQUEST_URI, $HTTP_GET_VARS, $PATH_TRANSLATED; global $REQUEST_URI, $HTTP_GET_VARS, $PATH_TRANSLATED;
$forums_publics = lire_meta("forums_publics"); $forums_publics = lire_meta("forums_publics");
...@@ -96,7 +96,7 @@ function retour_forum($id_rubrique, $id_parent, $id_article, $id_breve, $id_synd ...@@ -96,7 +96,7 @@ function retour_forum($id_rubrique, $id_parent, $id_article, $id_breve, $id_synd
$retour = $HTTP_GET_VARS['retour']; $retour = $HTTP_GET_VARS['retour'];
if ($retour) if ($retour)
$retour = $retour; $retour = rawurlencode($retour);
else else
$retour = rawurlencode($lien); $retour = rawurlencode($lien);
...@@ -118,8 +118,21 @@ function retour_forum($id_rubrique, $id_parent, $id_article, $id_breve, $id_synd ...@@ -118,8 +118,21 @@ function retour_forum($id_rubrique, $id_parent, $id_article, $id_breve, $id_synd
$ret .= "\n"; $ret .= "\n";
if ($HTTP_GET_VARS['titre']){ // recuperer le titre
$titre = "> ".rawurldecode($HTTP_GET_VARS['titre']); if (! $titre) {
if ($id_parent)
$titre_select = "SELECT titre FROM spip_forum WHERE id_forum = $id_parent";
else if ($id_rubrique)
$titre_select = "SELECT titre FROM spip_rubriques WHERE id_rubrique = $id_rubrique";
else if ($id_article)
$titre_select = "SELECT titre FROM spip_articles WHERE id_article = $id_article";
else if ($id_breve)
$titre_select = "SELECT titre FROM spip_breves WHERE id_breve = $id_breve";
else if ($id_syndic)
$titre_select = "SELECT nom_site FROM spip_syndic WHERE id_syndic = $id_syndic";
$res = mysql_fetch_object(mysql_query($titre_select));
$titre = '> ' . ereg_replace ('^[>[:space:]]*', '', $res->titre);
} }
$seed = (double) (microtime() + 1) * time() * 1000000; $seed = (double) (microtime() + 1) * time() * 1000000;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter