function au_setup_database() { // This thing is important, it contains the database settings global $aulis; // In case something goes wrong $db = null; // Let's see if we maybe need MySQL or PSQL if ($aulis['db_driver'] == 'mysql' || $aulis['db_driver'] == 'psql') { try { @($db = new PDO($aulis['db_driver'] . ':host=' . $aulis['db_host'] . ';dbname=' . $aulis['db_database'], $aulis['db_user'], $aulis['db_password'])); } catch (PDOException $e) { au_fatal_error(1, $e->getMessage()); } } elseif ($aulis['db_driver'] == 'sqlite') { try { @($db = new PDO('sqlite:' . $aulis['db_database'])); } catch (PDOException $e) { au_fatal_error(1, $e->getMessage()); } } else { au_fatal_error(5, "Used " . $aulis['db_driver'] . " as database type."); } // Transfer the connection to $aulis return $aulis['db'] = $db; }
function au_load_language($language = '') { global $aulis, $setting; // So did we actually provide ourselves with a language? If the language is empty... it doesn't work, like at all if (empty($language)) { return false; } // Let's create a variable to make things a little more readable $language_main_path = au_get_path_from_root('languages/' . $language . '.php'); // Does this language exist? if (!file_exists($language_main_path)) { return au_fatal_error(4, "Language files were not found."); } // It does exists, let's load the main file include_once $language_main_path; // Now all other files foreach ($setting['sub_files'] as $filename) { include au_get_path_from_root('languages/' . $language . '.' . $filename . '.php'); } // We might need this $setting['lang_current'] = $language; return true; }
function au_load_template($template, $execute_function = true) { // Global setting global $setting; // Which file paths do we need? $filename = au_get_path_from_root("themes/" . $setting['theme'] . "/templates/" . $template . ".php"); $filename_hannover = au_get_path_from_root("themes/hannover/templates/" . $template . ".php"); $settings_file_hannover = au_get_path_from_root("themes/hannover/theme_settings.php"); // If it exists, all is right, return the include if (file_exists($filename)) { $fallback = !(require_once $filename); } elseif (file_exists($filename_hannover)) { $fallback = (require_once $filename_hannover); } else { return au_fatal_error(3, "Template '" . $filename_hannover . "' was not found."); } // We need to load the hannover settings file, if we have a fallback situation and if it hasn't been loaded already if ($fallback and !defined('HANNOVER_SETTINGS')) { // We need to load the settings from hannover if (file_exists($settings_file_hannover)) { require_once $settings_file_hannover; } else { return au_fatal_error(3, "Settings file '{$settings_hannover}' could not be loaded, it does not exist."); } } // The name of the template's main function $function = 'au_template_' . $template; // We need to know whether we can exectute the template's main function if ($execute_function == true and !function_exists($function)) { return au_fatal_error(3, "The template '{$template}' ('" . $filename . "') should have a function called '{$function}();', this function was not found."); } // We can execute our function, hooray if ($execute_function == true) { return call_user_func($function); } }
$current_app = 'frontpage'; } else { $current_app = $_GET['app']; } // Do we need to load an extra file? if ($aulis['apps'][$current_app]['load_file'] == true) { require_once $aulis['root_path'] . '/core/' . $aulis['apps'][$current_app]['core']; } // So where are we now? $aulis['active'] = $aulis['apps'][$current_app]['section']; // We need a page title. Let's create one. $aulis['page_title'] = (!empty($aulis['apps'][$current_app]['title']) ? $aulis['apps'][$current_app]['title'] . ' | ' : '') . $setting['site_title'] . (!empty($setting['site_slogan']) ? ' | ' . $setting['site_slogan'] : ''); // Let's execute the function, if we need to. if ($aulis['apps'][$current_app]['execute_function'] == true) { // Let's check if the function even exists if (function_exists($aulis['apps'][$current_app]['function'])) { call_user_func($aulis['apps'][$current_app]['function']); } else { return au_fatal_error(6, "Core '{$current_app}' wanted to excecute the function '{$aulis['apps'][$current_app]['function']}();'."); } } // Now it's time to finalize our output and call in the theme's base template au_finalize_output(); // Calling the theme..., let's hope it responds our call. au_load_theme($setting['theme']); // Now if we need to cache, we need to cache, obviously if ($setting['enable_cache'] == 1 && !DEBUG_FORCE_DISABLE_CACHE) { require_once au_get_path_from_root('cache/cache_end.php'); } // In the end, there is nothing left but star dust. die;