// PHPMyLinks version 0.1.4, Copyright (C) 2000, Rémi Henriot
// http://rhenriot.free.fr/phpmylinks/ - rhenriot@mail.com
//
// This is free software ; you can redistribute it and/or modify it
// under the terms of the PHPMyLinks License Version 1.0
// 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.
// For more details, see the license.txt file that you should have
// received with this program.
function cat_name($cat_id)
{
$res = mysql_query("select cat_nom from categorie where cat_id = $cat_id");
if($res)
{
$row = mysql_fetch_row($res);
echo $row[0];
}
else
echo "??? (cat_id = $cat_id)";
}
function sca_name($sca_id)
{
$res = mysql_query("select sca_nom from sous_categorie where sca_id = $sca_id");
if($res)
{
$row = mysql_fetch_row($res);
echo $row[0];
}
else
echo "??? (sca_id = $sca_id)";
}
function cat_name_from_sca($sca_id)
{
$res = mysql_query("select cat_id from sous_categorie where sca_id = $sca_id");
if($res)
{
$row = mysql_fetch_row($res);
echo cat_name($row[0]);
}
else
echo "??? (sca_id = $sca_id)";
}
function info_url($no, $url, $title, $descr, $keywords, $filing)
{
// prepend, if it's necessary 'http://' to the url
if(! ereg('http://', $url)) $url = 'http://'.$url;
// print the first items
echo "titre
";
echo "url ".
"
";
echo "description
";
echo "mots clés
";
// display filing information
echo "
\n";
filing_area($no_var, $filing, 'the_form', 'ch4_', $no);
echo "
\n";
}
function info_url_id($url_id)
{
// get and print main items
$req = 'select url.url_str, url.url_titre, url.url_descr '.
'from url, classement cla, sous_categorie sca, categorie cat '.
"where url.url_id = $url_id";
$res = mysql_query($req);
if($res)
{
$row = mysql_fetch_row($res);
echo "titre = $row[1]
";
echo "url = $row[0]
";
echo "description = $row[2]
";
}
else
echo "url = ??? (url_id = $url_id)
";
// display the keywords
$req = 'select cle.cle_mot from reference ref, mot_cle cle '.
"where ref.url_id = $url_id and ref.cle_id = cle.cle_id order by cle.cle_mot";
$res = mysql_query($req);
if($res)
{
echo 'mots clés =';
while($row = mysql_fetch_row($res)) echo " $row[0]";
echo '
';
}
// display filing information
$req = 'select cat.cat_nom, sca.sca_nom '.
'from url, classement cla, sous_categorie sca, categorie cat '.
'where url.url_id = cla.url_id '.
' and cla.sca_id = sca.sca_id '.
' and sca.cat_id = cat.cat_id '.
" and url.url_id = $url_id ".
'order by cat.cat_nom, sca.sca_nom';
$res = mysql_query($req);
if($res)
{
echo 'classement = ';
while($row = mysql_fetch_row($res))
echo "$row[0] / $row[1]
\n";
}
}
function exec_code_info_modif($no, $type, $objet, $ch1, $ch2, $ch3, $ch4, $ch5, $texte)
{
// type = A : Adding | M : Modification | S : deletion ('Suppression' in french)
// objet = C : Category | S : Sub-category | U : Url
switch($type.$objet)
{
case 'AC' :
echo "nom ";
break;
case 'MC' :
echo "avant :
";
echo "nom = ",cat_name($ch1),"
";
echo "après :
";
echo "";
echo "nom \n";
break;
case 'SC' :
echo "";
echo "nom = ",cat_name($ch1),"
\n";
break;
case 'AS' :
echo "catégorie
";
echo "nom \n";
break;
case 'MS' :
echo "avant :
";
echo "";
echo "catégorie = ",cat_name_from_sca($ch1),"
";
echo "sous-catégorie = ",sca_name($ch1),"
";
echo "après :
";
echo "catégorie
";
echo "nom \n";
break;
case 'SS' :
echo "";
echo "catégorie = ",cat_name_from_sca($ch1),"
";
echo "sous-catégorie = ",sca_name($ch1),"
\n";
break;
case 'AU' :
info_url($no, $ch1, $ch2, $texte, $ch3,$ch4);
break;
case 'MU' :
echo "avant :
";
info_url_id($ch5);
echo "après :
";
info_url($no, $ch1, $ch2, $texte, $ch3,$ch4);
break;
case 'SU' :
echo "";
info_url_id($ch1);
break;
}
}
?>