<?PHP
/************************************************************************/
/* NPDS V : Net Portal Dynamic System .                                 */
/* ===========================                                          */
/*                                                                      */
/* Original Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)   */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This version name NPDS Copyright (c) 2001-2005 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 () {
  if (file_exists("meta/meta.php"))
     include ("meta/meta.php");
  echo "<title>NPDS</title></head><body bgcolor=\"white\"><br /><p align=\"center\"><span style=\"font-size: 14px; font-family: Arial; font-weight: bold; color: red;\">";
  echo "Access Denied / Acc&egrave;s Refus&eacute;";
  if (cur_charset=="utf-8") echo" / &#x901A;&#x5165;&#x88AB;&#x5426;&#x8BA4;";
  echo "</span>";
  echo "<br /><br /><span style=\"font-size: 12px; font-family: Arial; font-weight: bold; color: black;\">NPDS - Portal System";
  echo "</span></p></body></html>";
  die();
}
if (!eregi("admin.php", $PHP_SELF)) { Access_Error(); }
global $pdst; $pdst="0";

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

function ablock() {
   global $hlpfile;
   include("header.php");
   GraphicAdmin($hlpfile);
   OpenTable();
   echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"HEADER\">\n";
   echo adm_translate("Editer le Bloc Administration");
   echo "</td></tr></table>\n";
   echo "<br />";
   $result = mysql_query("select title, content from adminblock");
   if (mysql_num_rows($result) > 0) {
      while (list($title, $content) = mysql_fetch_array($result)) {
         echo "<form action=\"admin.php\" method=\"post\">";
         echo adm_translate("Titre :");
         echo "<br /><input class=\"textbox\" type=\"text\" name=\"title\" size=\"60\" maxlength=\"250\" value=\"$title\"><br /><br />";
         echo adm_translate("Contenu :");
         echo "<br /><textarea class=\"textbox\" cols=\"45\" rows=\"25\" name=\"content\">$content</textarea><br /><br />";
         echo "<input type=\"hidden\" name=\"op\" value=\"changeablock\">";
         echo "<input class=\"BOUTON_STANDARD\" type=\"submit\" value=\"".adm_translate("Valider")."\">";
         echo "</form>";
      }
   }
   closetable();
   include("footer.php");
}

function changeablock($title, $content) {
   $title = stripslashes(FixQuotes($title));
   $content = stripslashes(FixQuotes($content));
   mysql_query("update adminblock set title='$title', content='$content'");
   Header("Location: admin.php?op=adminMain");
}

switch($op) {
   case "ablock":
        ablock();
        break;

   case "changeablock":
        changeablock($title, $content);
        break;
}
?>
