102 lines
2.3 KiB
PHP
102 lines
2.3 KiB
PHP
|
<?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:
|
||
|
if (!(file_exists($FileName)))
|
||
|
{
|
||
|
$fp = fopen($FileName,"w+");
|
||
|
fclose($fp);
|
||
|
}
|
||
|
|
||
|
$fp = fopen($FileName,"r");
|
||
|
|
||
|
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++;
|
||
|
}
|
||
|
|
||
|
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
|
||
|
if ((!isset($NbMaxPost)) || ($NbMaxPost > $Cpt))
|
||
|
{
|
||
|
$NbMaxPost = $Cpt;
|
||
|
}
|
||
|
|
||
|
include "include/theme.inc.php";
|
||
|
|
||
|
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\">";
|
||
|
?>
|
||
|
|
||
|
<?php
|
||
|
echo "<select name='ListeLiens'>";
|
||
|
for($i=0;$i<=$NbMaxPost-1;$i++)
|
||
|
{
|
||
|
echo "<option value='$url[$i]'>$linkname[$i]</option>\n";
|
||
|
}
|
||
|
|
||
|
echo "</select><br /><br /><input type='submit' value='Go!'></form></div>";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
// affichage des liens
|
||
|
echo "<div class='left'>";
|
||
|
for($i=0;$i<=$NbMaxPost-1;$i++)
|
||
|
{
|
||
|
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];
|
||
|
echo "<br />\n";
|
||
|
}
|
||
|
}
|
||
|
echo "</div>";
|
||
|
}
|
||
|
}
|
||
|
unset($FileName);
|
||
|
unset($NbMaxPost);
|
||
|
|
||
|
?>
|