Browse Source

Correction de #679: non sélection ajax de la rubrique dans l'édition d'un site. Il a fallu sortir l'artillerie lourde: validation xml de sites_edit (qui n'avait pas été faite) et error_reporting_all sur tous les fichiers inclus pour arriver à la variable indéfinie coupable. On va finir par le mettre d'office le error_reporting_all.

spip-1.9.2
Committo,Ergo:sum 16 years ago
parent
commit
0b19947268
  1. 314
      ecrire/exec/sites_edit.php
  2. 3
      ecrire/inc/informer.php
  3. 2
      ecrire/inc/plonger.php
  4. 8
      ecrire/inc/selectionner.php
  5. 2
      ecrire/index.php
  6. 4
      ecrire/public.php

314
ecrire/exec/sites_edit.php

@ -16,204 +16,198 @@ include_spip('inc/presentation');
// http://doc.spip.org/@exec_sites_edit_dist
function exec_sites_edit_dist()
{
global $connect_statut, $descriptif, $id_rubrique, $id_secteur, $id_syndic, $new, $nom_site, $syndication, $url_site, $url_syndic, $connect_id_rubrique;
$result = spip_query("SELECT * FROM spip_syndic WHERE id_syndic=" . intval($id_syndic));
if ($row = spip_fetch_array($result)) {
$id_syndic = $row["id_syndic"];
$id_rubrique = $row["id_rubrique"];
$nom_site = $row["nom_site"];
$url_site = $row["url_site"];
$url_syndic = $row["url_syndic"];
$descriptif = $row["descriptif"];
$syndication = $row["syndication"];
$extra=$row["extra"];
}
else {
$syndication = 'non';
$new = 'oui';
if (!intval($id_rubrique)) {
$in = !$connect_id_rubrique ? ''
: (' WHERE id_rubrique IN (' . join(',', $connect_id_rubrique) . ')');
$row = spip_fetch_array(spip_query("SELECT id_rubrique FROM spip_rubriques$in ORDER BY id_rubrique DESC LIMIT 1"));
$id_rubrique = $row['id_rubrique'];
global $connect_statut, $descriptif, $id_rubrique, $id_secteur, $id_syndic, $new, $nom_site, $syndication, $url_site, $url_syndic, $connect_id_rubrique;
$result = spip_query("SELECT * FROM spip_syndic WHERE id_syndic=" . intval($id_syndic));
if ($row = spip_fetch_array($result)) {
$id_syndic = $row["id_syndic"];
$id_rubrique = $row["id_rubrique"];
$nom_site = $row["nom_site"];
$url_site = $row["url_site"];
$url_syndic = $row["url_syndic"];
$descriptif = $row["descriptif"];
$syndication = $row["syndication"];
$extra=$row["extra"];
} else {
$syndication = 'non';
$new = 'oui';
if (!intval($id_rubrique)) {
$in = !$connect_id_rubrique ? ''
: (' WHERE id_rubrique IN (' . join(',', $connect_id_rubrique) . ')');
$row = spip_fetch_array(spip_query("SELECT id_rubrique FROM spip_rubriques$in ORDER BY id_rubrique DESC LIMIT 1"));
$id_rubrique = $row['id_rubrique'];
}
}
}
pipeline('exec_init',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
$commencer_page = charger_fonction('commencer_page', 'inc');
echo $commencer_page(_T('info_site_reference_2'), "naviguer", "sites", $id_rubrique);
debut_grand_cadre();
pipeline('exec_init',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
echo afficher_hierarchie($id_rubrique);
$commencer_page = charger_fonction('commencer_page', 'inc');
echo $commencer_page(_T('info_site_reference_2'), "naviguer", "sites", $id_rubrique);
fin_grand_cadre();
debut_grand_cadre();
debut_gauche();
echo pipeline('affiche_gauche',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
creer_colonne_droite();
echo pipeline('affiche_droite',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
debut_droite();
debut_cadre_formulaire();
echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
echo "<tr width='100%'>";
if ($new != 'oui') {
echo "<td>";
icone(_T('icone_retour'), generer_url_ecrire("sites","id_syndic=$id_syndic"), 'site-24.gif', "rien.gif");
echo "</td>";
echo "<td>". http_img_pack('rien.gif', " ", "width='10'") . "</td>\n";
}
echo "<td style='width: 100%'>";
echo _T('titre_referencer_site');
gros_titre($nom_site);
echo "</td></tr></table>";
echo "<p>";
echo afficher_hierarchie($id_rubrique);
fin_grand_cadre();
debut_gauche();
echo pipeline('affiche_gauche',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
creer_colonne_droite();
echo pipeline('affiche_droite',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
debut_droite();
debut_cadre_formulaire();
if ($new == 'oui'
AND (
$connect_statut == '0minirezo' OR $GLOBALS['meta']["proposer_sites"] > 0)
) {
echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>\n<tr>";
$form_auto = "<span class='verdana1 spip_small'>" . _T('texte_referencement_automatique') . "</span>"
if ($new != 'oui') {
echo "<td>";
icone(_T('icone_retour'), generer_url_ecrire("sites","id_syndic=$id_syndic"), 'site-24.gif', "rien.gif");
echo "</td>";
echo "<td>". http_img_pack('rien.gif', " ", "width='10'") . "</td>\n";
}
echo "<td style='width: 100%'>";
echo _T('titre_referencer_site');
gros_titre($nom_site);
echo "</td></tr></table><br />\n";
if ($new == 'oui'
AND ($connect_statut == '0minirezo' OR $GLOBALS['meta']["proposer_sites"] > 0)){
$form_auto = "<span class='verdana1 spip_small'>"
. _T('texte_referencement_automatique')
. "</span>"
. "\n<div align='right'><input type=\"text\" name=\"url\" class='fondl' size='40' value=\"http://\" />\n"
. "\n<input type='hidden' name='id_parent' value='".intval(_request('id_rubrique'))."' />\n"
. "<input type=\"submit\" value=\""._T('bouton_ajouter')."\" class='fondo' />\n";
$form_auto = generer_action_auteur('editer_site',
'auto',
generer_url_ecrire('sites'),
$form_auto,
" method='post' name='formulaireauto'"
);
echo
debut_cadre_relief("site-24.gif", true)
. "\n<input type='hidden' name='id_parent' value='"
. intval(_request('id_rubrique'))
. "' />\n"
. "<input type=\"submit\" value=\""
. _T('bouton_ajouter')
. "\" class='fondo' />\n"
. '</div>';
$form_auto = generer_action_auteur('editer_site',
'auto',
generer_url_ecrire('sites'),
$form_auto,
" method='post' name='formulaireauto'"
);
echo debut_cadre_relief("site-24.gif", true)
. $form_auto
. fin_cadre_relief(true)
. "\n<p><blockquote><b>"._T('texte_non_fonction_referencement')."</b>";
. "\n<blockquote><b>"
. _T('texte_non_fonction_referencement')
. "</b>";
$cadre_ouvert = true;
$form = debut_cadre_enfonce("site-24.gif");
} else $cadre_ouvert = $form = '';
$cadre_ouvert = true;
$form = debut_cadre_enfonce("site-24.gif");
}
$url_syndic = entites_html($url_syndic);
$nom_site = entites_html($nom_site);
$url_site = entites_html($url_site);
if (strlen($url_site)<8) $url_site="http://";
$nom_site = entites_html($nom_site);
$url_site = entites_html($url_site);
$url_syndic = entites_html($url_syndic);
$form .= _T('info_nom_site_2')."<br />\n";
$form .= "<input type='text' class='formo' name='nom_site' value=\"$nom_site\" size='40'>\n<p>";
if (strlen($url_site)<8) $url_site="http://";
$form .= _T('entree_adresse_site')."<br />\n";
$form .= "<input type='text' class='formo' name='url_site' value=\"$url_site\" size='40'>\n<p>";
if ($id_rubrique == 0) $logo_parent = "racine-site-24.gif";
if ($id_rubrique == 0) $logo = "racine-site-24.gif";
else {
$result=spip_query("SELECT id_parent FROM spip_rubriques WHERE id_rubrique='$id_rubrique'");
while($row=spip_fetch_array($result)){
$parent_parent=$row['id_parent'];
}
if ($parent_parent == 0) $logo_parent = "secteur-24.gif";
else $logo_parent = "rubrique-24.gif";
if ($parent_parent == 0) $logo = "secteur-24.gif";
else $logo = "rubrique-24.gif";
}
$form .= debut_cadre_couleur("$logo_parent", true, "", _T('entree_interieur_rubrique'));
// selecteur de rubriques
$chercher_rubrique = charger_fonction('chercher_rubrique', 'inc');
$restreint = ($GLOBALS['statut'] == 'publie');
$form .= $chercher_rubrique($id_rubrique, 'site', $restreint);
$form .= fin_cadre_couleur(true);
$form .= "<br /><b>"._T('entree_description_site')."</b><br />\n";
$form .= "<textarea name='descriptif' rows='8' class='forml' cols='40' wrap='soft'>";
$form .= entites_html($descriptif);
$form .= "</textarea>\n";
$activer_syndic = $GLOBALS['meta']["activer_syndic"];
$form .= "\n<input type='hidden' name='syndication_old' value=\"$syndication\">";
if ($activer_syndic != "non") {
$form .= debut_cadre_enfonce('feed.png', true);
if ($syndication == "non") {
$form .= "\n<input type='radio' name='syndication' value='non' id='syndication_non' checked='checked'>";
}
else {
$form .= "\n<input type='radio' name='syndication' value='non' id='syndication_non'>";
}
$form .= " <b><label for='syndication_non'>"
$form .= _T('info_nom_site_2')
. "<br />\n<input type='text' class='formo' name='nom_site' value=\""
. $nom_site
. "\" size='40' />\n<br />"
. _T('entree_adresse_site')
. "<br />\n<input type='text' class='formo' name='url_site' value=\""
. $url_site
. "\" size='40' /><br />\n"
. debut_cadre_couleur($logo, true, "", _T('entree_interieur_rubrique'))
. $chercher_rubrique($id_rubrique, 'site', false)
. fin_cadre_couleur(true)
. "\n<br /><b>"
. _T('entree_description_site')
. "</b><br />\n"
. "<textarea name='descriptif' rows='8' class='forml' cols='40' >"
. entites_html($descriptif)
. "</textarea>"
. "\n<input type='hidden' name='syndication_old' value=\""
. $syndication
. "\" />";
if ($GLOBALS['meta']["activer_syndic"]!= "non") {
$form .= debut_cadre_enfonce('feed.png', true);
if ($syndication == "non") {
$form .= "\n<input type='radio' name='syndication' value='non' id='syndication_non' checked='checked' />";
} else {
$form .= "\n<input type='radio' name='syndication' value='non' id='syndication_non' />";
}
$form .= "\n<b><label for='syndication_non'>"
. _T('bouton_radio_non_syndication')
. "</label></b>\n<p>";
. "</label></b><br />\n";
if ($syndication == "non") {
$form .= "<input type='radio' name='syndication' value='oui' id='syndication_oui'>";
}
else {
$form .= "<input type='radio' name='syndication' value='oui' id='syndication_oui' checked='checked'>";
}
$form .= " <b><label for='syndication_oui'>"._T('bouton_radio_syndication')."</label></b>";
$form .= aide("rubsyn");
$form .= "<table cellpadding='0' cellspacing='0' border='0' width='100%'><tr><td style='width: 10px;'>&nbsp;</td><td>";
if ($syndication == "non") {
$form .= "<input type='radio' name='syndication' value='oui' id='syndication_oui' />";
} else {
$form .= "<input type='radio' name='syndication' value='oui' id='syndication_oui' checked='checked' />";
}
$form .= "\n<b><label for='syndication_oui'>"
. _T('bouton_radio_syndication')
. "</label></b>"
. aide("rubsyn")
. "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>\n<tr><td style='width: 10px;'>&nbsp;</td>\n<td>"
. _T('entree_adresse_fichier_syndication')
. "<br />\n";
if (strlen($url_syndic) < 8) $url_syndic = "http://";
$form .= _T('entree_adresse_fichier_syndication');
$form .= "<br />\n";
if (strlen($url_syndic) < 8) $url_syndic = "http://";
// cas d'une liste de flux detectee par feedfinder : menu
if (preg_match(',^select: (.+),', $url_syndic, $regs)) {
$feeds = explode(' ',$regs[1]);
$form .= "<select name='url_syndic'>\n";
foreach ($feeds as $feed) {
$form .= '<option value="'.entites_html($feed).'">'.$feed."</option>\n";
if (preg_match(',^select: (.+),', $url_syndic, $regs)) {
$feeds = explode(' ',$regs[1]);
$form .= "<select name='url_syndic'>\n";
foreach ($feeds as $feed) {
$form .= '<option value="'.entites_html($feed).'">'.$feed."</option>\n";
}
$form .= "</select>\n";
} else {
$form .= "<input type='text' class='formo' name='url_syndic' value=\"$url_syndic\" size='40' />\n";
}
$form .= "</select>\n";
$form .= "</td></tr></table>";
$form .= fin_cadre_enfonce(true);
}
// cas normal
else {
$form .= "<input type='text' class='formo' name='url_syndic' value=\"$url_syndic\" size='40' />\n";
}
$form .= "</td></tr></table>";
$form .= fin_cadre_enfonce(true);
}
if ($GLOBALS['champs_extra']) {
include_spip('inc/extra');
$form .= extra_saisie($extra, 'sites', intval($id_secteur));
}
if ($GLOBALS['champs_extra']) {
include_spip('inc/extra');
$form .= extra_saisie($extra, 'sites', intval($id_secteur));
}
$form .= "\n<div align='right'><input type='submit' value='"._T('bouton_enregistrer')."' class='fondo' /></div>";
$form .= "\n<div align='right'><input type='submit' value='"
. _T('bouton_enregistrer')
. "' class='fondo' /></div>";
$form = generer_action_auteur('editer_site',
($new == 'oui') ? $new : $id_syndic,
generer_url_ecrire('sites'),
$form,
" method='post' name='formulaire'"
);
$form = generer_action_auteur('editer_site',
($new == 'oui') ? $new : $id_syndic,
generer_url_ecrire('sites'),
$form,
" method='post' name='formulaire'"
);
if ($cadre_ouvert) {
$form .= fin_cadre_enfonce(true);
$form .= "</blockquote>\n";
}
if ($cadre_ouvert) {
$form .= fin_cadre_enfonce(true);
$form .= "</blockquote>\n";
}
echo $form;
echo $form;
echo fin_cadre_formulaire(true);
echo fin_cadre_formulaire(true);
echo fin_gauche(), fin_page();
echo fin_gauche(), fin_page();
}
?>

3
ecrire/inc/informer.php

@ -32,7 +32,8 @@ function inc_informer_dist($id, $col, $exclus, $rac, $type)
$titre = '';
$res = '';
if ($type == "rubrique" AND $spip_display != 1 AND $spip_display!=4 AND $GLOBALS['meta']['image_process'] != "non") {
if ($type == "rubrique" AND $spip_display != 1 AND $spip_display!=4 AND isset($GLOBALS['meta']['image_process']))
if ($GLOBALS['meta']['image_process'] != "non") {
$chercher_logo = charger_fonction('chercher_logo', 'inc');
if ($res = $chercher_logo($id, 'id_rubrique', 'on')) {
list($fid, $dir, $nom, $format) = $res;

2
ecrire/inc/plonger.php

@ -33,7 +33,7 @@ function inc_plonger_dist($id_rubrique, $idom="", $list=array(), $col = 1, $excl
. (($row['langue_choisie'] != 'oui')
? '' : (' [' . $row['lang'] . ']'));
}
$next = $list[$col];
$next = isset($list[$col]) ? $list[$col] : 0;
if ($ordre) {
asort($ordre);
$rec = generer_url_ecrire('plonger',"rac=$idom&exclus=$exclu&col=".($col+1));

8
ecrire/inc/selectionner.php

@ -42,12 +42,12 @@ function inc_selectionner_dist ($sel, $idom="",$fonction="", $exclus=0, $aff_rac
. "\">\n<div class='pashighlight'>"
. _T("info_racine_site")
. "</div></div>";
}
} else $onClick = '';
$url_init = generer_url_ecrire('plonger',"rac=$idom&exclus=$exclus&id=0&col=1", true);
if ($recur) {
$onClick .= "charger_id_url('$url_init', '$idom4');";
}
$onClick .= "charger_id_url('$url_init', '$idom" . "_col_1');";
}
$plonger = charger_fonction('plonger', 'inc');
$plonger_r = $plonger($sel, $idom, $recur, 1, $exclus);
@ -71,7 +71,7 @@ function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name,
return "<div id='$idom'>"
. "<a id='$idom6' style='visibility: hidden;'"
. ($url_init ? " href='$url_init'" : '')
. ($url_init ? "\nhref='$url_init'" : '')
. "></a>"
. "<table width='100%' cellpadding='0' cellspacing='0'><tr>"
. "<td style='vertical-align: bottom;'>\n"

2
ecrire/index.php

@ -194,7 +194,7 @@ AND $l = @unserialize($l)) {
// Trouver la fonction eventuellement surchagee et l'appeler.
$var_f = charger_fonction($exec);
if (!$GLOBALS['transformer_xml']
if (!isset($GLOBALS['transformer_xml'])
OR $GLOBALS['auteur_session']['statut']!='0minirezo')
$var_f();
else { include('public/debug.php');

4
ecrire/public.php

@ -126,8 +126,8 @@ if (defined('_INC_PUBLIC')) {
// Execution de la page calculee
// 0. xml-hack
$xml_hack = ($page['entetes']['X-Xml-Hack'] == 'ok');
unset($page['entetes']['X-Xml-Hack']);
if ($xml_hack = isset($page['entetes']['X-Xml-Hack']))
unset($page['entetes']['X-Xml-Hack']);
// 1. Cas d'une page contenant uniquement du HTML :
if ($page['process_ins'] == 'html') {

Loading…
Cancel
Save