/**
* Init function
* @ingroup Core
*/
function xanth_init()
{
    global $start_time;
    $start_time = gettimeofday(TRUE);
    ob_start();
    xanth_db_query_reset_count();
    set_error_handler('xanth_php_error_handler');
    xanth_db_connect(xanth_conf_get('db_host', ''), xanth_conf_get('db_name', ''), xanth_conf_get('db_user', ''), xanth_conf_get('db_pass', ''), xanth_conf_get('db_port', ''));
    session_set_save_handler("on_session_start", "on_session_end", "on_session_read", "on_session_write", "on_session_destroy", "on_session_gc");
    session_start();
    xComponent::init_all();
    xModule::init_all();
    //xTheme::find_default()->init();
    xanth_invoke_multi_hook(MULTI_HOOK_PAGE_CREATE_EVT, NULL);
    xanth_invoke_mono_hook(MONO_HOOK_PAGE_CREATE, NULL);
    //print log
    echo '<br />';
    echo '<br />';
    echo '<br />';
    echo '<br />';
    echo '<br />';
    foreach (xanth_get_screen_log() as $entry) {
        echo '<br />' . $entry->level . ' ' . $entry->component . ' ' . $entry->message . ' ' . $entry->filename . '@' . $entry->line;
    }
    session_write_close();
    echo ob_get_clean();
}
        $weight_func = 'xanth_db_install_weight_' . $component->name;
        $weighted_components[] = array($weight_func(), $component);
    }
    usort($weighted_components, 'weight_cmp');
    foreach ($weighted_components as $component) {
        $inst_func = 'xanth_db_install_' . $component[1]->name;
        $inst_func();
    }
    $weighted_modules = array();
    foreach (xModule::find_existing() as $module) {
        include_once $module->path . '/install.inc.php';
        $weight_func = 'xanth_db_install_weight_' . $module->name;
        $weighted_modules[] = array($weight_func(), $module);
    }
    usort($weighted_modules, 'weight_cmp');
    foreach ($weighted_modules as $module) {
        $inst_func = 'xanth_db_install_' . $module[1]->name;
        $inst_func();
    }
    xanth_db_commit();
}
xanth_db_connect(xanth_conf_get('db_host', ''), xanth_conf_get('db_name', ''), xanth_conf_get('db_user', ''), xanth_conf_get('db_pass', ''), xanth_conf_get('db_port', ''));
error_reporting(E_ALL);
xComponent::init_all();
xModule::init_all();
xanth_install_db();
//print log
foreach (xanth_get_screen_log() as $entry) {
    echo '<br />' . $entry->level . ' ' . $entry->component . ' ' . $entry->message . ' ' . $entry->filename . '@' . $entry->line;
}
echo "xanthin+ successfully installed";