include 'inc/inc_version.php'; // Test if LCM is installed if (!include_config_exists('inc_connect')) { header('Location: install.php'); exit; } // For profiling: count the number of SQL queries $GLOBALS['db_query_count'] = 0; include_lcm('inc_auth'); include_lcm('inc_acc'); include_lcm('inc_presentation'); include_lcm('inc_text'); include_lcm('inc_filters'); include_lcm('inc_keywords'); // include_lcm('inc_calendar'); [ML] not used if (!include_data_exists('inc_meta_cache')) { write_metas(); } // Just precaution, avoids PHP warnings sometimes if (!isset($_SESSION['form_data'])) { $_SESSION['form_data'] = array(); } // [AG] Adding to validate later references to it global $author_session; // // Preferences for presentation // Can be done from any screen, but for now most is in config_author.php // The presence of author_ui_modified assumed that all other form variables are set. // [AG] added author_advanced_settings_modified to split settings into tabs // // Clear preferences modified flag
function lcm_panic($message) { global $lcm_version, $lcm_db_version; function lcm_ini_get($param) { $ret = ini_get($param); return $ret ? $ret : 'n/a'; } echo "<p>" . _T('warning_panic_is_useful') . "</p>\n"; $error = "[INTERNAL] (v" . $lcm_version . "-db" . $lcm_db_version . ", PHP v" . PHP_VERSION . ")\n"; $error .= "Server: " . $_SERVER['SERVER_SOFTWARE'] . "\n"; if (function_exists('lcm_sql_server_info')) { $error .= "SQL server: " . lcm_sql_server_info() . "\n"; } else { $error .= "SQL server: not yet connected\n"; } $error .= "Referer: " . $_SERVER['HTTP_REFERER'] . "\n"; $error .= "Request: " . $_SERVER['REQUEST_METHOD'] . " " . $_SERVER['REQUEST_URI'] . "\n"; $error .= "Error: " . $message . "\n"; // Show DB version in meta cache $error .= "Version-DB: " . read_meta('lcm_db_version') . " (in cache)\n"; // Show existence + size of cache, in case it doesnt exist, or there were // problems while generating it (i.e. it will be less than 30kb) if (include_data_exists('inc_meta_cache')) { if (isset($_SERVER['LcmDataDir'])) { $prefix = $_SERVER['LcmDataDir'] . '/'; } else { $prefix = 'inc/data/'; } $error .= "inc_meta_cache: exists (" . filesize($prefix . 'inc_meta_cache.php') . " bytes)\n"; } else { $error .= "inc_meta_cache: does NOT exists\n"; } $check_confs = array('safe_mode', 'safe_mode_gid', 'safe_mode_include_dir', 'safe_mode_exec_dir', 'open_basedir', 'disable_functions'); foreach ($check_confs as $conf) { $error .= $conf . ': ' . lcm_ini_get($conf) . "\n"; } if ($GLOBALS['debug']) { $error .= "cookie_prefix: " . $GLOBALS['cookie_prefix'] . "\n"; $error .= "table_prefix: " . $GLOBALS['table_prefix'] . "\n"; $error .= "_GET: " . get_var_dump($_GET) . "\n"; $error .= "_POST: " . get_var_dump($_POST) . "\n"; $error .= "_COOKIE: " . get_var_dump($_COOKIE) . "\n"; $error .= "_SERVER: " . get_var_dump($_SERVER) . "\n"; $error .= "included_files: " . get_var_dump($GLOBALS['included_files']) . "\n"; $error .= "meta: " . get_var_dump($GLOBALS['meta']) . "\n"; } // Too much paranoia? I am not even sure if we can inject code // either XSS or shellcode .. but should not hurt.. $error = htmlspecialchars($error); // Make different lcm_getbacktrace() calls to avoid html in logs lcm_log($error . lcm_getbacktrace(false) . "END OF REPORT\n"); die("<pre>" . $error . " " . lcm_getbacktrace() . "END OF REPORT\n</pre>"); }