<?php

if ( ! @include_once( './mainfile.php' ) ) { exit( '!! INCLUDE ERROR. 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: updatelog.php,v 1.10.2.5 2004/08/01 17:04:19 kirilt Exp $




##########################################################################
# MY-PHP-NUKE: Web Portal System UPDATE LOG
# =========================================
#
# Copyright (c) 2001 by Jeff Lambert (jeffx@qchc.com)
# view example on http://www.qchc.com
#
# This module is for displaying, adding, deleting and modifying UPDATE LOG
# Please read the included Install.txt for more info
#
##########################################################################

//2001-12-09 jeffx      Changed contact information
/*2001-03-29 jeffx      HTML fix for display_update_box in Netscape
                        HTML tags to lowercase for 4.01 compatibility
                        Code optimization when listing MySQL variables*/



function update_nav($function) {
    global $phpEx, $admin;
    //if ($admin) {
    if (_MPN_ADMIN) {
        echo "<center>[ ";
        if ($function != 1) {
            echo "<a href='updatelog.$phpEx?op=add_update'>";
        }
        echo translate("Add An Update");
        if ($function != 1) {
            echo "</a>";
        }
        echo " ] - [ ";
        if ($function != 2) {
            echo "<a href='updatelog.$phpEx?op=mod_update'>";
        }
        echo translate("Modify An Update");
        if ($function != 2) {
            echo "</a>";
        }
        echo " ] - [ ";
        if ($function != 3) {
            echo "<a href='updatelog.$phpEx?op=del_update'>";
        }
        echo translate("Delete An Update");
        if ($function != 3) {
            echo "</a>";
        }
        echo " ]</center><br><br>";
    }
}

function display_update_box($name, $email, $date, $files, $updates, $bugs, $mod, $del, $id) {
    global $bgcolor1, $bgcolor2, $bgcolor3, $phpEx, $serv_offset;
//  $hdate = strftime(translate("datestring5"),strtotime($date));
// $hdate = formatTimeStamp($date);
// $hdate = date("Y-m-d H:i",mktime(date("H")+$serv_offset));
// $hdate = strftime(translate("forumdatestring2"),strtotime($hdate));

    $hdate = strftime(translate("forumdatestring2"),strtotime($date));

    // Kiril: New Sanitizer

    $sanity_ary = compact( 'updates', 'bugs' );
    $_SERVER['SAN'] -> slashIT( $sanity_ary );
    $_SERVER['SAN'] -> adjustFormat( $sanity_ary, 3, 10 );
    extract( $sanity_ary );

    // End Sanitizer

    echo "<table border='0' width='80%' bgcolor='$bgcolor2' cellpadding='3' cellspacing='1' align='center'>";
    echo "<tr><td colspan='2' bgcolor='$bgcolor2'><b>$hdate ".translate("by")." $name</b></td></tr>";
    echo "<tr><td width='170' bgcolor='$bgcolor1'>".translate("Modified file(s):")."</td><td bgcolor='$bgcolor3' width='400'>$files</td></tr>";
    echo "<tr><td width='170' bgcolor='$bgcolor1'>".translate("Update details:")."</td><td bgcolor='$bgcolor3' width='400'>$updates</td></tr>";
    if ($bugs != "") {
        echo "<tr><td width='170' bgcolor='$bgcolor1'>".translate("Possible bugs:")."</td><td bgcolor='$bgcolor3' width='400'>$bugs</td></tr>";
    }

    if ($mod == 1) {
        echo "<tr><td bgcolor='$bgcolor3' colspan='2'><b>[ <a href='updatelog.$phpEx?op=mod_update&id=$id'>".translate("Modify this update")."</a> ]</b></td></tr>";
    }
    if ($del == 1) {
        echo "<tr><td bgcolor='$bgcolor3' colspan='2'><b>[ <a href='updatelog.$phpEx?op=del_update&id=$id'>".translate("Delete this update")."</a> ]</b></td></tr>";
    }

    echo "</table>";
}

function add_update() {
    global $user, $cookie, $mpnTables,$phpEx, $admin, $bgcolor1, $bgcolor2, $bgcolor3;
    include ("header.$phpEx");
    OpenTable();

    $uname = $email = null;

    if (_MPN_ADMIN) {
        if ($user) {
            $result=mysql_query("select uname, email from ".$mpnTables['users']." where uname='$cookie[1]' && uid > 1");
            list($uname, $email) = mysql_fetch_row($result);
        }
        update_nav(1);
        echo "
<form method='post' action='updatelog.$phpEx'>
<table width='100%' cellspacing='1' cellpadding='2'>
<tr><td colspan='3'><i>".translate("Please enter information according to the specifications")."</td>
</tr><tr>
<td width='15%'><b>".translate("Full Name:")."</b></td>
<td width='45%'><input class='textbox' type='text' name='name' size='25' maxlength='40' value='$uname'></td>
<td width='40%'>".translate("(eg: Jeff Lambert)")."</td>
</tr><tr>
<td width='15%'><b>".translate("Email Address:")."</b></td>
<td width='45%'><input class='textbox' type='text' name='email' size='25' maxlength='40' value='$email'></td>
<td width='40%'>".translate("(eg: jeffx@qchc.com)")."</td>
</tr><tr>
<td width='15%'><b>".translate("Updated file(s):")."</b></td>
<td width='45%'><input class='textbox' type='text' name='files' size='25' maxlength='40'></td>
<td width='40%'>".translate("(eg: shows.php, admin.php)")."</td>
</tr><tr>
<td width='15%'><b>".translate("Update details:")."</b></td>
<td width='45%'><textarea class='textbox' name='updates' rows='10' wrap='virtual' cols='70'></textarea></td>
<td width='40%'>".translate("Details of the update")."</td>
</tr><tr>
<td width='15%'><b>".translate("Possible bugs:")."</b></td><td width='45%'><textarea class='textbox' name='bugs' rows='10' wrap='virtual' cols='70'></textarea></td>
<td width='40%'>".translate("Leave blank if no bugs!")."</td>
</tr><tr>
<td colspan='3'><i>".translate("Please make sure that the information entered is 100% valid and uses proper grammar and capitalization. For instance, please do not enter your information in ALL CAPS, as it will be rejected.")."</i><br></td>
</tr><tr>
<td colspan='3'>\n";

// Kiril: New Sanitizer

echo "<input type='hidden' name='stripit_form' value='name|email|files|updates|bugs' />\n";
echo "<input type='hidden' name='mpn_sectype' value='1' />\n";

// End Sanitizer


echo "<input type='hidden' name='op' value='add'><input class='button' type='submit' value='".translate("Preview")."'>&nbsp;<input class='button' type='button' onClick='history.go(-1)' value ='".translate("Cancel")."'></form></td></tr></table><br>";
    } else {
        echo "ACCESS DENIED";
    }
    CloseTable();
    include ("footer.$phpEx");
}

function add($name, $email, $files, $updates, $bugs) {
    global $admin, $phpEx, $serv_offset;
    include ("header.$phpEx");

    // Kiril: New Sanitizer

    $sanity_ary = compact( 'name', 'email', 'files', 'updates', 'bugs' );
    $_SERVER['SAN'] -> slashIT( $sanity_ary );
    extract( $sanity_ary );
    unset( $sanity_ary );

    // End New Saintizer


    echo "<form method='post' action='updatelog.$phpEx?op=add_update_send'>";
    OpenTable();
    if (_MPN_ADMIN) {
        if ($name == "") {
            $error = 1;
            echo translate("Invalid name... can not be blank") . "<br />";
        }
        if ($files == "") {
            $error = 1;
            echo translate("Invalid files... can not be blank") . "<br />";
        }
        if ($updates == "") {
            $error = 1;
            echo translate("Invalid updates... can not be blank") . "<br />";
        }


        if (!(ereg ('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email))) {
            $error = 1;
            echo translate("Invalid email (eg: you@hotmail.com)");
        }

        if (isset($error) && $error == 1) {
            echo "<br><input class='button' type='button' onClick='history.go(-1)' value='".translate("Go back!")."'>";
        } else {

    /*$name1 = $ts->sanitizeForPreview($name);
    $files1 = $ts->sanitizeForPreview($files);
    $updates1 = $ts->sanitizeForPreview($updates,0,1,1);
    $bugs1 = $ts->sanitizeForPreview($bugs,0,1,1);*/

        $heur = date("Y-m-d H:i",mktime(date("H")+$serv_offset));

        update_nav(1);
            if (!isset($mod))
            {
                $mod = null;
            }

            if (!isset($del))
            {
                $del = null;
            }

            if (!isset($id))
            {
                $id = null;
            }

            display_update_box($name, $email, $heur, $files, $updates, $bugs, $mod, $del, $id);

            echo "<br /><br /><br />\n";

        update_nav(1);

        echo "
            <form method='post' action='updatelog.$phpEx'>
            <table width='100%' cellspacing='1' cellpadding='2'>
            <tr><td colspan='3'><i>".translate("Please enter information according to the specifications")."</td>
            </tr><tr>
            <td width='15%'><b>".translate("Full Name:")."</b></td>
            <td width='45%'><input class='textbox' type='text' name='name' size='25' maxlength='40' value='$name'></td>
            <td width='40%'>".translate("(eg: Jeff Lambert)")."</td>
            </tr><tr>
            <td width='15%'><b>".translate("Email Address:")."</b></td>
            <td width='45%'><input class='textbox' type='text' name='email' size='25' maxlength='40' value='$email'></td>
            <td width='40%'>".translate("(eg: jeffx@qchc.com)")."</td>
            </tr><tr>
            <td width='15%'><b>".translate("Updated file(s):")."</b></td>
            <td width='45%'><input class='textbox' type='text' name='files' size='25' maxlength='40' value='$files'></td>
            <td width='40%'>".translate("(eg: shows.php, admin.php)")."</td>
            </tr><tr>
            <td width='15%'><b>".translate("Update details:")."</b></td>
            <td width='45%'><textarea class='textbox' name='updates' rows='10' wrap='virtual' cols='70' value='$updates'>$updates</textarea></td>
            <td width='40%'>".translate("Details of the update")."</td>
            </tr><tr>
            <td width='15%'><b>".translate("Possible bugs:")."</b></td><td width='45%'><textarea class='textbox' name='bugs' rows='10' wrap='virtual' cols='70' value='$bugs'>$bugs</textarea></td>
            <td width='40%'>".translate("Leave blank if no bugs!")."</td>
            </tr><tr>
            <td colspan='3'><i>".translate("Please make sure that the information entered is 100% valid and uses proper grammar and capitalization. For instance, please do not enter your information in ALL CAPS, as it will be rejected.")."</i><br></td>
            </tr><tr>
            <td colspan='3'>\n";

            // Kiril: New Sanitizer

            echo "<input type='hidden' name='stripit_form' value='name|email|files|updates|bugs' />\n";
            echo "<input type='hidden' name='mpn_sectype' value='1' />\n";

            // End Sanitizer


            //echo "<input type='hidden' name='op' value='add'>\n";
            echo "<input class='button' type='submit' name='op' value='".translate("Preview")."'>&nbsp;\n";
            echo "<input class='button' type='submit' name='op' value='".translate("Save")."'>&nbsp;\n";
            echo "<input class='button' type='button' onClick='history.go(-1)' value='".translate("Cancel")."'>\n";
            echo "</form></td></tr></table><br>";



            /*$name = urlencode($name);
            $files = urlencode($files);
            $updates = urlencode($updates);
            $bugs = urlencode($bugs);

            echo "<p><i>".translate("Does this look right?")." </i>";
            echo "<input type='hidden' name='op' value='add_update_send'>
                  <input type='hidden' name='name' value='$name'>
                  <input type='hidden' name='email' value='$email'>
                  <input type='hidden' name='files' value='$files'>
                  <input type='hidden' name='updates' value='$updates'>
                  <input type='hidden' name='bugs' value='$bugs'>
                  <input class='button' type='submit' value='".translate("Yes")."'>
                  <input class='button' type='button' onClick='history.go(-1)' value='".translate("No")."!'></p>";*/
        }
    } else {
        echo "ACCESS DENIED";
    }
    CloseTable();
    include ("footer.$phpEx");
}

function add_update_send($name, $email, $files, $updates, $bugs) {
    global  $mpnTables,$phpEx, $serv_offset;

    if ( _MPN_ADMIN )
    {
/*//      $name = stripslashes(FixQuotes($name));
        $email = stripslashes(FixQuotes($email));
        //$files = stripslashes(FixQuotes($files));
    //  $files = $ts->sanitizeIntoDB($files);
//      $updates = Fixquotes(urldecode(check_html($updates, "")));
//        $bugs = Fixquotes(urldecode(check_html($bugs, "")));

    //    $updates = $ts->sanitizeIntoDB($updates);
       // $bugs = $ts->sanitizeIntoDB($bugs);
        $name = urldecode($name);
        $files = urldecode($files);
        $updates = urldecode($updates);
        $bugs = urldecode($bugs);*/

        // Kiril: Start New Sanitizer

        $sanity_ary = compact( 'name', 'email', 'files', 'updates', 'bugs' );
        $_SERVER['SAN'] -> slashIT( $sanity_ary, TRUE );
        extract( $sanity_ary );
        unset( $sanity_ary );

        // End New Sanitizer

        $heur = date("Y-m-d H:i",mktime(date("H")+$serv_offset));


        mysql_query("insert into ".$mpnTables['updatelog']." values (NULL, '$name', '$email', '$heur', '$files', '$updates', '$bugs')");
        $_SERVER['F_LIB'] -> redirectRequest( 'updatelog.php' );

    } else {
        echo translate("ACCESS DENIED");
    }
}

function del_update($id, $page) {
    global $admin, $mpnTables,$phpEx;
    include ("header.$phpEx");
    OpenTable();
    if (_MPN_ADMIN) {
        update_nav(3);
        if ($id == 0) {
            list_updates(0, 1, $page);
        } else if ($id != 0) {
            $result = mysql_query("select * from ".$mpnTables['updatelog']." where id = $id");
            list($id, $name, $email, $date, $files, $updates, $bugs) = mysql_fetch_row($result);
            if (!isset($mod))
            {
                $mod = null;
            }

            if (!isset($del))
            {
                $del = null;
            }

            display_update_box($name, $email, $date, $files, $updates, $bugs, $mod, $del, $id);
            mysql_free_result($result);
            echo "<form method='post' action='updatelog.$phpEx?op=del_update_send'>";
            echo "<i>".translate("Are you sure you want to delete this Update?")."</i> &nbsp;&nbsp;";
            echo "<input type='hidden' name='id' value='$id'>";
            echo "<input class='button' type='submit' value='".translate("Yes")."'>&nbsp;&nbsp;<input class='button' type='button' onClick='history.go(-1)' value='".translate("No")."'>";
        }
    } else {
        echo "ACCESS DENIED";
    }
    CloseTable();
    include ("footer.$phpEx");
}

function del_update_send($id) {
    global  $mpnTables,$phpEx;
    if (_MPN_ADMIN) {
        mysql_query("delete from ".$mpnTables['updatelog']." WHERE id = $id");
        $_SERVER['F_LIB'] -> redirectRequest( 'updatelog.php' );
    } else {
        echo translate("ACCESS DENIED");
    }
}

function index($page) {
    global $phpEx, $sitename;
    include ("header.$phpEx");
    OpenTable();
    echo "<CENTER><B>".translate("The last update of")." $sitename</B></CENTER><P>";
    update_nav(0);
    list_updates(0, 0, $page);
    CloseTable();
    echo "<P>";
    OpenTable();
    echo "<DIV ALIGN=\"right\">UpdateLog script from Jeff Lambert, <a href='mailto:jeffx@qchc.com'>jeffx@qchc.com</a></div><br>";
    echo translate("For the latest version of this script and for more scripts, go to")." <a href=\"http://www.qchc.com\">www.qchc.com</a><br></DIV> ";
    CloseTable();
    include ("footer.$phpEx");
}

function list_updates($mod, $del, $page) {
    global $mpn_pagesize_updatelog, $mpnTables,$phpEx;
    if (!isset($page)) { $page = 1; }
    $min = $mpn_pagesize_updatelog * ($page - 1);
    $max = $mpn_pagesize_updatelog;
    $result = mysql_query("select * from ".$mpnTables['updatelog']." ORDER by id DESC LIMIT $min,$max");
    $count_result = mysql_query("SELECT COUNT(id) AS total FROM ".$mpnTables['updatelog']);
    $num_rows_per_order = mysql_result($count_result,0,0);
    $num_updates = mysql_num_rows($result);

    if ( $num_rows_per_order > 0 ) {
        while($myrow = mysql_fetch_array($result))
        {

            // Kiril: New Sanitizer

            $_SERVER['SAN'] -> slashIT( $myrow );

            // End Sanitizer


            echo "<p>";

            display_update_box($myrow["name"], $myrow["email"], $myrow["date"], $myrow["files"], $myrow["updates"], $myrow["bugs"], $mod, $del, $myrow["id"]);

            echo "</p>";
        }
    }
    echo "\n<tr><td align='right'>\n<br><br>";
    OpenTable();
    echo "<CENTER><table width='70%' cellspacing='0' cellpadding='0' cols='3' border='0'><tr>";
    if ( $num_rows_per_order > $mpn_pagesize_updatelog ) {
        $total_pages = ceil($num_rows_per_order / $mpn_pagesize_updatelog);
        $prev_page = $page - 1;
        if ( $prev_page > 0 ) {
            echo "<td align='left' width='15%'>";
            if ($mod) {
                echo "<a href='updatelog.$phpEx?op=mod_update&page=$prev_page'>";
            } elseif ($del) {
                echo "<a href='updatelog.$phpEx?op=del_update&page=$prev_page'>";
            } else {
                echo "<a href='updatelog.$phpEx?page=$prev_page'>";
            }

            echo "<img src='images/download/left.gif' border='0' alt='" .translate("Previous Page")." ($prev_page)' /></a></td>";
        } else {
            echo "<td width='15%'>&nbsp;</td>\n";
        }
        echo "<td align='center' width='70%'>";
        $hlp = sprintf(translate("There are %s updates in total (%s pages, %s updates shown)"),$num_rows_per_order,$total_pages,$num_updates);
        echo "<font size='1'>$hlp</font>";
        echo "</td>";
        $next_page = $page + 1;
        if ( $next_page <= $total_pages ) {
            echo "<td align='right' width='15%'>";
            if ($mod) {
                echo "<a href='updatelog.$phpEx?op=mod_update&page=$next_page'>";
            } elseif ($del) {
                echo "<a href='updatelog.$phpEx?op=del_update&page=$next_page'>";
            } else {
                echo "<a href='updatelog.$phpEx?page=$next_page'>";
            }
            echo "<img src='images/download/right.gif' border='0' alt='" .translate("Next Page")." ($next_page)' ></a></td>";
        } else {
            echo "<td width='15%'>&nbsp;</td></tr>\n";
        }
        echo "<tr><td colspan='3' align='center'>";
        echo " <font size='1'>[ ";
        for($n=1; $n < $total_pages; $n++) {
            if ($n == $page) {
                echo "<b>$n</b>";
            } else {
                if ($mod) {
                    echo "<a href='updatelog.$phpEx?op=mod_update&page=$n'>$n</a>";
                } elseif ($del) {
                    echo "<a href='updatelog.$phpEx?op=del_update&page=$n'>$n</a>";
                } else {
                    echo "<a href='updatelog.$phpEx?page=$n'>$n</a>";
                }
            }
            if($n >= 50) {
                $break = true;
                break;
            } else {
                echo " | ";
            }
        }
        if(!isset($break)) {
            if ($n == $page) {
                echo "<b>$n</b>";
            } else {
                if ($mod) {
                    echo "<a href='updatelog.$phpEx?op=mod_update&page=$total_pages'>$n</a>";
                } elseif ($del) {
                    echo "<a href='updatelog.$phpEx?op=del_update&page=$total_pages'>$n</a>";
                } else {
                    echo "<a href='updatelog.$phpEx?page=$total_pages'>$n</a>";
                }
            }
        }
        echo " ]</font>";
        echo "</td></tr>";
    } else {
        echo "<td align='center'>";
        echo "<font size='1'>$num_rows_per_order ".translate("updates found.")."</font>";
        echo "</td></tr>";
    }
    echo "</table></CENTER>\n";
    CloseTable();
    mysql_free_result($result);
}

function mod_update($id, $page) {
    global $admin, $mpnTables,$phpEx, $bgcolor1, $bgcolor2, $bgcolor3;
    include ("header.$phpEx");
    OpenTable();
    if (_MPN_ADMIN) {
        update_nav(2);
        if ($id == 0) {
            list_updates(1,0,$page);
        } else if ($id != 0) {
            $result = mysql_query("select * from ".$mpnTables['updatelog']." where id = $id");
            list($id, $name, $email, $date, $files, $updates, $bugs) = mysql_fetch_row($result);

            // Kiril: Start New Sanitizer

            $sanity_ary = compact( 'name', 'email', 'files', 'updates', 'bugs' );
            $_SERVER['SAN'] -> slashIT( $sanity_ary );
            extract( $sanity_ary );
            unset( $sanity_ary );

            // End New Sanitizer

            echo "<form method='post' action='updatelog.$phpEx'><input type='hidden' name='id' value='$id'>";
            echo "<table border='0' width='100%' bgcolor='$bgcolor2' cellpadding='3' cellspacing='1'><tr>
<td colspan='2'><b>".translate("Original Info")."</b></td>
<td colspan='2'><b>".translate("Modified Info")."</b></td>
</tr><tr>
<td width='12%' bgcolor='$bgcolor1'>".translate("Name:")."</td>
<td width='38%' bgcolor='$bgcolor3'>$name</td>
<td width='12%' bgcolor='$bgcolor1'>".translate("Name:")."</td>
<td width='38%' bgcolor='$bgcolor3'><input type='text' name='name' size='15' maxlength='40' value='$name'></td>
</tr><tr>
<td width='12%' bgcolor='$bgcolor1'>".translate("Email:")."</td>
<td width='38%' bgcolor='$bgcolor3'>$email</td>
<td width='12%' bgcolor='$bgcolor1'>".translate("Email:")."</td>
<td width='38%' bgcolor='$bgcolor3'><input type='text' name='email' size='20' maxlength='40' value='$email'></td>
</tr><tr>
<td width='12%' bgcolor='$bgcolor1'>".translate("File(s):")."</td>
<td width='38%' bgcolor='$bgcolor3'>$files</td>
<td width='12%' bgcolor='$bgcolor1'>".translate("File(s):")."</td>
<td width='38%' bgcolor='$bgcolor3'><input type='text' name='files' size='15' maxlength='40' value='$files'></td>
</tr><tr>
<td width='12%' bgcolor='$bgcolor1'>".translate("Updates:")."</td>
<td width='38%' bgcolor='$bgcolor3'>$updates</td>
<td width='12%' bgcolor='$bgcolor1'>".translate("Updates:")."</td>
<td width='38%' bgcolor='$bgcolor3'><textarea class='textbox' name='updates' rows='5' wrap='virtual' cols='30'>$updates</textarea></td>
</tr><tr>
<td width='12%' bgcolor='$bgcolor1'>".translate("Bugs:")."</td>
<td width='38%' bgcolor='$bgcolor3'>$bugs</td>
<td width='12%' bgcolor='$bgcolor1'>".translate("Bugs:")."</td>
<td width='38%' bgcolor='$bgcolor3'><textarea class='textbox' name='bugs' rows='3' wrap='virtual' cols='30'>$bugs</textarea></td>
</tr><tr>
<td width='12%' bgcolor='$bgcolor1'>".translate("Date:")."</td>
<td width='38%' bgcolor='$bgcolor3'>$date</td>
<td width='12%' bgcolor='$bgcolor1'>".translate("Date:")."</td>
<td width='38%' bgcolor='$bgcolor3'><input type='text' name='date' size='20' maxlength='19' value='$date'></td>
</tr></table>";

            // Kiril: New Sanitizer

            echo "<input type='hidden' name='stripit_form' value='name|email|files|updates|bugs' />\n";
            echo "<input type='hidden' name='mpn_sectype' value='2' />\n";

            // End Sanitizer

            echo "<input type='hidden' name='op' value='mod_update_send'>\n";

            echo "<p class='center'>\n";

                echo "<br /><br />\n";

                echo "<input class='button' type='button' onClick='history.go(-1)' value='".translate("Cancel")."'>";

                echo "&nbsp;&nbsp;\n";

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

            echo "</p></form>\n";
            // memory flush
            mysql_free_result($result);
        }
    } else {
        echo translate("ACCESS DENIED");
    }
    CloseTable();
    include ("footer.$phpEx");
}

function mod_update_send($id, $name, $email, $date, $files, $updates, $bugs) {
    global  $mpnTables,$phpEx;

    $errormsg = '';

    if (_MPN_ADMIN)
    {
        if ($name == "") {
            $errormsg .= translate("Invalid name... can not be blank") . "<br />";
        }
        if ($files == "") {
            $errormsg .= translate("Invalid files... can not be blank") . "<br />";
        }
        if ($updates == "") {
            $errormsg .= translate("Invalid updates... can not be blank") . "<br />";
        }
        if (!(ereg ('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email))) {
            $errormsg .= translate("Invalid email (eg: you@hotmail.com)") . "<br />";
        }


        if ( $errormsg != '' ) {
            include ("header.$phpEx");
            OpenTable();
            echo "<form method='post' action='updatelog.$phpEx?op=add_update_send'>";
            echo "$errormsg<br><input class='button' type='button' onClick='history.go(-1)' value='".translate("Go back!")."'>";
            CloseTable();
            include ("footer.$phpEx");
        } else {
/*            $name = stripslashes(FixQuotes($name));
            $email = stripslashes(FixQuotes($email));
            $files = stripslashes(FixQuotes($files));
            $updates = stripslashes(Fixquotes(urldecode(check_html($updates, ""))));
            $bugs = stripslashes(Fixquotes(urldecode(check_html($bugs, ""))));*/

            mysql_query("update ".$mpnTables['updatelog']." set name='$name', email='$email', files='$files', updates='$updates', bugs='$bugs', date='$date' where id = $id");
            $_SERVER['F_LIB'] -> redirectRequest( 'updatelog.php' );
        }
    } else {
        echo translate("ACCESS DENIED");
    }
}

if (!isset($op))
{
    $op = null;
}

switch ($op)
{

    case "add":
        add($HTTP_POST_VARS['name'], $HTTP_POST_VARS['email'], $HTTP_POST_VARS['files'], $HTTP_POST_VARS['updates'], $HTTP_POST_VARS['bugs']);
        break;

    case "Preview":
        add($HTTP_POST_VARS['name'], $HTTP_POST_VARS['email'], $HTTP_POST_VARS['files'], $HTTP_POST_VARS['updates'], $HTTP_POST_VARS['bugs']);
        break;

    case "add_update":
        add_update();
        break;

    case "add_update_send":
        add_update_send($HTTP_POST_VARS['name'], $HTTP_POST_VARS['email'], $HTTP_POST_VARS['files'], $HTTP_POST_VARS['updates'], $HTTP_POST_VARS['bugs']);
        break;

     case "Save":
        add_update_send($HTTP_POST_VARS['name'], $HTTP_POST_VARS['email'], $HTTP_POST_VARS['files'], $HTTP_POST_VARS['updates'], $HTTP_POST_VARS['bugs']);
        break;

    case "del_update":
        if (!isset( $HTTP_GET_VARS['id'] ))
        {
            $HTTP_GET_VARS['id'] = null;
        }

        if (!isset($page))
        {
            $page = null;
        }

        del_update($HTTP_GET_VARS['id'], $page);
        break;

    case "del_update_send":
        del_update_send($HTTP_POST_VARS['id']);
        break;

    case "mod_update":
        if (!isset( $HTTP_GET_VARS['id'] ))
        {
            $HTTP_GET_VARS['id'] = null;
        }

        if (!isset($page))
        {
            $page = null;
        }

        mod_update($HTTP_GET_VARS['id'], $page);
        break;

    case "mod_update_send":
        mod_update_send($HTTP_POST_VARS['id'], $HTTP_POST_VARS['name'], $HTTP_POST_VARS['email'], $HTTP_POST_VARS['date'], $HTTP_POST_VARS['files'], $HTTP_POST_VARS['updates'], $HTTP_POST_VARS['bugs']);
        break;

    default:
        if (!isset($page))
        {
            $page = null;
        }

        index($page);
        break;
}

?>
