$_SESSION['glpi_use_mode'] = Session::NORMAL_MODE;
if (!isset($_SESSION['glpilanguage'])) {
    $_SESSION['glpilanguage'] = 'fr_FR';
}
$_SESSION['glpi_fusionionventory_nolock'] = TRUE;
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
set_error_handler(array('Toolbox', 'userErrorHandlerDebug'));
$_SESSION['glpi_use_mode'] = 0;
$_SESSION['glpiparententities'] = '';
$_SESSION['glpishowallentities'] = TRUE;
ob_end_clean();
header("server-type: glpi/fusioninventory " . PLUGIN_FUSIONINVENTORY_VERSION);
if (!class_exists("PluginFusioninventoryConfig")) {
    header("Content-Type: application/xml");
    echo "<?xml version='1.0' encoding='UTF-8'?>\n<REPLY>\n   <ERROR>Plugin FusionInventory not installed!</ERROR>\n</REPLY>";
    session_destroy();
    exit;
}
$pfCommunication = new PluginFusioninventoryCommunication();
if (!isset($rawdata)) {
    $rawdata = file_get_contents("php://input");
}
if (isset($_GET['action']) && isset($_GET['machineid'])) {
    PluginFusioninventoryCommunicationRest::handleFusionCommunication();
} else {
    if (!empty($rawdata)) {
        $pfCommunication->handleOCSCommunication($rawdata);
    }
}
session_destroy();