* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ session_start(); define('BAYONET_INCLUDE', '../include'); define('BAYONET_CONFIG', '../include/config.php'); include BAYONET_INCLUDE . '/debug.php'; include BAYONET_INCLUDE . '/sql.class.php'; include BAYONET_INCLUDE . '/functions.php'; require_once BAYONET_INCLUDE . '/classes.php'; Bayonet_Config::init(); $config = Bayonet_Config::$ini; $db = new Bayonet_SQL(); $db->Connect($config['sql']['hostname'], $config['sql']['username'], $config['sql']['password']); $db->Select_db($config['sql']['database']); //$config['logs']['dir'] = "../logs/"; include 'header.php'; if (!defined("MODULE_FILE")) { //die("Access denied."); } define("ADMIN_FILE", 'admin_file'); include 'admin_functions.php'; if (isset($_GET['op']) && $_GET['op'] == 'logout') { logout(); } if (login()) { //this is so dirty... sigh. if (is_loggedin()) {
static function init() { global $db, $config; Bayonet_Config::init(); // Set globally referenced configuration and database variables $config = Bayonet_Config::$ini; $db = new Bayonet_SQL(); //Connect to the MySQL server $db->Connect($config['sql']['hostname'], $config['sql']['username'], $config['sql']['password']); $db->Select_db($config['sql']['database']); decho('Initializing Bayonet'); Bayonet_Theme::init(); }
<?php //basename(dirname('.')) $dirname = "/path/to/bayonet/here"; define('BAYONET_ROOT', $dirname); define('BAYONET_INCLUDE', BAYONET_ROOT . '/include'); define('BAYONET_CONFIG', BAYONET_ROOT . '/include/config.php'); require BAYONET_INCLUDE . '/debug.php'; require BAYONET_INCLUDE . '/sql.class.php'; require BAYONET_INCLUDE . '/functions.php'; Bayonet_Config::init(); $config = Bayonet_Config::$ini; $db = new Bayonet_SQL(); //Connect to the MySQL server $db->Connect($config['sql']['hostname'], $config['sql']['username'], $config['sql']['password']); $db->Select_db($config['sql']['database']); /*----------------------------- */ $action = $_POST['action']; $updateRecordsArray = $_POST['recordsArray']; if ($action == "updateReelOrder") { $listingCounter = 1; foreach ($updateRecordsArray as $recordIDValue) { $db->Query("UPDATE `bayonet_newsreel` SET `weight` = '{$listingCounter}' WHERE `slide_id` = '{$recordIDValue}'"); $listingCounter = $listingCounter + 1; } echo "<img src=\"images/accepted.png\" />"; /* echo '<pre>'; print_r($updateRecordsArray); echo '</pre>'; echo 'If you refresh the page, you will see that records will stay just as you modified.';
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 />"; } } } }