Correction du bogue de l'action box (plus d'un lien box dans la page)
Fichiers action/header.php, ajouter ces lignes entre les deux balises head:
<?php
if ($_SESSION['box']=="oui") { //ajout pour l'action box, ça écrit après avoir passé 1 fois sur un lien box.
$urlmst = $this->config[url_site];
echo "
<script type=\"text/javascript\" src=\"".$urlmst."lightwindow/javascript/prototype.js\"></script>
<script type=\"text/javascript\" src=\"".$urlmst."lightwindow/javascript/scriptaculous.js?load=effects\"></script>
<script type=\"text/javascript\" src=\"".$urlmst."lightwindow/javascript/lightwindow.js\"></script>
<link rel=\"stylesheet\" href=\"".$urlmst."lightwindow/css/lightwindow.css\" type=\"text/css\" media=\"screen\" />";
}
?>
et remplacer le fichier actions/box.php par ceci:
<?php
/*
lien action box
{{box url="http://lien.com" texte="Texte du lien" titre="Titre du lien"}}
Copyright 2009 Pierre Lachance
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
if (empty($vars['url'])) echo "Pas de critère url!";
else {
if ($_SESSION['box']=="oui") {
if ($vars['large']=="") { $large="800";} else { $large = htmlspecialchars($vars['large']);}
$url = htmlspecialchars($vars['url']);
$text = htmlspecialchars($vars['texte']);
$title = htmlspecialchars($vars['titre']);
if (!preg_match("/:\/\//", $url))
{
$url = "http://".$url; //Very important for xss (avoid javascript:() hacking)
}
if (empty($text)) $text = $url;
if (empty($large)) $large = "800";
echo "<a params=\"lightwindow_width=$large\" class=\"lightwindow\" href=\"$url\" title=\"$title\">$text</a>";
}
else { $_SESSION['box'] = "oui";
$urlmst = $this->config[url_site];
if ($vars['large']=="") { $large="800";} else { $large = htmlspecialchars($vars['large']);}
$url = htmlspecialchars($vars['url']);
$text = htmlspecialchars($vars['texte']);
$title = htmlspecialchars($vars['titre']);
if (!preg_match("/:\/\//", $url))
{
$url = "http://".$url; //Very important for xss (avoid javascript:() hacking)
}
if (empty($text)) $text = $url;
if (empty($large)) $large = "800";
echo "
<script type=\"text/javascript\" src=\"".$urlmst."lightwindow/javascript/prototype.js\"></script>
<script type=\"text/javascript\" src=\"".$urlmst."lightwindow/javascript/scriptaculous.js?load=effects\"></script>
<script type=\"text/javascript\" src=\"".$urlmst."lightwindow/javascript/lightwindow.js\"></script>
<link rel=\"stylesheet\" href=\"".$urlmst."lightwindow/css/lightwindow.css\" type=\"text/css\" media=\"screen\" />";
echo "<a params=\"lightwindow_width=$large\" class=\"lightwindow\" href=\"$url\" title=\"$title\">$text</a>";
}
}
?>
Le 27/05/2010 par Patrice Diliakou (DiliaK) :
J'ai déplacé la déclaration de la variable $urlmst au bon endroit.
Par contre, la session BOX est lue quoiqu'il arrive, même sur une page ne comportant pas de {{box}}. Cela entraine une lecture inutile du javascript. Cela dit, le code dans son entièreté fonctionne.