<?PHP
/************************************************************************/
/* DUNE by NPDS                                                         */
/* ===========================                                          */
/*                                                                      */
/* Based on PhpNuke 4.x source code                                     */
/*                                                                      */
/* NPDS Copyright (c) 2002-2007 by Philippe Brunier                     */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
function Access_Error () {
  include("admin/die.php");
}
if (!eregi("admin.php", $PHP_SELF)) { Access_Error(); }

global $language;
$hlpfile = "manuels/$language/authors.html";
$result = sql_query("select radminsuper from ".$NPDS_Prefix."authors where aid='$aid'");
list($radminsuper) = sql_fetch_row($result);
if ($radminsuper!=1) {
   Access_Error();
}

function displayadmins() {
    global $hlpfile, $NPDS_Prefix;

    $titlebar = "<b>".adm_translate("Auteurs actuels")."</b>";
    include("header.php");
    GraphicAdmin($hlpfile);
    opentable();
    echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">";
    echo adm_translate("Editer les Administrateurs");
    echo "</td></tr></table>\n";
    echo "<br />";
    $result = sql_query("select aid, name from ".$NPDS_Prefix."authors");
    echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">";
    echo "<tr><td class=\"ongl\" colspan=\"3\">".adm_translate("Nom")." : </td></tr>";
    while(list($a_aid, $name) = sql_fetch_row($result)) {
       $rowcolor = tablos();
       echo "<tr $rowcolor><td width=\"70%\">$a_aid</td>";
       echo "<td align=\"right\" nowrap=\"nowrap\"><a href=\"admin.php?op=modifyadmin&amp;chng_aid=$a_aid\" class=\"noir\">".adm_translate("Modifier l'information")."</a>";
       echo " | <a href=\"admin.php?op=deladmin&amp;del_aid=$a_aid\" class=\"rouge\">".adm_translate("Effacer l'Auteur")."</a></td></tr>";
    }
    echo "</table><br />";
    echo "<form action=\"admin.php\" method=\"post\">";
    echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">";
    echo "<tr><td>".adm_translate("Surnom")." <span class=\"rouge\">*</span></td>";
    echo "<td><input class=\"textbox\" type=\"text\" name=\"add_aid\" size=\"30\" maxlength=\"30\"></td></tr>";
    echo "<tr><td>".adm_translate("Nom")." <span class=\"rouge\">*</span></td>";
    echo "<td><input class=\"textbox\" type=\"text\" name=\"add_name\" size=\"30\" maxlength=\"50\"></td></tr>";
    echo "<tr><td>".adm_translate("E-mail")." <span class=\"rouge\">*</span></td>";
    echo "<td><input class=\"textbox\" type=\"text\" name=\"add_email\" size=\"30\" maxlength=\"60\"></td></tr>";
    echo "<tr><td>".adm_translate("URL")."</td>";
    echo "<td><input class=\"textbox\" type=\"text\" name=\"add_url\" size=\"30\" maxlength=\"60\"></td></tr>";
    echo "<tr><td>".adm_translate("Actif(s)")."</td><td>";

    echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"1\" width=\"100%\">";
    echo "<tr class=\"textbox_standard\">";
    echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"add_radminarticle\" value=\"1\"></td>";
    echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"add_radmintopic\" value=\"1\"></td>";
    echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"add_radminsection\" value=\"1\"></td>";
    echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"add_radminleft\" value=\"1\"></td>";
    echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"add_radminmain\" value=\"1\"></td>";
    echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"add_radminright\" value=\"1\"></td>";
    echo "</tr><tr class=\"header\">";
    echo "<td align=\"center\">".adm_translate("Articles")."</td>";
    echo "<td align=\"center\">".adm_translate("Sujet")."</td>";
    echo "<td align=\"center\">".adm_translate("Rubriques")."</td>";
    echo "<td align=\"center\">".adm_translate("Edition des Blocs de gauche")."</td>";
    echo "<td align=\"center\">".adm_translate("Bloc Principal")."</td>";
    echo "<td align=\"center\">".adm_translate("Edition des Blocs de droite")."</td>";
    echo "</tr><tr class=\"textbox_standard\">";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminuser\" value=\"1\"></td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminsurvey\" value=\"1\"></td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminlink\" value=\"1\"></td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminfaq\" value=\"1\"></td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radmindownload\" value=\"1\"></td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminfilem\" value=\"1\"></td>";
    echo "</tr><tr class=\"header\">";
    echo "<td align=\"center\">".adm_translate("Edition des Utilisateurs")."</td>";
    echo "<td align=\"center\">".adm_translate("Sondage")."s</td>";
    echo "<td align=\"center\">".adm_translate("Liens Web")."</td>";
    echo "<td align=\"center\">".adm_translate("Faq")."</td>";
    echo "<td align=\"center\">".adm_translate("Téléchargement")."</td>";
    echo "<td align=\"center\">".adm_translate("Gestionnaire de Fichiers")."</td>";
    echo "</tr><tr class=\"textbox_standard\">";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminhead\" value=\"1\"></td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminephem\" value=\"1\"></td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminreviews\" value=\"1\"></td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminforum\" value=\"1\"></td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminsdv\" value=\"1\"></td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminlnl\" value=\"1\"></td>";
    echo "</tr><tr class=\"header\">";
    echo "<td align=\"center\">".adm_translate("Grands Titres de sites de News")."</td>";
    echo "<td align=\"center\">".adm_translate("Ephémérides")."</td>";
    echo "<td align=\"center\">".adm_translate("Critiques")."</td>";
    echo "<td align=\"center\">".adm_translate("Edition des Forums")."</td>";
    echo "<td align=\"center\">".adm_translate("Gestion des groupes")."</td>";
    echo "<td align=\"center\">".adm_translate("La Lettre")."</td>";
    echo "</tr><tr class=\"textbox_standard\">";
    echo "<td align=\"center\">&nbsp;</td>";
    echo "<td align=\"center\">&nbsp;</td>";
    echo "<td align=\"center\">&nbsp;</td>";
    echo "<td align=\"center\">&nbsp;</td>";
    echo "<td align=\"center\">&nbsp;</td>";
    echo "<td align=\"center\"><input type=\"checkbox\" name=\"add_radminsuper\" value=\"1\"></td>";
    echo "</tr><tr class=\"header\">";
    echo "<td align=\"center\">&nbsp;</td>";
    echo "<td align=\"center\">&nbsp;</td>";
    echo "<td align=\"center\">&nbsp;</td>";
    echo "<td align=\"center\">&nbsp;</td>";
    echo "<td align=\"center\">&nbsp;</td>";
    echo "<td align=\"center\" class=\"rouge\">".adm_translate("Super Utilisateur")."</td>";
    echo "</tr>";
    echo "</table>";
    echo "</td></tr>";
    echo "<tr><td>&nbsp;</td><td colspan=\"2\">".adm_translate("Si <b>Super Utilisateur</b> est coché, l'Utilisateur aura TOUS les Droits.")."</td></tr>";
    echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
    echo "<tr><td nowrap=\"nowrap\">".adm_translate("Mot de Passe")." <span class=\"rouge\">*</span></td>";
    echo "<td><input class=\"textbox_standard\" type=\"password\" name=\"add_pwd\" size=\"12\" maxlength=\"12\"> - ";
    echo "<input type=\"hidden\" name=\"op\" value=\"AddAuthor\">";
    echo "<input class=\"bouton_standard\" type=\"submit\" value=\"".adm_translate(" Ajouter un Auteur ")."\"></td></tr>";
    echo "</table></form>";
    echo "<p align=\"center\" class=\"rouge\">".adm_translate("* indique les champs requis")."</p><br />";
    closetable();
    include("footer.php");
}

