Beispiel #1
0
function GetBlocks($position = BLOCK_LEFT)
{
    global $config;
    /** 
     * I had to reconnect to the database for some f*****g 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']);
    $result = $db->Query("SELECT * FROM `bayonet_blocks` ORDER BY weight, position");
    $blocks = $db->Fetch($result);
    foreach ($blocks as $block) {
        if ($block['position'] == $position && $block['active'] == true) {
            $load = 'blocks/' . $block['dir_name'] . '/index.php';
            if (file_exists($load)) {
                OpenBlock($block['title']);
                include $load;
                CloseBlock();
            } else {
                ReportError("Failed to load block, '{$block['dir_name']}'.  Check block config.");
            }
            if ($config['blocks']['spacer']) {
                echo "<br />";
            }
        }
    }
}