2020-11-29 11:25:34 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
Name: liens.php
|
|
|
|
Author: NicoSoft
|
|
|
|
Création: 14/08/01
|
|
|
|
MAJ : 04/02/04
|
|
|
|
*/
|
|
|
|
|
|
|
|
$Cpt = 0;
|
|
|
|
|
|
|
|
// si le fichier n'existe pas, on le crée:
|
2024-02-12 20:46:07 +01:00
|
|
|
if (!(file_exists($FileName))) {
|
|
|
|
$fp = fopen($FileName, "w+");
|
|
|
|
fclose($fp);
|
2020-11-29 11:25:34 +01:00
|
|
|
}
|
|
|
|
|
2024-02-12 20:46:07 +01:00
|
|
|
$fp = fopen($FileName, "r");
|
2020-11-29 11:25:34 +01:00
|
|
|
|
2024-02-12 20:46:07 +01:00
|
|
|
while ($data = fgetcsv($fp, 1000, ",")) {
|
|
|
|
$level[$Cpt] = $data[0];
|
|
|
|
$linkname[$Cpt] = stripcslashes($data[1]);
|
|
|
|
$url[$Cpt] = stripcslashes($data[2]);
|
|
|
|
$url[$Cpt] = preg_replace("/THEME_COURANT/", $theme, $url[$Cpt]);
|
|
|
|
$comment[$Cpt] = stripcslashes($data[3]);
|
|
|
|
$target[$Cpt] = stripcslashes($data[4]);
|
|
|
|
$Cpt++;
|
2020-11-29 11:25:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fclose($fp);
|
|
|
|
|
|
|
|
// si $NbMaxPost n'est pas défini, ou si il est plus grand que le nombre d'éléments, on l'ajuste à ce nombre
|
2024-02-12 20:46:07 +01:00
|
|
|
if ((!isset($NbMaxPost)) || ($NbMaxPost > $Cpt)) {
|
|
|
|
$NbMaxPost = $Cpt;
|
2020-11-29 11:25:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
include "include/theme.inc.php";
|
|
|
|
|
2024-02-12 20:46:07 +01:00
|
|
|
if ($Cpt <= 0) {
|
|
|
|
echo "<b>Aucun lien pour l'instant</b><br />";
|
|
|
|
} else {
|
|
|
|
if (isset($TypeListe) && ($TypeListe == "deroul")) {
|
|
|
|
echo "<div class='center'><br /><form action='modules/redirect.php' method='get' target=\"_blank\">";
|
|
|
|
?>
|
2020-11-29 11:25:34 +01:00
|
|
|
|
|
|
|
<?php
|
2024-02-12 20:46:07 +01:00
|
|
|
echo "<select name='ListeLiens'>";
|
2024-09-14 21:20:01 +02:00
|
|
|
for ($i = 0;$i <= $NbMaxPost - 1;$i++) {
|
2024-02-12 20:46:07 +01:00
|
|
|
echo "<option value='$url[$i]'>$linkname[$i]</option>\n";
|
2020-11-29 11:25:34 +01:00
|
|
|
}
|
2024-02-12 20:46:07 +01:00
|
|
|
|
|
|
|
echo "</select><br /><br /><input type='submit' value='Go!'></form></div>";
|
|
|
|
} else {
|
2020-11-29 11:25:34 +01:00
|
|
|
// affichage des liens
|
2024-02-12 20:46:07 +01:00
|
|
|
echo "<div class='left'>";
|
2024-09-14 21:20:01 +02:00
|
|
|
for ($i = 0;$i <= $NbMaxPost - 1;$i++) {
|
2024-02-12 20:46:07 +01:00
|
|
|
if ($level[$i] == 1) {
|
|
|
|
echo "<b>";
|
|
|
|
if ($url[$i] != "") {
|
|
|
|
echo "<a href='".$url[$i]."' title='".$comment[$i]."'";
|
|
|
|
if ($target[$i] != "") {
|
|
|
|
echo " target=\"$target[$i]\"";
|
|
|
|
}
|
|
|
|
echo ">".$linkname[$i]."</a>";
|
|
|
|
} else {
|
|
|
|
echo $linkname[$i];
|
|
|
|
}
|
|
|
|
echo "</b><br />\n";
|
|
|
|
} else {
|
|
|
|
echo " ";
|
|
|
|
if ($url[$i] != "") {
|
|
|
|
echo "<a href='".$url[$i]."' title='".$comment[$i]."' ";
|
|
|
|
if ($target[$i] != "") {
|
|
|
|
echo " target=\"$target[$i]\"";
|
|
|
|
}
|
|
|
|
echo ">".$linkname[$i]."</a>";
|
|
|
|
} else {
|
|
|
|
echo $linkname[$i];
|
2020-11-29 11:25:34 +01:00
|
|
|
}
|
2024-02-12 20:46:07 +01:00
|
|
|
echo "<br />\n";
|
|
|
|
}
|
2020-11-29 11:25:34 +01:00
|
|
|
}
|
2024-02-12 20:46:07 +01:00
|
|
|
echo "</div>";
|
|
|
|
}
|
2020-11-29 11:25:34 +01:00
|
|
|
}
|
|
|
|
unset($FileName);
|
|
|
|
unset($NbMaxPost);
|
|
|
|
|
2024-02-12 20:46:07 +01:00
|
|
|
?>
|