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


function blockcenteradmin() {

    global $hlpfile, $admin,$phpEx;
    global $sections_view,$review_view,$artclies_view,$download_view,$actif,$liens_view,$nombre_liens, $nombre_download, $nombre_articles, $nombre_reviews,$nombre_sections;
    global $ordredownload ,$ordrearticles,$ordresections, $ordrereviews ,$ordrelinks;
    OpenTable();

    echo "<center><font size=2><b>" . translate("Center blocks Configuration") . "</b></center><br>";
    echo "<font size=2>";
    echo "<form action=\"./admin.php\" method=\"post\">";
    echo "<table border=0 width=100%><tr><td>";

 echo "</td></tr>";
    echo "<tr><td><b>" . translate("Enable centerblock:") . " </b></td></tr><tr><td>&nbsp;</td><td>";

    if ($actif==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xactif\" VALUE=\"1\" CHECKED>&nbsp;" .translate("Yes")."&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xactif\" VALUE=\"0\" >&nbsp;" .translate("No")."&nbsp;</INPUT>";
    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xactif\" VALUE=\"1\">&nbsp;" .translate("Yes")."&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xactif\" VALUE=\"0\" CHECKED>&nbsp;" .translate("No")."&nbsp;</INPUT>";
    }
     echo "</td></tr>";
    echo "<tr><td><br><br><b>" . translate("Blocks configuration:") . " </b><br><br></td><td>";
echo "</center></td></tr>";
    echo "<tr><td>" . translate("Display the links block:") . " </td><td>";
if ($liens_view==2) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xliens_view\" VALUE=\"1\" >&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xliens_view\" VALUE=\"0\" >&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xliens_view\" VALUE=\"2\"CHECKED >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";

    } elseif ($liens_view==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xliens_view\" VALUE=\"1\"CHECKED>&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xliens_view\" VALUE=\"0\" >&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xliens_view\" VALUE=\"2\" >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";
    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xliens_view\" VALUE=\"1\">&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xliens_view\" VALUE=\"0\" CHECKED>&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xliens_view\" VALUE=\"2\" >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";
    }


echo "</td></tr>";
    echo "<tr><td>" . translate("Display the downloads block:") . " </td><td>";
if ($download_view==2) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xdownload_view\" VALUE=\"1\" >&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xdownload_view\" VALUE=\"0\" >&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xdownload_view\" VALUE=\"2\"CHECKED >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";

    } elseif ($download_view==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xdownload_view\" VALUE=\"1\"CHECKED>&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xdownload_view\" VALUE=\"0\" >&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xdownload_view\" VALUE=\"2\" >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";
    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xdownload_view\" VALUE=\"1\">&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xdownload_view\" VALUE=\"0\" CHECKED>&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xdownload_view\" VALUE=\"2\" >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";
    }


echo "</td></tr>";
    echo "<tr><td>" . translate("Display the articles block:") . " </td><td>";
if ($artclies_view==2) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xartclies_view\" VALUE=\"1\" >&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xartclies_view\" VALUE=\"0\" >&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xartclies_view\" VALUE=\"2\"CHECKED >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";

    } elseif ($artclies_view==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xartclies_view\" VALUE=\"1\"CHECKED>&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xartclies_view\" VALUE=\"0\" >&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xartclies_view\" VALUE=\"2\" >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";
    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xartclies_view\" VALUE=\"1\">&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xartclies_view\" VALUE=\"0\" CHECKED>&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xartclies_view\" VALUE=\"2\" >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";
    }





echo "</td></tr>";
    echo "<tr><td>" . translate("Display the reviews block:") . " </td><td>";
if ($review_view==2) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xreview_view\" VALUE=\"1\" >&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xreview_view\" VALUE=\"0\" >&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xreview_view\" VALUE=\"2\"CHECKED >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";

    } elseif ($review_view==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xreview_view\" VALUE=\"1\"CHECKED>&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xreview_view\" VALUE=\"0\" >&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xreview_view\" VALUE=\"2\" >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";
    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xreview_view\" VALUE=\"1\">&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xreview_view\" VALUE=\"0\" CHECKED>&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xreview_view\" VALUE=\"2\" >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";
    }




echo "</td></tr>";
    echo "<tr><td>" . translate("Display the sections block:") . " </td><td>";
if ($sections_view==2) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xsections_view\" VALUE=\"1\" >&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xsections_view\" VALUE=\"0\" >&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xsections_view\" VALUE=\"2\"CHECKED >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";

    } elseif ($sections_view==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xsections_view\" VALUE=\"1\"CHECKED>&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xsections_view\" VALUE=\"0\" >&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xsections_view\" VALUE=\"2\" >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";
    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xsections_view\" VALUE=\"1\">&nbsp;" . translate("Left") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xsections_view\" VALUE=\"0\" CHECKED>&nbsp;" . translate("Right") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xsections_view\" VALUE=\"2\" >&nbsp;" . translate("Off") . "&nbsp;</INPUT>";
    }










    echo "</td></tr>";
    echo "<tr><td>" . translate("Number of links:") . " </td><td>";

    echo "<input type=\"text\" name=\"xnombre_liens\" size=\"4\" value=\"$nombre_liens\">";

    echo "&nbsp;&nbsp;&nbsp;&nbsp;" . translate("order by:") . " ";

    if ($ordrelinks==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrelinks\" VALUE=\"1\" CHECKED>&nbsp;" . translate("Date") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrelinks\" VALUE=\"0\" >&nbsp;" . translate("Most Hits") . "&nbsp;</INPUT>";

    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrelinks\" VALUE=\"1\">&nbsp;" . translate("Date") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrelinks\" VALUE=\"0\" CHECKED>&nbsp;" . translate("Most Hits") . "&nbsp;</INPUT>";
    }