function modifyadmin($chng_aid) {
    global $hlpfile, $aid, $NPDS_Prefix;

    $titlebar = "<b>".adm_translate("mise à jour")." $chng_aid</b>";
    include("header.php");
    GraphicAdmin($hlpfile);
    opentable();
    echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">";
    echo adm_translate("mise à jour")." : $chng_aid";
    echo "</td></tr></table>\n";
    echo "<br />";
    $result = sql_query("select aid, name, url, email, pwd, radminarticle,radmintopic,radminleft,radminright,radminuser,radminmain,radminsurvey,radminsection,radminlink,radminephem,radminfilem,radminhead,radminfaq,radmindownload,radminforum,radminreviews,radminsdv,radminlnl,radminsuper from ".$NPDS_Prefix."authors where aid='$chng_aid'");
    list($chng_aid, $chng_name, $chng_url, $chng_email, $chng_pwd, $chng_radminarticle, $chng_radmintopic, $chng_radminleft, $chng_radminright, $chng_radminuser, $chng_radminmain, $chng_radminsurvey, $chng_radminsection, $chng_radminlink, $chng_radminephem, $chng_radminfilem, $chng_radminhead, $chng_radminfaq, $chng_radmindownload, $chng_radminforum, $chng_radminreviews, $chng_radminsdv, $chng_radminlnl, $chng_radminsuper) = sql_fetch_row($result);

    $result = sql_query("select radminsuper from ".$NPDS_Prefix."authors where aid='$aid'");
    list($radminsuper) = sql_fetch_row($result);
    if ($radminsuper == 1) {
       echo "<form action=\"admin.php\" method=\"post\">";
       echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">";
       echo "<tr><td>".adm_translate("Nom")."</td>";
       echo "<td>$chng_aid<input type=\"hidden\" name=\"chng_aid\" value=\"$chng_aid\"></td></tr>\n";
       echo "<tr><td>".adm_translate("Surnom")." <span class=\"rouge\">*</span></td>";
       echo "<td><input class=\"textbox\" type=\"text\" name=\"chng_name\" value=\"$chng_name\" size=\"30\" maxlength=\"30\"></td></tr>\n";
       echo "<tr><td>".adm_translate("E-mail")." <span class=\"rouge\">*</span></td>";
       echo "<td><input class=\"textbox\" type=\"text\" name=\"chng_email\" value=\"$chng_email\" size=\"30\" maxlength=\"60\"></td></tr>\n";
       echo "<tr><td>".adm_translate("URL")."</td>";
       echo "<td><input class=\"textbox\" type=\"text\" name=\"chng_url\" value=\"$chng_url\" size=\"30\" maxlength=\"60\"></td></tr>\n";
       echo "<tr><td>".adm_translate("Actif(s)")."</td><td>";
       echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"1\">";
       echo "<tr class=\"textbox_standard\">";
       if ($chng_radminarticle == 1) {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radminarticle\" value=\"1\" checked></td>";
       } else {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radminarticle\" value=\"1\"></td>";
       }
       if ($chng_radmintopic == 1) {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radmintopic\" value=\"1\" checked></td>";
       } else {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radmintopic\" value=\"1\"></td>";
       }
       if ($chng_radminsection == 1) {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radminsection\" value=\"1\" checked></td>";
       } else {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radminsection\" value=\"1\"></td>";
       }
       if ($chng_radminleft == 1) {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radminleft\" value=\"1\" checked></td>";
       } else {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radminleft\" value=\"1\"></td>";
       }
       if ($chng_radminmain == 1) {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radminmain\" value=\"1\" checked></td>";
       } else {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radminmain\" value=\"1\"></td>";
       }
       if ($chng_radminright == 1) {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radminright\" value=\"1\" checked></td>";
       } else {
          echo "<td align=\"center\" width=\"15%\"><input type=\"checkbox\" name=\"chng_radminright\" value=\"1\"></td>";
       }
       echo "</tr><tr class=\"header\">\n";
       echo "<td align=\"center\">".adm_translate("Articles")."</td>";
       echo "<td align=\"center\">".adm_translate("Sujet")."</td>";
       echo "<td align=\"center\">".adm_translate("Rubriques")."</td>";
       echo "<td align=\"center\">".adm_translate("Edition des Blocs de gauche")."</td>";
       echo "<td align=\"center\">".adm_translate("Bloc Principal")."</td>";
       echo "<td align=\"center\">".adm_translate("Edition des Blocs de droite")."</td>";
       echo "</tr>\n<tr class=\"textbox_standard\">";
      if ($chng_radminuser == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminuser\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminuser\" value=\"1\"></td>";
      }
      if ($chng_radminsurvey == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminsurvey\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminsurvey\" value=\"1\"></td>";
      }
      if ($chng_radminlink == 1) {
         echo "<td  align=\"center\"><input type=\"checkbox\" name=\"chng_radminlink\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminlink\" value=\"1\"></td>";
      }
      if ($chng_radminfaq == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminfaq\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminfaq\" value=\"1\"></td>";
      }
      if ($chng_radmindownload == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radmindownload\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radmindownload\" value=\"1\"></td>";
      }
      if ($chng_radminfilem == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminfilem\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminfilem\" value=\"1\"></td>";
      }
      echo "</tr>\n<tr class=\"header\">";
      echo "<td align=\"center\">".adm_translate("Edition des Utilisateurs")."</td>";
      echo "<td align=\"center\">".adm_translate("Sondage")."s</td>";
      echo "<td align=\"center\">".adm_translate("Liens Web")."</td>";
      echo "<td align=\"center\">".adm_translate("Faq")."</td>";
      echo "<td align=\"center\">".adm_translate("Téléchargement")."</td>";
      echo "<td align=\"center\">".adm_translate("Gestionnaire de Fichiers")."</td>";
      echo "</tr>\n<tr class=\"textbox_standard\">";
      if ($chng_radminhead == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminhead\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminhead\" value=\"1\"></td>";
      }
      if ($chng_radminephem == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminephem\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminephem\" value=\"1\"></td>";
      }
      if ($chng_radminreviews == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminreviews\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminreviews\" value=\"1\"></td>";
      }
      if ($chng_radminforum == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminforum\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminforum\" value=\"1\"></td>";
      }
      if ($chng_radminsdv == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminsdv\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminsdv\" value=\"1\"></td>";
      }
      if ($chng_radminlnl == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminlnl\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminlnl\" value=\"1\"></td>";
      }
      echo "</tr>\n<tr class=\"header\">";
      echo "<td align=\"center\">".adm_translate("Grands Titres de sites de News")."</td>";
      echo "<td align=\"center\">".adm_translate("Ephémérides")."</td>";
      echo "<td align=\"center\">".adm_translate("Critiques")."</td>";
      echo "<td align=\"center\">".adm_translate("Edition des Forums")."</td>";
      echo "<td align=\"center\">".adm_translate("Gestion des groupes")."</td>";
      echo "<td align=\"center\">".adm_translate("La Lettre")."</td>";
      echo "</tr>\n<tr class=\"textbox_standard\">";
      echo "<td align=\"center\">&nbsp;</td>";
      echo "<td align=\"center\">&nbsp;</td>";
      echo "<td align=\"center\">&nbsp;</td>";
      echo "<td align=\"center\">&nbsp;</td>";
      echo "<td align=\"center\">&nbsp;</td>";
      if ($chng_radminsuper == 1) {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminsuper\" value=\"1\" checked></td>";
      } else {
         echo "<td align=\"center\"><input type=\"checkbox\" name=\"chng_radminsuper\" value=\"1\"></td>";
      }
      echo "</tr>\n<tr class=\"header\">";
      echo "<td align=\"center\">&nbsp;</td>";
      echo "<td align=\"center\">&nbsp;</td>";
      echo "<td align=\"center\">&nbsp;</td>";
      echo "<td align=\"center\">&nbsp;</td>";
      echo "<td align=\"center\">&nbsp;</td>";
      echo "<td align=\"center\" class=\"rouge\">".adm_translate("Super Utilisateur")."</td>";
      echo "</tr>";
      echo "</table>\n";
      echo "</td></tr>\n";
      echo "<tr><td>&nbsp;</td><td colspan=\"2\">".adm_translate("Si <b>Super Utilisateur</b> est coché, l'Utilisateur aura TOUS les Droits.")."</td></tr>";
      echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
      echo "<tr><td>".adm_translate("Mot de Passe")."</td>";
      echo "<td><input class=\"textbox_standard\" type=\"password\" name=\"chng_pwd\" size=\"12\" maxlength=\"12\">";
      echo "</td></tr>\n";
      echo "<tr><td width=\"15%\">".adm_translate("Entrez à nouveau votre Mot de Passe")."</td>";
      echo "<td><input class=\"textbox_standard\" type=\"password\" name=\"chng_pwd2\" size=\"12\" maxlength=\"12\"> ".adm_translate("(seulement pour modifications)")."</td></tr>";
      echo "<input type=\"hidden\" name=\"op\" value=\"UpdateAuthor\">";
      echo "<tr><td colspan=\"2\"><input class=\"bouton_standard\" type=\"submit\" value=\"".adm_translate(" Actualiser l'Auteur")."\"></td></tr>\n";
      echo "</table></form>";
    }
    echo "<p align=\"center\" class=\"rouge\">".adm_translate("* indique les champs requis")."</p>\n";
    closetable();
    include("footer.php");
}

