n/oldblog
Archived
1
0
Fork 0
This repository has been archived on 2024-02-13. You can view files and clone it, but cannot push or open issues or pull requests.
oldblog/modules/liens.php

112 lines
2.5 KiB
PHP
Raw Permalink Normal View History

2023-04-30 21:28:42 +02:00
<?php
/*
Name: liens.php
Author: NicoSoft
Cr<EFBFBD>ation: 14/08/01
MAJ : 04/02/04
*/
$Cpt = 0;
// si le fichier n'existe pas, on le cr<63>e:
if (!(file_exists($FileName)))
{
$fp = fopen($FileName,"w+");
fclose($fp);
}
$fp = fopen($FileName,"r");
while ($data = fgetcsv($fp, 1000, ","))
{
if ($data[0][0] != "#")
{
$level[$Cpt] = $data[0];
$linkname[$Cpt] = stripcslashes($data[1]);
$url[$Cpt] = stripcslashes($data[2]);
$url[$Cpt] = ereg_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'<27>l<EFBFBD>ments, on l'ajuste <20> ce nombre
if ((!isset($NbMaxPost)) || ($NbMaxPost > $Cpt))
{
$NbMaxPost = $Cpt;
}
include "include/theme.inc.php";
if ($Cpt <= 0)
{
echo "\n<b>Aucun lien pour l'instant</b>\n<br />\n";
}
else
{
// affichage d'une liste d<>roulante
if (isset($TypeListe) && ($TypeListe == "deroul"))
{
echo " <div align='center'>\n <br />\n <form action='modules/redirect.php' method='post' target='_blank'><fieldset>";
?>
<?php
echo " <select name='ListeLiens'>\n";
for($i=0;$i<=$NbMaxPost-1;$i++)
{
echo " <option value='$url[$i]'>$linkname[$i]</option>\n";
}
echo " </select>\n <br /><br />\n <input type='submit' value='Go!' class='boutton' />\n </fieldset></form>\n </div>\n";
}
else
{
// affichage des liens
for($i=0;$i<=$NbMaxPost-1;$i++)
{
// liens niveau 1: gras
if ($level[$i] == 1)
{
echo "<b>";
if ($url[$i] != "")
{
echo "<a href='".$url[$i]."'";
if ($target[$i] != "")
echo " target=\"$target[$i]\"";
echo ">".$linkname[$i]."</a>";
}
else echo $linkname[$i];
echo "</b><br />\n";
}
else
// liens normaux
{
//echo "&nbsp;&nbsp;";
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";
}
}
}
}
unset($FileName);
unset($NbMaxPost);
?>