} } function debuglog($message, $target = 0) { global $session; $sql = "DELETE from debuglog WHERE date <'" . date("Y-m-d H:i:s", strtotime("-" . getsetting("expirecontent", 180) / 10 . " days")) . "'"; db_query($sql); $sql = "INSERT INTO debuglog VALUES(0,now(),{$session['user']['acctid']},{$target},'" . addslashes($message) . "')"; db_query($sql); } if (file_exists("dbconnect.php")) { require_once "dbconnect.php"; } else { echo "You must edit the file named \"dbconnect.php.dist,\" and provide the requested information, then save it as \"dbconnect.php\"" . exit; } $link = db_pconnect($DB_HOST, $DB_USER, $DB_PASS) or die(db_error($link)); //define("LINK",$link); require_once "translator.php"; session_register("session"); function register_global(&$var) { @reset($var); while (list($key, $val) = @each($var)) { global ${$key}; ${$key} = $val; } @reset($var); } $session =& $_SESSION['session']; //echo nl2br(htmlentities(output_array($session))); //register_global($_SESSION);
global $g_queries_array; $t_unique_queries = 0; $t_shown_queries = array(); foreach ($g_queries_array as $t_val_array) { if (!in_array($t_val_array[0], $t_shown_queries)) { $t_unique_queries++; array_push($t_shown_queries, $t_val_array[0]); } } return $t_unique_queries; } # -------------------- # get total time for queries function db_time_queries() { global $g_queries_array; $t_count = count($g_queries_array); $t_total = 0; for ($i = 0; $i < $t_count; $i++) { $t_total += $g_queries_array[$i][1]; } return $t_total; } # -------------------- if (!isset($g_skip_open_db)) { if (OFF == $g_use_persistent_connections) { db_connect(config_get_global('dsn', false), $g_hostname, $g_db_username, $g_db_password, $g_database_name); } else { db_pconnect(config_get_global('dsn', false), $g_hostname, $g_db_username, $g_db_password, $g_database_name); } }
exit; } // Set multibyte encoding to UTF-8 if (@function_exists('mb_internal_encoding')) { mb_internal_encoding("UTF-8"); } else { printmsg("INFO => Missing 'mb_internal_encoding' function. Please install PHP 'mbstring' functions for proper UTF-8 encoding.", 0); } // If we dont have a ona_context set in the cookie, lets set a cookie with the default context if (!isset($_COOKIE['ona_context_name'])) { $_COOKIE['ona_context_name'] = $conf['default_context']; setcookie("ona_context_name", $conf['default_context']); } // (Re)Connect to the DB now. global $onadb; $onadb = db_pconnect('', $_COOKIE['ona_context_name']); // Load the actual user config from the database table sys_config // These will override any of the defaults set above list($status, $rows, $records) = db_get_records($onadb, 'sys_config', 'name like "%"', 'name'); foreach ($records as $record) { printmsg("INFO => Loaded config item from database: {$record['name']}=''{$record['value']}''", 5); $conf[$record['name']] = $record['value']; } // Include functions that replace the default session handler with one that uses MySQL as a backend require_once $conf['inc_db_sessions']; // Include the GUI functions require_once $conf['inc_functions_gui']; // Include the AUTH functions require_once $conf['inc_functions_auth']; // Start the session handler (this calls a function defined in functions_general) startSession();