function GetBlocks($position = BLOCK_LEFT) { global $config; global $db; $query = sprintf("SELECT block_id, active, weight, position, dir_name, title FROM bayonet_blocks WHERE active = 1 AND position = %d ORDER BY weight", (int) $position); $result = $db->Query($query); $blocks = $db->Fetch($result); if (empty($blocks)) { return; } foreach ($blocks as $block) { $load = 'blocks/' . $block['dir_name'] . '/index.php'; if (file_exists($load)) { OpenBlock($block['title']); include_once $load; CloseBlock(); decho("'{$block['dir_name']}' block loaded"); } else { ReportError("Failed to load block, '{$block['dir_name']}'. Check block config."); } if ($config['blocks']['spacer']) { echo "<br />"; } } }
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 />"; } } } }
<?php $server_ip = "123.123.123.123"; $server_port = "12345"; $feed = fopen("http://module.game-monitor.com/{$server_ip}:{$server_port}/data/server.php", "r"); $tmp = fgets($feed); $server = unserialize($tmp); OpenBlock("Game Server"); echo "<div style=\"margin:5px;\">\n\n<a href=\"{$server->link}\">{$server->name}</a><br/>\n\nIP: {$server->ip}:{$server->port}<br/>\n\nPlayers: {$server->player}/{$server->maxplayer}<br/>\n\n</td></tr>\n\n</div>\n"; CloseBlock();