function updateadmin($chng_aid, $chng_name, $chng_email, $chng_url, $chng_radminarticle, $chng_radmintopic, $chng_radminleft, $chng_radminright, $chng_radminuser, $chng_radminmain, $chng_radminsurvey, $chng_radminsection, $chng_radminlink, $chng_radminephem, $chng_radminfilem, $chng_radminhead, $chng_radminfaq, $chng_radmindownload, $chng_radminforum, $chng_radminreviews, $chng_radminsdv, $chng_radminlnl, $chng_radminsuper, $chng_pwd, $chng_pwd2, $temp_system_md5) {
    global $NPDS_Prefix;

    if (!($chng_aid && $chng_name && $chng_email))
       Header("Location: admin.php?op=mod_authors");

    // Gesion du fichier pour filemanager
    $result=sql_query("select radminfilem,radminsuper from ".$NPDS_Prefix."authors where aid='$chng_aid'");
    list($ori_radminfilem, $ori_radminsuper) = sql_fetch_row($result);
    if ($ori_radminsuper and !$chng_radminsuper)
       @unlink("modules/f-manager/users/".strtolower($chng_aid).".conf.php");
    if (!$ori_radminsuper and $chng_radminsuper)
       @copy("modules/f-manager/users/modele.admin.conf.php","modules/f-manager/users/".strtolower($chng_aid).".conf.php");

    if ($ori_radminfilem and !$chng_radminfilem)
       @unlink("modules/f-manager/users/".strtolower($chng_aid).".conf.php");
    if (!$ori_radminfilem and $chng_radminfilem)
       @copy("modules/f-manager/users/modele.admin.conf.php","modules/f-manager/users/".strtolower($chng_aid).".conf.php");

    if ($chng_pwd2 != "") {
       if($chng_pwd != $chng_pwd2) {
          $titlebar = "<b>".adm_translate("Mauvais Mot de Passe")."</b>";
          global $hlpfile;
          include("header.php");
          GraphicAdmin($hlpfile);
          echo error_handler(adm_translate("Désolé, les nouveaux Mots de Passe ne correspondent pas. Cliquez sur retour et recommencez")."<br />");
          include("footer.php");
          exit;
       }
       global $system_md5;
       if (($system_md5) or ($temp_system_md5)) {
          $chng_pwd=crypt($chng_pwd2,$chng_pwd);
       }
       if ($chng_radminsuper==1) {
          $result = sql_query("update ".$NPDS_Prefix."authors set name='$chng_name', email='$chng_email', url='$chng_url', radminarticle='0', radmintopic='0', radminleft='0', radminright='0', radminuser='0', radminmain='0', radminsurvey='0', radminsection='0', radminlink='0', radminephem='0', radminfilem='0', radminhead='0', radminfaq='0', radmindownload='0', radminforum='0', radminreviews='0', radminsdv='0', radminlnl='0', radminsuper='$chng_radminsuper', pwd='$chng_pwd' where aid='$chng_aid'");
       } else {
          $result = sql_query("update ".$NPDS_Prefix."authors set name='$chng_name', email='$chng_email', url='$chng_url', radminarticle='$chng_radminarticle', radmintopic='$chng_radmintopic', radminleft='$chng_radminleft', radminright='$chng_radminright', radminuser='$chng_radminuser', radminmain='$chng_radminmain', radminsurvey='$chng_radminsurvey', radminsection='$chng_radminsection', radminlink='$chng_radminlink', radminephem='$chng_radminephem', radminfilem='$chng_radminfilem', radminhead='$chng_radminhead', radminfaq='$chng_radminfaq', radmindownload='$chng_radmindownload', radminforum='$chng_radminforum', radminreviews='$chng_radminreviews', radminsdv='$chng_radminsdv', radminlnl='$chng_radminlnl', radminsuper='0', pwd='$chng_pwd' where aid='$chng_aid'");
       }
    } else {
       if ($chng_radminsuper==1) {
          $result = sql_query("update ".$NPDS_Prefix."authors set name='$chng_name', email='$chng_email', url='$chng_url', radminarticle='0', radmintopic='0', radminleft='0', radminright='0', radminuser='0', radminmain='0', radminsurvey='0', radminsection='0', radminlink='0', radminephem='0', radminfilem='0', radminhead='0', radminfaq='0', radmindownload='0', radminforum='0', radminreviews='0', radminsdv='0', radminlnl='0', radminsuper='$chng_radminsuper' where aid='$chng_aid'");
       } else {
          $result = sql_query("update ".$NPDS_Prefix."authors set name='$chng_name', email='$chng_email', url='$chng_url', radminarticle='$chng_radminarticle', radmintopic='$chng_radmintopic', radminleft='$chng_radminleft', radminright='$chng_radminright', radminuser='$chng_radminuser', radminmain='$chng_radminmain', radminsurvey='$chng_radminsurvey', radminsection='$chng_radminsection', radminlink='$chng_radminlink', radminephem='$chng_radminephem', radminfilem='$chng_radminfilem', radminhead='$chng_radminhead', radminfaq='$chng_radminfaq', radmindownload='$chng_radmindownload', radminforum='$chng_radminforum', radminreviews='$chng_radminreviews', radminsdv='$chng_radminsdv', radminlnl='$chng_radminlnl', radminsuper='0' where aid='$chng_aid'");
       }
    }
    Header("Location: admin.php?op=mod_authors");
}