echo "</tr>";



    echo "<tr><td>" . translate("Number of reviews") . " </td><td>";
    echo "<input type=\"text\" name=\"xnombre_reviews\" size=\"4\" value=\"$nombre_reviews\">";

    echo "&nbsp;&nbsp;&nbsp;&nbsp;" . translate("order by:") . " ";

    if ($ordrereviews==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrereviews\" VALUE=\"1\" CHECKED>&nbsp;" . translate("Date") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrereviews\" VALUE=\"0\" >&nbsp;" . translate("Most Hits") . "&nbsp;</INPUT>";

    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrereviews\" VALUE=\"1\">&nbsp;" . translate("Date") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrereviews\" VALUE=\"0\" CHECKED>&nbsp;" . translate("Most Hits") . "&nbsp;</INPUT>";
    }

echo "</tr>";


    echo "<tr><td>" . translate("Number of sections") . " </td><td>";
    echo "<input type=\"text\" name=\"xnombre_sections\" size=\"4\" value=\"$nombre_sections\">";


echo "&nbsp;&nbsp;&nbsp;&nbsp;" . translate("order by:") . " ";

    if ($ordresections==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordresections\" VALUE=\"1\"CHECKED >&nbsp;" . translate("Date") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordresections\" VALUE=\"0\" >&nbsp;" . translate("The Most Read") . "&nbsp;</INPUT>";

    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordresections\" VALUE=\"1\">&nbsp;" . translate("Date") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordresections\" VALUE=\"0\" CHECKED>&nbsp;" . translate("The Most Read") . "&nbsp;</INPUT>";
    }

echo "</tr>";





    echo "<tr><td>" . translate("Number of articles") . " </td><td>";
    echo "<input type=\"text\" name=\"xnombre_articles\" size=\"4\" value=\"$nombre_articles\">";

echo "&nbsp;&nbsp;&nbsp;&nbsp;" . translate("order by:") . " ";

    if ($ordrearticles==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrearticles\" VALUE=\"1\" CHECKED>&nbsp;" . translate("Date") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrearticles\" VALUE=\"0\" >&nbsp;" . translate("The Most Read") . "&nbsp;</INPUT>";

    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrearticles\" VALUE=\"1\">&nbsp;" . translate("Date") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordrearticles\" VALUE=\"0\" CHECKED>&nbsp;" . translate("The Most Read") . "&nbsp;</INPUT>";
    }

echo "</tr>";



    echo "<tr><td>" . translate("Number of downloads") . " </td><td>";
    echo "<input type=\"text\" name=\"xnombre_download\" size=\"4\" value=\"$nombre_download\">";



echo "&nbsp;&nbsp;&nbsp;&nbsp;" . translate("order by:") . " ";

    if ($ordredownload==1) {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordredownload\" VALUE=\"1\"CHECKED >&nbsp;" . translate("Date") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordredownload\" VALUE=\"0\" >&nbsp;" . translate("The Most Downloads") . "&nbsp;</INPUT>";

    } else {
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordredownload\" VALUE=\"1\">&nbsp;" . translate("Date") . "&nbsp;</INPUT>";
        echo "<INPUT TYPE=\"RADIO\" NAME=\"xordredownload\" VALUE=\"0\" CHECKED>&nbsp;" . translate("The Most Downloads") . "&nbsp;</INPUT>";
    }

echo "</tr>";

    echo "<tr><td>&nbsp;</td></tr>";
        echo "</table>";
        echo "<input type=hidden name=op value=centerblockConfigChange>";
        echo "<input type='hidden' name='fct' value='blockcenter'>";
        echo "<input class='button' type=submit value=".translate("Change").">";
        echo "</form>";
        echo "</td></tr></table></td></tr></table>";
}
//    include("footer.$phpEx");

function centerblockConfigChange($xordredownload ,$xordrearticles,$xordresections, $xordrereviews ,$xordrelinks,$xsections_view,$xreview_view,$xartclies_view,$xdownload_view,$xliens_view,$xactif,$xnombre_liens, $xnombre_download, $xnombre_articles, $xnombre_reviews,$xnombre_sections) {
    global $fct, $phpEx;

    $check_ary = array( $xnombre_liens, $xnombre_download, $xnombre_articles, $xnombre_reviews, $xnombre_sections );

    $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 .= "\n";
    $content .= "\$actif = $xactif;\n";
    $content .= "\$nombre_liens = $xnombre_liens;\n";
    $content .= "\$nombre_download = $xnombre_download;\n";
    $content .= "\$nombre_articles = $xnombre_articles;\n";
    $content .= "\$nombre_reviews = $xnombre_reviews;\n";
    $content .= "\$nombre_sections = $xnombre_sections;\n";
    $content .= "\n";
    $content .= "\n";
    $content .= "\$liens_view = $xliens_view;\n";
    $content .= "\$download_view = $xdownload_view;\n";
    $content .= "\$artclies_view = $xartclies_view;\n";
    $content .= "\$review_view = $xreview_view;\n";
    $content .= "\$sections_view = $xsections_view;\n";
    $content .= "\$ordredownload = $xordredownload;\n";
    $content .= "\$ordrearticles = $xordrearticles;\n";
    $content .= "\$ordresections= $xordresections;\n";
    $content .= "\$ordrereviews= $xordrereviews;\n";
    $content .= "\$ordrelinks= $xordrelinks;\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;
    }

    /*fwrite($file, $content);
        fclose($file);*/

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

}

?>
