<?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: phpbbaccess.php,v 1.4.2.5 2004/08/15 12:58:04 kirilt Exp $




######################################################################
# PHP-NUKE: Web Portal System
# ===========================
#
# Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve)
# http://phpnuke.org
#
# This modules is the main administration part
#
# 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.
######################################################################
# PHP-NUKE Add-On 2.0 :
# =====================
#
#              PHPBB Integration 1.0.BETA
#   Brought to you by PHPNuke Add-On Team
#
# Copyright (c) 2000 by Richard Tirtadji AKA King Richard (rtirtadji@hotmail.com)
#                       Hutdik Hermawan AKA hotFix (hutdik76@hotmail.com)
# http://www.phpnuke.web.id
#
#
############################################################################################################################################
# PHPBB 1.0.BETA
# ==============
#
# Copyright (C) 2000 by James Atkinson (james@totalgeek.org)
# http://www.phpbb.com
#
######################################################################

checkAccess( 'forum', array( 'forum' ) );

/*********************************************************/
/* PHPBB Forum Admin Function                            */
/*********************************************************/

function AccessForumAdmin() {
    global $hlpfile, $admin, $mpnTables,$phpEx;
    include ("config.$phpEx");
    $hlpfile = getHelpFile("accessphpbb.html");
    include ("header.$phpEx");
    GraphicAdmin($hlpfile);
    OpenTable();
    echo "
    <center><font size=4><b>".translate("Forum Access System")."</b></font></center>
    <form action=admin.$phpEx method=post>
    <center><table border=1 width=100%><tr>
    <td bgcolor=0000BA><font color=white><center>".translate("Access Level Title")."</td><td>&nbsp</td></tr>";

    $result = mysql_query("select access_id, access_title from ".$mpnTables['access']." order by access_id");
    while(list($access_id, $access_title) = mysql_fetch_row($result)) {
        echo "
    <td align=center>$access_title</td>";
    echo"
    <td align=center><a href=admin.$phpEx?op=AccessForumEdit&access_id=$access_id>".translate("Edit")."</a> | <a href=admin.$phpEx?op=AccessForumDel&access_id=$access_id&ok=0>".translate("Delete")."</a></td><tr>";
    }
    echo "</form></td></tr></table>
    <br><br>
    </center><font size=4><b>".translate("Add New Access Levels")."</b><br><br>
    <font size=2>
    <form action=admin.$phpEx method=post>
    <table border=0 width=100%><tr><td>
    ".translate("Access Level Title:")." </td><td><input type=text name=access_title size=31></td></tr><tr><td>
    </td></tr></table>
    <input type=hidden name=op value=AccessForumAdd>
    <input class='button' type=submit value=".translate("Add").">
    </form>
    </td></tr></table></td></tr></table>";
    include("footer.$phpEx");
}

function AccessForumAdd($access_title) {
    global $mpnTables,$phpEx;
    mysql_query("insert into ".$mpnTables['access']." values (NULL, '$access_title')");

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

}

function AccessForumEdit($access_id) {
    global $hlpfile, $admin, $mpnTables,$phpEx;
    include ("config.$phpEx");
    $hlpfile = "manual/$language/accessphpbb.html";
    include ("header.$phpEx");
    GraphicAdmin($hlpfile);
    $result = mysql_query("select access_title from ".$mpnTables['access']." where access_id='$access_id'");
    list($access_title) = mysql_fetch_row($result);
    OpenTable();
    echo "
    <center><font size=4><b>".translate("Edit Access Levels")."</b></font></center>
    <form action=admin.$phpEx method=post>
    <input type=hidden name=access_id value=$access_id>
    <table border=0 width=100%><tr><td>
    ".translate("Access Level Title:")." </td><td><input type=text name=access_title size=31 value=\"$access_title\"></td></tr>";
    echo"
    <tr><td></td></tr></table>
    <input type=hidden name=op value=AccessForumSave>
    <input class='button' type=submit value=".translate("Save Changes").">
    </form>
    </td></tr></table></td></tr></table>";
    include("footer.$phpEx");
}

function AccessForumSave($access_id, $access_title) {
    global $mpnTables,$phpEx;
    mysql_query("update ".$mpnTables['access']." set access_title='$access_title' where access_id='$access_id'");

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

function AccessForumDel($access_id, $ok=0) {
    global $mpnTables,$phpEx;
    if($ok==1) {
    mysql_query("delete from ".$mpnTables['access']." where access_id=$access_id");

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

    } else {
    include("header.$phpEx");
    GraphicAdmin($hlpfile);
    OpenTable();
    echo "<center><br>";
    echo "<font size=3 color=Red>";
    echo "<b>".translate("WARNING: Are you sure you want to delete this Access Level?")."</b><br><br><font color=Black>";
    }
    echo "[ <a href=admin.$phpEx?op=AccessForumDel&access_id=$access_id&ok=1>".translate("Yes")."</a> | <a href=admin.$phpEx?op=AccessForumAdmin>".translate("No")."</a> ]<br><br>";
    echo "</TD></TR></TABLE></TD></TR></TABLE>";
    include("footer.$phpEx");
}

?>
