<?php

@( (bool)FALSE === strpos( $_SERVER['REQUEST_URI'], basename( __FILE__ ) ) ) OR exit( '!! ACCESS DENIED !!' );
error_reporting( _E_VALUE );


/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | myPHPNuke Version 188_8 RC2                                          |
// +----------------------------------------------------------------------+
// | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html              |
// +----------------------------------------------------------------------+
// | Support: http://myphpnuke.com/                                       |
// +----------------------------------------------------------------------+
// | Author: myPHPNuke Dev Team                                           |
// +----------------------------------------------------------------------+
// | Copyright: © 2001-2004 myPHPNuke Dev Team                            |
// +----------------------------------------------------------------------+
// $Id: ephemerids.php,v 1.6.2.6 2004/08/15 12:58:04 kirilt Exp $




/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)            */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* 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.       */
/************************************************************************/

checkAccess( 'blocks', array( 'ephem', 'left' ) );

/*********************************************************/
/* Ephemerids Functions to have a Historic Ephemerids    */
/*********************************************************/

function Ephemerids() {
    global $hlpfile, $admin,$phpEx, $mpnTables;
    include ("header.$phpEx");
    GraphicAdmin($hlpfile);
    OpenTable();
    echo "
    <center><font size=4><b>".translate("Ephemerids")."</b></center><br><br>
    <font size=3><b>".translate("Add Ephemerid:")."</b><br><br><font size=2>
    <form action=admin.$phpEx method=post>";
    $nday = "1";
    echo "".translate("Day:")." <select name=did>";
    while ($nday<=31) {
    echo "<option name=did>$nday</option>";
    $nday++;
    }
    echo "</select>";
    $nmonth = "1";
    echo "".translate("Month:")." <select name=mid>";
    while ($nmonth<=12) {
    echo "<option name=mid>$nmonth</option>";
    $nmonth++;
    }
    echo "</select>".translate("Year:")." <input class=textbox type=text name=yid maxlength=4 size=5><br><br>
    ".translate("Ephemerid Description:")."<br>
    <textarea name=content cols=70 rows=20></textarea><br><br>
    <input type=hidden name=op value=Ephemeridsadd>\n";

    // Kiril: New Sanitizer

        echo "<input type='hidden' name='stripit_form' value='yid|content' />\n";
        echo "<input type='hidden' name='mpn_sectype' value='2' />\n";

    // End Sanitizer

    echo "<input class='button' type=submit value=".translate("Send").">
    </form>\n";



    echo "<br><br>
    <font size=3><b>".translate("Ephemerid Maintenance (Edit/Delete):")."</b><br><br><foint size=2>
    <form action=admin.$phpEx method=post>";
    $nday = "1";
    echo "".translate("Day:")." <select name=did>";
    while ($nday<=31) {
    echo "<option name=did>$nday</option>";
    $nday++;
    }
    echo "</select>";
    $nmonth = "1";
    echo "".translate("Month:")." <select name=mid>";
    while ($nmonth<=12) {
    echo "<option name=mid>$nmonth</option>";
    $nmonth++;
    }
    echo "</select>";

    echo "
    <br><br>
    <input type=hidden name=op value=Ephemeridsmaintenance>
    <input class='button' type=submit value=".translate("Edit").">
    </form>

    </td></tr></table></td></tr></table>
    ";
    include ("footer.$phpEx");
}

function Ephemeridsadd($did, $mid, $yid, $content) {
    global $mpnTables,$phpEx;
    mysql_query("insert into ".$mpnTables['ephem']." values (NULL, '$did', '$mid', '$yid', '$content')");

    $_SERVER['F_LIB'] -> redirectRequest( 'admin.php?op=Ephemerids' );

}

function Ephemeridsmaintenance($did, $mid) {
    global $mpnTables,$phpEx;
    include ("header.$phpEx");
    GraphicAdmin($hlpfile);
    OpenTable();
    echo "
    <center><font size=4><b>".translate("Ephemerids Maintenance")."</b></center><br><br>";
    $result=mysql_query("select eid, did, mid, yid, content from ".$mpnTables['ephem']." where did=$did AND mid=$mid");
    while(list($eid, $did, $mid, $yid, $content) = mysql_fetch_row($result)) {
    echo "<font size=2><b>$yid</b> [ <a href=admin.$phpEx?op=Ephemeridsedit&eid=$eid&did=$did&mid=$mid>".translate("Edit")."</a> | <a href=admin.$phpEx?op=Ephemeridsdel&eid=$eid&did=$did&mid=$mid>".translate("Delete")."</a> ]<br>
    <font size=1>$content<br><br><br>";
    }
    echo "</td></tr></table></td></tr></table>";
    include ("footer.$phpEx");
}

function Ephemeridsdel($eid, $did, $mid) {
    global $mpnTables,$phpEx;
    mysql_query("delete from ".$mpnTables['ephem']." where eid=$eid");

    $_SERVER['F_LIB'] -> redirectRequest( 'admin.php?op=Ephemeridsmaintenance&did=' . $did . '&mid=' . $mid );

}

function Ephemeridsedit($eid, $did, $mid) {
    global $mpnTables,$phpEx;
    include ("header.$phpEx");
    GraphicAdmin($hlpfile);
    $result=mysql_query("select yid, content from ".$mpnTables['ephem']." where eid=$eid");
    list($yid, $content) = mysql_fetch_row($result);
    OpenTable();
    echo "
    <center><font size=4><b>".translate("Ephemerids Maintenance")."</b></center><br><br>
    <font size=3><b>".translate("Edit Ephemerid:")."</b><br><br><font size=2>
    <form action=admin.$phpEx method=post>";
    echo "".translate("Year:")." <input class=textbox type=text name=yid value=$yid maxlength=4 size=5><br><br>
    ".translate("Ephemerid Description:")."<br>
    <textarea name=content cols=70 rows=20>$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>\n";

    // Kiril: New Sanitizer

        echo "<input type='hidden' name='stripit_form' value='yid|content' />\n";
        echo "<input type='hidden' name='mpn_sectype' value='2' />\n";

    // End Sanitizer

    echo "<input class='button' type=submit value=".translate("Send").">
    </form>
    </td></tr></table></td></tr></table>
    ";
    include ("footer.$phpEx");
}

function Ephemeridschange($eid, $did, $mid, $yid, $content) {
    global $mpnTables,$phpEx;
    //$content = stripslashes(FixQuotes($content));
    mysql_query("update ".$mpnTables['ephem']." set yid='$yid', content='$content' where eid=$eid");

    $_SERVER['F_LIB'] -> redirectRequest( '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;

}

?>
