<?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/ephem.html";
$result = mysql_query("select radminephem, radminsuper from authors where aid='$aid'");
list($radminephem, $radminsuper) = mysql_fetch_row($result);
if (($radminephem!=1) and ($radminsuper!=1)) {
   Access_Error();
}

function Ephemerids() {
    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("Ephémérides")." - ".adm_translate("Ajouter un Epheméride : ");
    echo "</td></tr></table>\n";
    echo "<br /><form action=\"admin.php\" method=\"post\">";
    $nday = "1";
    echo adm_translate("Jour : ")." <select class=\"TEXTBOX_STANDARD\" name=\"did\">";
    while ($nday<=31) {
       echo "<option name=\"did\">$nday</option>";
       $nday++;
    }
    echo "</select>";
    $nmonth = "1";
    echo " ".adm_translate("Mois : ")." <select class=\"TEXTBOX_STANDARD\" name=\"mid\">";
    while ($nmonth<=12) {
       echo "<option name=\"mid\">$nmonth</option>";
       $nmonth++;
    }
    echo "</select> ".adm_translate("Année : ")." <input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"yid\" maxlength=\"4\" size=\"5\"><br /><br />
    ".adm_translate("Description de l'Ephéméride : ")."<br />
    <textarea name=\"content\" class=\"textbox\" cols=\"55\" rows=\"10\"></textarea><br /><br />
    <input type=\"hidden\" name=\"op\" value=\"Ephemeridsadd\">
    <input class=\"BOUTON_STANDARD\" type=\"submit\" value=\"".adm_translate("Envoyer")."\">
    </form><br />";
    echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"HEADER\">\n";
    echo adm_translate("Maintenance des Ephémérides (Editer/Effacer)");
    echo "</td></tr></table>\n";
    echo "<form action=\"admin.php\" method=\"post\">";
    $nday = "1";
    echo adm_translate("Jour : ")." <select class=\"TEXTBOX_STANDARD\" name=\"did\">";
    while ($nday<=31) {
       echo "<option name=\"did\">$nday</option>";
       $nday++;
    }
    echo "</select>";
    $nmonth = "1";
    echo adm_translate("Mois : ")." <select class=\"TEXTBOX_STANDARD\" name=\"mid\">";
    while ($nmonth<=12) {
       echo "<option name=\"mid\">$nmonth</option>";
       $nmonth++;
    }
    echo "</select>";
    echo " - <input type=\"hidden\" name=\"op\" value=\"Ephemeridsmaintenance\">
    <input class=\"BOUTON_STANDARD\" type=\"submit\" value=\"".adm_translate("Editer")."\">
    </form>";
    closetable();
    include ("footer.php");
}

function Ephemeridsadd($did, $mid, $yid, $content) {
    $content = stripslashes(FixQuotes($content)."");
    mysql_query("insert into ephem values (NULL, '$did', '$mid', '$yid', '$content')");
    Header("Location: admin.php?op=Ephemerids");
}

function Ephemeridsmaintenance($did, $mid) {
    global $hlpfile;
    $resultX=mysql_query("select eid, did, mid, yid, content from ephem where did='$did' AND mid='$mid' ORDER BY yid ASC");
    if (!mysql_num_rows($resultX))
       header("location: admin.php?op=Ephemerids");
    include ("header.php");
    GraphicAdmin($hlpfile);
    OpenTable();
    echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"HEADER\">\n";
    echo adm_translate("Maintenance des Ephémérides");
    echo "</td></tr></table>\n";
    echo "<br /><table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">";
    while(list($eid, $did, $mid, $yid, $content) = mysql_fetch_row($resultX)) {
       $rowcolor = tablos();
       echo "<tr $rowcolor>
       <td>$yid</td><td>".aff_langue($content)."</td>
       <td align=\"right\">[ <a href=\"admin.php?op=Ephemeridsedit&amp;eid=$eid&amp;did=$did&amp;mid=$mid\" class=\"NOIR\">".adm_translate("Editer")."</a> | <a href=\"admin.php?op=Ephemeridsdel&amp;eid=$eid&amp;did=$did&amp;mid=$mid\" class=\"ROUGE\">".adm_translate("Effacer")."</a> ]<br />
       </tr>";
    }
    echo "</table>";
    closetable();
    include ('footer.php');
}

function Ephemeridsdel($eid, $did, $mid) {
    mysql_query("delete from ephem where eid='$eid'");
    Header("Location: admin.php?op=Ephemeridsmaintenance&did=$did&mid=$mid");
}

function Ephemeridsedit($eid, $did, $mid) {
    global $hlpfile;
    include ("header.php");
    GraphicAdmin($hlpfile);
    $result=mysql_query("select yid, content from ephem where eid='$eid'");
    list($yid, $content) = mysql_fetch_row($result);
    OpenTable();
    echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"HEADER\">\n";
    echo adm_translate("Maintenance des Ephémérides")." - ".adm_translate("Editer Ephéméride : ");
    echo "</td></tr></table>\n";
    echo "<br /><form action=\"admin.php\" method=\"post\">";
    echo adm_translate("Année : ")." <input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"yid\" value=\"$yid\" maxlength=\"4\" size=\"5\"><br /><br />
    ".adm_translate("Description de l'Ephéméride : ")."<br />
    <textarea name=\"content\" cols=\"55\" class=\"textbox\" rows=\"10\">$content</textarea><br /><br />
    <input type=\"hidden\" name=\"did\" value=\"$did\">
    <input type=\"hidden\" name=\"mid\" value=\"$mid\">
    <input type=\"hidden\" name=\"eid\" value=\"$eid\">
    <input type=\"hidden\" name=\"op\" value=\"Ephemeridschange\">
    <input class=\"BOUTON_STANDARD\" type=\"submit\" value=\"".adm_translate("Envoyer")."\">
    </form>";
    closetable();
    include ('footer.php');
}

function Ephemeridschange($eid, $did, $mid, $yid, $content) {
    $content = stripslashes(FixQuotes($content)."");
    mysql_query("update ephem set yid='$yid', content='$content' where eid='$eid'");
    Header("Location: admin.php?op=Ephemeridsmaintenance&did=$did&mid=$mid");
}

switch($op) {
    case "Ephemeridsedit":
         Ephemeridsedit($eid, $did, $mid);
         break;

    case "Ephemeridschange":
         Ephemeridschange($eid, $did, $mid, $yid, $content);
         break;

    case "Ephemeridsdel":
         Ephemeridsdel($eid, $did, $mid);
         break;

    case "Ephemeridsmaintenance":
         Ephemeridsmaintenance($did, $mid);
         break;

    case "Ephemeridsadd":
         Ephemeridsadd($did, $mid, $yid, $content);
         break;

    case "Ephemerids":
         Ephemerids();
         break;
}
?>