function error_handler($ibid) {
   opentable();
   echo "<p align=\"center\">".adm_translate("Merci d'entrer l'information en fonction des spécifications")."<br /><br />";
   echo "$ibid<br /><a href=\"admin.php?op=mod_authors\" class=\"noir\">".adm_translate("Retour en arrière")."</a></p>";
   closetable();
}

switch ($op) {
   case "mod_authors":
        displayadmins();
        break;

   case "modifyadmin":
        modifyadmin($chng_aid);
        break;

   case "UpdateAuthor":
        updateadmin($chng_aid, $chng_name, $chng_email, $chng_url, $chng_radminarticle, $chng_radmintopic, $chng_radminleft, $chng_radminright, $chng_radminuser, $chng_radminmain, $chng_radminsurvey, $chng_radminsection, $chng_radminlink, $chng_radminephem, $chng_radminfilem, $chng_radminhead, $chng_radminfaq, $chng_radmindownload, $chng_radminforum, $chng_radminreviews, $chng_radminsdv, $chng_radminlnl, $chng_radminsuper, $chng_pwd, $chng_pwd2, $temp_system_md5);
        break;

   case "AddAuthor":
        if (!($add_aid && $add_name && $add_email && $add_pwd)) {
           global $hlpfile;
           include("header.php");
           GraphicAdmin($hlpfile);
           echo error_handler(adm_translate("Vous devez remplir tous les Champs")."<br />");
           include("footer.php");
           return;
        }
        if ($system_md5) {
           $add_pwdX=crypt($add_pwd,$add_pwdX);
        }
        $result = sql_query("insert into ".$NPDS_Prefix."authors values ('$add_aid', '$add_name', '$add_url', '$add_email', '$add_pwdX', '0', '$add_radminarticle','$add_radmintopic','$add_radminleft','$add_radminright','$add_radminuser','$add_radminmain','$add_radminsurvey','$add_radminsection','$add_radminlink','$add_radminephem','$add_radminfilem','$add_radminhead', '$add_radminfaq', '$add_radmindownload', '$add_radminforum', '$add_radminreviews', '$add_radminsdv','$add_radminlnl', '$add_radminsuper')");

        // Copie du fichier pour filemanager
        if ($add_radminsuper or $add_radminfilem)
           @copy("modules/f-manager/users/modele.admin.conf.php","modules/f-manager/users/".strtolower($add_aid).".conf.php");

        Header("Location: admin.php?op=mod_authors");
        break;

   case "deladmin":
        global $hlpfile;
        include("header.php");
        GraphicAdmin($hlpfile);
        opentable();
        echo "<p align=\"center\"><b>".adm_translate("Effacer l'Auteur")."</b> : ";
        echo "<span class=\"rouge\">".adm_translate("Etes-vous sûr de vouloir effacer")." $del_aid ? </span><br /><br />";
        echo "[ <a href=\"admin.php?op=deladminconf&amp;del_aid=$del_aid\" class=\"rouge\">".adm_translate("Oui")."</a>&nbsp;|&nbsp;<a href=\"admin.php?op=mod_authors\" class=\"noir\">".adm_translate("Non")."</a> ]</p>";
        closetable();
        include("footer.php");
        break;

   case "deladminconf":
        sql_query("delete from ".$NPDS_Prefix."authors where aid='$del_aid'");

        // Supression du fichier pour filemanager
        @unlink("modules/f-manager/users/".strtolower($del_aid).".conf.php");

        Header("Location: admin.php?op=mod_authors");
        break;
}
?>