'; $translation['[/quote]'] = $translation['[/QUOTE]'] = '
'; return str_replace(array_keys($translation), array_values($translation), $text); } // Populate standard globals $CMS_GLOBAL['config'] = LoadConfig('../etc/cms.conf'); $CMS_GLOBAL['submitted_vars'] = strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST; $CMS_GLOBAL['cyear'] = date('Y'); $CMS_GLOBAL['cmon'] = date('m'); $CMS_GLOBAL['cday'] = date('d'); $CMS_GLOBAL['submitted_vars']['loc'] = isset($CMS_GLOBAL['submitted_vars']['loc'])?$CMS_GLOBAL['submitted_vars']['loc']:'news'; // Create a database handle and put that into the globals $CMS_GLOBAL['dbh'] = db_connect(array($CMS_GLOBAL['config']['host'], $CMS_GLOBAL['config']['user'], $CMS_GLOBAL['config']['password'])) or die('Cannot connect to the database'); db_select_db(array($CMS_GLOBAL['config']['database_name'], $CMS_GLOBAL['dbh'])) or db_log_error($CMS_GLOBAL['config']['database_name'], db_errno($CMS_GLOBAL['dbh']), db_error($CMS_GLOBAL['dbh'])); if (!$CMS_GLOBAL['dbh']) die(sprintf("A database error occurred, %s: %s", db_errno($CMS_GLOBAL['dbh']), db_error($CMS_GLOBAL['dbh']))); // Keep legacy code happy $config = $CMS_GLOBAL['config']; $submitted_vars = $CMS_GLOBAL['submitted_vars']; set_cache_dir('./cache'); if(in_array($CMS_GLOBAL['submitted_vars']['loc'], array('compiler', 'articles', 'news', 'news_content', 'news_archive'))) { // Load the module require_once(dirname(__FILE__) . '/modules/' . $CMS_GLOBAL['submitted_vars']['loc'] . '.mod.php'); // Compiler takes an argument if($CMS_GLOBAL['submitted_vars']['loc'] == 'compiler') { if(isset($CMS_GLOBAL['submitted_vars']['tpl'])) { $template_file = dirname(__FILE__) . '/templates/' . $CMS_GLOBAL['submitted_vars']['tpl'] . '.tpl'; $compiled_file = dirname(__FILE__) . '/compiled/' . $CMS_GLOBAL['submitted_vars']['tpl'] . '.html'; if(is_file($template_file)) { $compiled = compile(file_get_contents($template_file)); $fp = fopen($compiled_file, 'w'); fwrite($fp, $compiled); fclose($fp); $location = 'Location: ' . dirname($_SERVER['SCRIPT_URL']) . '/compiled/' . $CMS_GLOBAL['submitted_vars']['tpl'] . '.html'; header($location); exit; } } } // Run execute on everything else else { execute_module(); } } else { ?>

Bad request