':''; print 'FATAL: Connection to Cacti database failed. Please insure the database is running and your credentials in config.php are valid.'; print $is_web ? '

':''; exit; } /* include additional modules */ include_once($config['library_path'] . '/functions.php'); set_error_handler('CactiErrorHandler'); register_shutdown_function('CactiShutdownHandler'); /* verify the cacti database is initialized before moving past here */ db_cacti_initialized($is_web); include_once($config['include_path'] . '/global_constants.php'); if ($is_web) { /* Sanity Check on "Corrupt" PHP_SELF */ if ($_SERVER['SCRIPT_NAME'] != $_SERVER['PHP_SELF']) { echo "\nInvalid PHP_SELF Path \n"; db_close(); exit; } /* we don't want these pages cached */ header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); /* prevent IE from silently rejects cookies sent from third party sites. */ header('P3P: CP="CAO PSA OUR"'); /* initialize php session */ session_name($cacti_session_name); if (!session_id()) session_start(); if (get_magic_quotes_gpc()) { $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); while (list($key, $val) = each($process)) { foreach ($val as $k => $v) { unset($process[$key][$k]); if (is_array($v)) { $process[$key][stripslashes($k)] = $v; $process[] = &$process[$key][stripslashes($k)]; } else { $process[$key][stripslashes($k)] = stripslashes($v); } } } unset($process); } /* make sure to start only only Cacti session at a time */ if (!isset($_SESSION['cacti_cwd'])) { $_SESSION['cacti_cwd'] = $config['base_path']; }else{ if ($_SESSION['cacti_cwd'] != $config['base_path']) { session_unset(); session_destroy(); } } } /* emulate 'register_globals' = 'off' if turned on */ if ((bool)ini_get('register_globals')) { $not_unset = array('_GET', '_POST', '_COOKIE', '_SERVER', '_SESSION', '_ENV', '_FILES', 'database_type', 'database_default', 'database_hostname', 'database_username', 'database_password', 'config', 'colors'); /* Not only will array_merge give a warning if a parameter is not an array, it will * actually fail. So we check if HTTP_SESSION_VARS has been initialised. */ if (!isset($_SESSION)) { $_SESSION = array(); } /* Merge all into one extremely huge array; unset this later */ $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_SESSION, $_ENV, $_FILES); unset($input['input']); unset($input['not_unset']); while (list($var,) = @each($input)) { if (!in_array($var, $not_unset)) { unset($$var); } } unset($input); } /* gather the existing cactidb version */ $config['cacti_db_version'] = db_fetch_cell("SELECT cacti FROM version LIMIT 1"); include_once($config['include_path'] . '/global_languages.php'); include_once($config['library_path'] . '/auth.php'); include_once($config['library_path'] . '/plugins.php'); include_once($config['include_path'] . '/plugins.php'); include_once($config['include_path'] . '/global_arrays.php'); include_once($config['include_path'] . '/global_settings.php'); include_once($config['include_path'] . '/global_form.php'); include_once($config['library_path'] . '/html.php'); include_once($config['library_path'] . '/html_form.php'); include_once($config['library_path'] . '/html_utility.php'); include_once($config['library_path'] . '/html_validate.php'); include_once($config['library_path'] . '/variables.php'); include_once($config['library_path'] . '/mib_cache.php'); include_once($config['library_path'] . '/snmpagent.php'); include_once($config['library_path'] . '/aggregate.php'); include_once($config['library_path'] . '/api_automation.php'); /* cross site request forgery library */ if ($is_web) { function csrf_startup() { global $config; csrf_conf('rewrite-js', $config['url_path'] . 'include/csrf/csrf-magic.js'); } include_once($config['include_path'] . '/csrf/csrf-magic.php'); if (isset_request_var('newtheme')) { unset($_SESSION['selected_theme']); } if (read_config_option('force_https') == 'on') { if (!isset($_SERVER['HTTPS']) && isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "\n\n"); exit; } } } api_plugin_hook('config_insert'); /* current cacti version */ $config['cacti_version'] = '1.0.0';