<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.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.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
/********************************************************/
/* NSN Center Blocks                                    */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.net                           */
/* Copyright © 2000-2005 by NukeScripts Network         */
/********************************************************/
/* Original by: Richard Benfield                        */
/* http://www.benfield.ws                               */
/********************************************************/
global $admin_file;
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}
include_once ("kernel/addons/center_blocks.php");
$textrowcol = "rows='15' cols='60'";
if($Version_Num >= "7.7") { $textrowcol = "rows='15' cols='75'"; }
$aid   = substr("$aid", 0,25);
$row   = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `radminsuper` FROM `".TABLE_AUTHORS."` WHERE `aid`='$aid'"));
$acces = $GLOBALS['db']->XMFbin($row['radminsuper']);
if ($acces == 1) {
if($admintest && $adminsecu)  {

get_adminlang("centerblocks");

function CBSample($set) {
    $sql = "SELECT `height`, `count` FROM `".TABLE_NSNCB_CONFIG."` WHERE `cgid`='$set'";
    if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(GENERAL_ERROR, 'Could not obtain center block', '', __LINE__, __FILE__, $sql);}
$row    = $GLOBALS['db']->sql_fetchrow($result);
$height = $GLOBALS['db']->XMFnum($cbinfo['height']);
$count  = $GLOBALS['db']->XMFnum($row['count']);
    if($height <> "0") { $cheight = "height='$height' "; } else { $cheight = ""; }
    Max_OpenTable();
    echo "<table width=\"100%\" ".$cheight."border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\"><tr><td valign=\"top\">\n"
        ."<table width=\"100%\" ".$cheight."border=\"0\" cellspacing=\"1\" cellpadding=\"4\" bgcolor=\"$bgcolor1\"><tr>";
    $sql1 = "SELECT `rid`, `cbid`, `wtype`, `width` FROM `".TABLE_NSNCB_BLOCKS."` WHERE `cgid`='$set' ORDER BY `cbid`";
    if ( !($result1 = $GLOBALS['db']->sql_query($sql1)) )
    { query_die(GENERAL_ERROR, 'Could not obtain center block', '', __LINE__, __FILE__, $sql);}
    while($cbidinfo = $GLOBALS['db']->sql_fetchrow($result3)) {
    $cbid  = $GLOBALS['db']->XMFnum($row1['cbid']);
    $wtype = $GLOBALS['db']->XMFnum($row1['wtype']);
    $width = $GLOBALS['db']->XMFnum($row1['width']);
    $rid   = $GLOBALS['db']->XMFnum($row1['rid']);
        if($cbid <= $count) {
            if($wtype == '0') {
                echo "<td width=\"$width\" valign=\"top\" align=\"center\">\n";
            } else {
                echo "<td width=\"$width%\" valign=\"top\" align=\"center\">\n";
            }
            cb_blocks($rid);
            echo "</td>\n";
        }
    }
    echo "</tr></table>\n"
        ."</td></tr></table>\n";
    Max_CloseTable();
    br('1');
    $GLOBALS['db']->sql_freeresult($result);
    $GLOBALS['db']->sql_freeresult($result1);
}

function CBMenu() {
    global $admin_file;
    Max_OpenTable();
    echo "<center>"
        ."<a href=\"".$admin_file.".php\">"._ADMINISTRATION."</a><br /><br />\n"
        ."<a href=\"".$admin_file.".php?op=CenterBlocksSet1\">"._CB_CONFIG1."</a><br />\n"
        ."<a href=\"".$admin_file.".php?op=CenterBlocksSet2\">"._CB_CONFIG2."</a><br />\n"
        ."<a href=\"".$admin_file.".php?op=CenterBlocksSet3\">"._CB_CONFIG3."</a><br />\n"
        ."<a href=\"".$admin_file.".php?op=CenterBlocksSet4\">"._CB_CONFIG4."</a><br />\n"
        ."</center>";
    Max_CloseTable();
}

 switch($op) {
    case 'CenterBlocksAdmin':include('admin/modules/cblocks/CenterBlocksAdmin.php');break;
    case 'CenterBlocksSave1':include('admin/modules/cblocks/CenterBlocksSave1.php');break;
    case 'CenterBlocksSave2':include('admin/modules/cblocks/CenterBlocksSave2.php');break;
    case 'CenterBlocksSave3':include('admin/modules/cblocks/CenterBlocksSave3.php');break;
    case 'CenterBlocksSave4':include('admin/modules/cblocks/CenterBlocksSave4.php');break;
    case 'CenterBlocksSet1':include('admin/modules/cblocks/CenterBlocksSet1.php');break;
    case 'CenterBlocksSet2':include('admin/modules/cblocks/CenterBlocksSet2.php');break;
    case 'CenterBlocksSet3':include('admin/modules/cblocks/CenterBlocksSet3.php');break;
    case 'CenterBlocksSet4':include('admin/modules/cblocks/CenterBlocksSet4.php');break;
  }
  }
} else {
    echo "Access Denied";
}