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/admin/gestnews.php

130 lines
5.2 KiB
PHP
Raw Normal View History

2023-04-30 21:28:42 +02:00
<html>
<head>
<title></title>
<meta content="">
<style></style>
</head>
<body>
<a href="gestnews.php">Charger</a> | <a href="gestnews.php?add=new">Nouveau</a><hr>
<?php
include "/home/n/website/include/standard.inc.php";
$confdir = "/home/n/website/backends/conf";
if (isset($f) && $f !="")
{
$param = parse_ini_file("$confdir/$f");
extract($param);
if (isset($Test) && $Test == "test")
{
$source = $fsource;
$titlesite = $ftitlesite;
$linksite = $flinksite;
$descriptionsite = $fdescriptionsite;
$languagesite = $flanguagesite;
$baseurl = $fbaseurl;
$grep = $fgrep;
}
else if (isset($Ecrire) && $Ecrire == "ecrire")
{
if ($fsource == "")
echo "<font color=red><b>source non d<>finie</b></font><br>";
else if ($fgrep == "")
echo "<font color=red><b>grep non d<>fini</b></font><br>";
else if ($f == "")
echo "<font color=red><b>filename non d<>fini</b></font><br>";
else
{
if (!file_exists("$confdir/$f"))
createfile("$confdir/$f");
$fp = fopen("$confdir/$f","w");
fwrite($fp,"source\t\t= \"$fsource\"\n");
fwrite($fp,"titlesite\t= \"$fsource\"\n");
fwrite($fp,"linksite\t= \"$flinksite\"\n");
fwrite($fp,"descriptionsite\t= \"$fdescriptionsite\"\n");
fwrite($fp,"languagesite\t= \"$flanguagesite\"\n");
fwrite($fp,"baseurl\t\t= \"$fbaseurl\"\n");
fwrite($fp,"grep\t\t= \"$fgrep\"");
fclose($fp);
}
}
// t<>l<EFBFBD>charge le fichier source
$data = implode("",file($source));
// le nettoie
$data = strtr($data,"\n\t\0\r"," ");
$data = trim($data);
echo "les champs marqu<71>s d'un * sont obligatoires.";
echo "<form action=\"$__SELF__\" method=\"put\">
<table border=0><tr><td nowrap>source*:</td><td><input name='fsource' type=text size=50 maxlenght=50 value='".$source."'></input></td></tr>
<tr><td nowrap>titlesite:</td><td><input name='ftitlesite' type=text size=50 maxlenght=50 value='".$titlesite."'></input></td></tr>
<tr><td nowrap>filename:</td><td>$filename</td></tr>
<tr><td nowrap>linksite:</td><td><input name='flinksite' type=text size=50 maxlenght=50 value='".$linksite."'></input></td></tr>
<tr><td nowrap>descriptionsite:</td><td><input name='fdescriptionsite' type=text size=50 maxlenght=50 value='".$descriptionsite."'></input></td></tr>
<tr><td nowrap>languagesite:</td><td><input name='flanguagesite' type=text size=2 maxlenght=2 value='".$languagesite."'></input></td></tr>
<tr><td nowrap>baseurl:</td><td><input name='fbaseurl' type=text size=50 maxlenght=50 value='".$baseurl."'></input></td></tr>
<tr><td nowrap>grep*:</td><td><input name='fgrep' type=text size=100 maxlenght=100 value='".$grep."'></input></td></tr>
<tr><td nowrap>offset:</td><td><input name='foffset' type=text size=3 maxlenght=3 value='".$offset."'></input></td></tr>
<tr><td><input name='f' type=hidden size=50 maxlenght=50 value='".$f."'></input></td></tr>
<tr><td></td><td><input name='Test' value='test' type=submit>
<input name='Defaut' value='d<>faut' type=submit>
<input name='Annuler' value='annuler' type=reset>
<input name='Ecrire' value='ecrire' type=submit></td></tr></table>
<br><hr><br>";
if (isset($source))
{
preg_match_all("'$grep'",$data,$res,PREG_SET_ORDER);
if ($offset == "")
$offset = 0;
$index = $offset;
while($res[$index][0] != "")
{
if ($res[$index][1] != "" && $res[$index][2] != "")
{
echo $res[$index][2]." (";
if (isset($baseurl) && !strchr($res[$index][1],"http://"))
echo $baseurl;
echo htmlspecialchars(trim(strtr($res[$index++][1],"\""," "))).")<br>\n";
}
}
}
}
else if (isset($add) && $add == "new")
{
echo "les champs marqu<71>s d'un * sont obligatoires.";
echo "<form action=\"$__SELF__\" method=\"put\">
<table border=0><tr><td nowrap>source*:</td><td><input name='fsource' type=text size=50 maxlenght=50></input></td></tr>
<tr><td nowrap>titlesite:</td><td><input name='ftitlesite' type=text size=50 maxlenght=50></input></td></tr>
<tr><td nowrap>filename*:</td><td><input name='f' type=text size=50 maxlenght=50></input></td></tr>
<tr><td nowrap>linksite:</td><td><input name='flinksite' type=text size=50 maxlenght=50></input></td></tr>
<tr><td nowrap>descriptionsite:</td><td><input name='fdescriptionsite' type=text size=50 maxlenght=50></input></td></tr>
<tr><td nowrap>languagesite:</td><td><input name='flanguagesite' type=text size=2 maxlenght=2></input></td></tr>
<tr><td nowrap>baseurl:</td><td><input name='fbaseurl' type=text size=50 maxlenght=50></input></td></tr>
<tr><td nowrap>grep*:</td><td><input name='fgrep' type=text size=100 maxlenght=100></input></td></tr>
<tr><td nowrap>offset:</td><td><input name='foffset' type=text size=3 maxlenght=3></input></td></tr>
<tr><td></td><td><input name='Test' value='test' type=submit>
<input name='Defaut' value='d<>faut' type=submit>
<input name='Annuler' value='annuler' type=reset>
<input name='Ecrire' value='ecrire' type=submit></td></tr></table>
<br><hr><br>";
}
else
{
$d = opendir("$confdir/");
while (false!==($file = readdir($d)))
if ($file[0] != ".")
echo "<li><a href=\"gestnews.php?f=$file\">".$file."</a>\n";
closedir($d);
}
?>
</body>
</html>