<?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                                 */
/************************************************************************/
defined('MAXIMUS') or die ('Access denied center blocks MAXIMUS directly...');

// center blocks
function cb_blocks($rid) {
    global $prefix, $db, $admin, $user, $name;
    if ($name) {
    $sql = "SELECT title, filename, content FROM `".TABLE_NSNCB_BLOCKS."` WHERE `rid`='$rid'";
    if ( !($result = $db->sql_query($sql)) )
{ query_die(GENERAL_ERROR, 'Could not obtain center block', '', __LINE__, __FILE__, $sql);}
    while($row = $db->sql_fetchrow($result)) {
        $title = stripslashes($row['title']);
        $filename = stripslashes($row['filename']);
        $content = stripslashes($row['content']);
        if($filename == "" AND $content > "") {
            themecenterbox($title, $content);
        } elseif($filename > "" AND $content == "") {
            $file = @file("blocks/$filename");
            if(!$file) {
                $content = _BLOCKPROBLEM;
            } else {
if (is_file("blocks/$filename")) {include_once("blocks/$filename");}
            }
            if($content == "") { $content = _BLOCKPROBLEM2; }
            themecenterbox($title, $content);
        } elseif($filename == "" AND $content == "") {
            $content = _BLOCKPROBLEM2;
            themecenterbox($title, $content);
        }
    }
}}