From ad6ba256efd1a65fb1bb3951ae6b17b1593205b7 Mon Sep 17 00:00:00 2001 From: jhunkeler Date: Tue, 29 Dec 2009 05:36:23 +0000 Subject: (OC) Fixed includes/functions::GetBlocks() so that left and right are 0 and 1. Also fixed the query so that it doesnt get every block, just the active blocks for the defined side. Re-did some display on the admin side for blocks. git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@408 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- includes/functions.php | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'includes') diff --git a/includes/functions.php b/includes/functions.php index 05d6457..8a965c1 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -587,33 +587,18 @@ function UnderConstruction($message = NULL, $flag = BAYONET_SITE) */ define('BLOCK_LEFT',false); -define('BLOCK_RIGHT',false); +define('BLOCK_RIGHT',true); function GetBlocks($position = BLOCK_LEFT) { global $config; - /** - * I had to reconnect to the database for some fucking reason at this point. - * I have no idea why, but I was recieving errors telling me that $db was no longer - * an object. This is/was bullshit. - */ - $db = new Bayonet_SQL(); - $db->Connect( - $config['sql']['hostname'], - $config['sql']['username'], - $config['sql']['password'] - ); - $db->Select_db($config['sql']['database']); + global $db; - $result = $db->Query("SELECT * FROM `bayonet_blocks` ORDER BY weight, position"); - //$result = mysql_query("SELECT * FROM bayonet_blocks ORDER BY weight, position"); + $result = $db->Query("SELECT * FROM `bayonet_blocks` WHERE `position` = '$position' AND `active` = 1 ORDER BY weight"); $blocks = $db->Fetch($result); - $blocks[] = $row; - + decho($blocks); foreach($blocks as $block) { - if($block['position'] == $position && $block['active'] == true) - { $load = 'blocks/'.$block['dir_name'].'/index.php'; if(file_exists($load)) { @@ -627,7 +612,6 @@ function GetBlocks($position = BLOCK_LEFT) ReportError("Failed to load block, '{$block['dir_name']}'. Check block config."); } if($config['blocks']['spacer']) echo "
"; - } } } ?> \ No newline at end of file -- cgit