Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/includes/advblocks.php
<?php
// File: $Id: advblocks.php,v 1.25 2001/12/06 00:27:15 proca Exp $ $Name:  $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file:  Patrick Kellum <hide@address.com>
// Purpose of file: Display the side blocks on the page
// ----------------------------------------------------------------------
// Advanced Blocks System
//
// Copyright (c) 2001 Patrick Kellum (hide@address.com)
// http://ctarl-ctarl.com/
//
// Based in part of the blocks system in PHP-Nuke
// Copyright (c) 2001 by Francisco Burzi (hide@address.com)
// http://phpnuke.org/
// ----------------------------------------------------------------------
global $debug_sqlcalls, $dbg_starttime;

// initialise time to render
$mtime = explode(" ",microtime());
$dbg_starttime = $mtime[1] + $mtime[0];
$debug_sqlcalls = 0;

// load the block types + load language files for blocks
global $blocks_modules;
$blocks_modules = '';
global $currentlang;

//FTO to handle collapse / expand for blocks
$PNSVblkcollapse = array();
session_register("PNSVblkcollapse");

$dib = opendir('includes/blocks/');
while($f = readdir($dib))
{
    if(substr($f, -3, 3) == 'php')
    {
        include "includes/blocks/$f";

        if (file_exists("includes/language/blocks/$currentlang/$f"))
        {
            include "includes/language/blocks/$currentlang/$f";
        } elseif (file_exists("includes/language/blocks/eng/$f")) {
            include "includes/language/blocks/eng/$f";
        }
    }
}
closedir($dib);

/* change the function name so themes remain compatable */

function blocks($side)
{
    global
        $blocks_modules,
        $block_side, // give theme builders a little room to play :-)
        $multilingual, /* added multilingual globals */
        $currentlang,
        $pntable,
        $dbconn;
        
    if ($multilingual == 1)
    {
       $column = &$pntable['blocks_column'];

// FTO
// ORACLE DOES NOT RECOGNIZE NULL AS ''. IS NULL CLAUSE IS SUPPORTED BY MySQL.

        $querylang = "AND ($column[blanguage]='$currentlang' OR $column[blanguage] IS NULL OR $column[blanguage]='')";
        
        
    } else {
        $querylang = '';
    }
    $side = strtolower($side[0]);
    $block_side = $side;
    $column = &$pntable['blocks_column'];
    $result = $dbconn->Execute("SELECT $column[bid] as bid, $column[bkey] as bkey, $column[title] as title, $column[content] as content, $column[url] as url, $column[position] as position, $column[weight] as weight, $column[active] as active, $column[refresh] as refresh, $column[last_update] AS unix_update, $column[blanguage] as blanguage FROM $pntable[blocks] WHERE $column[position]='$side' AND $column[active]=1 $querylang ORDER BY $column[weight]");

//FTO Test databse errors and EOF
    if (!$result) {
        PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
        die();
    }

    while(!$result->EOF) {
        $row = $result->GetRowAssoc(false);

        $row['unix_update']=$result->UnixTimeStamp($row['unix_update']);

        if (isset ($blocks_modules[$row['bkey']]))
        {
            $blocks_modules[$row['bkey']]['func_display']($row);
        } else {
            $row['title'] = "Block Type $row[bkey] Not Found";
            $row['content'] = "The block type $row[bkey] doesn't seem to exisit.  Please check your includes/blocks/ directory.";
            themesideblock($row);
        }
	    $result->MoveNext();
    }
}

// adapter function for themesidebox function in old themes
// FTO Added collapse/expand system for blocks based on 7.1 version.
// FTO The main difference is that status are not saved in a user table.
// FTO ..and we use session.

function themesideblock($row)
{
    global
        $postnuke_theme,
        $pntheme, $PNSVblkcollapse
    ;

//FTO Adapted from V 7.1

    if(!isset($row['bid'])) {
	$row['bid'] = '';
    }
    if(!isset($row['title'])) {
	$row['title'] = '';
    }


    $bid = $row['bid'];

//FTO To save state of the block.

    session_register("PNSVblkcollapse");
    if(!isset($PNSVblkcollapse[$bid])) {
	$PNSVblkcollapse[$bid] = false;
    }

//FTO Collapse or Expand block. True means collapsed.

    if (!$PNSVblkcollapse[$bid])
       {
            if (!empty($row['title']))
            {
                $row['title'] .=" <a href=\"modules.php?op=modload&name=NS-Blocks&file=index&req=Collapse&bid=$bid\"><img src=\"images/global/collapse.gif\" border=\"0\" alt=\"\"></a>";
            }
       }
    else
       {
            $row['content'] ='';
            if (!empty($row['title']))
            {
                $row['title'] .=" <a href=\"modules.php?op=modload&name=NS-Blocks&file=index&req=Expand&bid=$bid\"><img src=\"images/global/expand.gif\" border=\"0\" alt=\"\"></a>";
            }
       }



//FTO Use quotes for index name
    if ($postnuke_theme || $pntheme['support_blocks2'])
    {
        themesidebox($row);
    } else {
        themesidebox($row['title'], $row['content']);
    }
}
?>
Return current item: ProNuke. Postnuke To Oracle