<?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: guestbook.php,v 1.6.2.7 2004/08/15 12:58:18 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
#
######################################################################

$hlpfile = "manual/guestbookconfig.html";

function GuestbookConfigAdmin() {

    global $hlpfile, $admin,$phpEx;
    global $guest_allow_html, $guest_allow_bbcode, $guest_allow_smilies, $guests_per_page;

    OpenTable();

    echo "<center><font size=4><b>" . translate("Guestbook Configuration") . "</b></center><br><br>";
    echo "<font size=2>";
    echo "<form action=\"admin.$phpEx?fct=guestbook\" method=\"post\">";
    echo "<table border=0 width=100%><tr><td>" . translate("Allow HTML:") . " </td><td>";

    if ($guest_allow_html==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_html\" VALUE=\"1\" CHECKED>&nbsp;" .translate("Yes")."&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_html\" VALUE=\"0\" >&nbsp;" .translate("No")."&nbsp;</INPUT>";
    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_html\" VALUE=\"1\">&nbsp;" .translate("Yes")."&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_html\" VALUE=\"0\" CHECKED>&nbsp;" .translate("No")."&nbsp;</INPUT>";
    }

    echo "</td></tr>";
    echo "<tr><td>" . translate("Allow BBCODE:") . " </td><td>";

    if ($guest_allow_bbcode==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_bbcode\" VALUE=\"1\" CHECKED>&nbsp;" .translate("Yes")."&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_bbcode\" VALUE=\"0\" >&nbsp;" .translate("No")."&nbsp;</INPUT>";
    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_bbcode\" VALUE=\"1\">&nbsp;" .translate("Yes")."&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_bbcode\" VALUE=\"0\" CHECKED>&nbsp;" .translate("No")."&nbsp;</INPUT>";
    }

    echo "</td></tr>";
    echo "<tr><td>" . translate("Allow Smilies:") . " </td><td>";

    if ($guest_allow_smilies==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_smilies\" VALUE=\"1\" CHECKED>&nbsp;" .translate("Yes")."&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_smilies\" VALUE=\"0\" >&nbsp;" .translate("No")."&nbsp;</INPUT>";
    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_smilies\" VALUE=\"1\">&nbsp;" .translate("Yes")."&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xguest_allow_smilies\" VALUE=\"0\" CHECKED>&nbsp;" .translate("No")."&nbsp;</INPUT>";
    }

    echo "</td></tr>";
    echo "<tr><td>" . translate("Guests per Page:") . " </td><td>";

    echo "<input type=text name=xguests_per_page size=4 value=$guests_per_page></td></tr>";
    echo "<tr><td colspan=2><small><i>".translate("(This is the number of guests that will be displayed per page of the Guestbook)")."</i></small></td></tr>";
    echo "<tr><td>&nbsp;</td></tr>";
        echo "</table>";
        echo "<input type=hidden name=op value=GuestbookConfigChange>";
        echo "<input class='button' type=submit value=".translate("Change").">";
        echo "</form>";
        echo "</td></tr></table></td></tr></table>";

//    include("footer.$phpEx");
}

function GuestbookConfigChange($xguest_allow_html,$xguest_allow_bbcode,$xguest_allow_smilies,$xguests_per_page) {
    global $fct, $phpEx;

    $check_ary = array( $_POST['xguests_per_page'] );

    $verify_check_ary = $_SERVER['SAN'] -> verifyContent( $check_ary, 5 );

    // Check Num Only

    if ( in_array( (bool)FALSE, $verify_check_ary ) )
    {
        goBack( translate( 'Please Make Sure You Have Numbers In Number Only Fields' ) );
        exit;
    }

    $content = "";
    $content .= "<?php\n";
    $content .= require './admin/configs_header.php';
    $content .= "\n";
    $content .= '// Guestbook' . "\n";
    $content .= '// $guest_allow_html: Should HTML be allowed in Guestbook entries.  Default = 1     ' . "\n";
    $content .= '// $guest_allow_bbcode: Should BBCode be allowed in Guestbook entries.  Default = 1   ' . "\n";
   $content .= '// $guest_allow_smilies: Should Smilies be allowed in Guestbook entries.  Default = 1  ' . "\n";
    $content .= '// $guests_per_page: How many Guestbook entries should be displayed.  Default = 10 ' . "\n";
    $content .= "\n//######################################################\n";
    $content .= "\n";
    $content .= "\$guest_allow_html = $xguest_allow_html;\n";
    $content .= "\$guest_allow_bbcode = $xguest_allow_bbcode;\n";
    $content .= "\$guest_allow_smilies = $xguest_allow_smilies;\n";
    $content .= "\$guests_per_page = $xguests_per_page;\n\n";
    $content .= "?>";

    $filename = 'admin/' . $fct . '/config.php';

    if ( ! $_SERVER['F_LIB'] -> writeFile( $filename, 'w+b', $content ) )
    {
        goBack( translate( 'File Write Error.  Check Permissions On ' ) . $filename );
        exit;
    }

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

?>