<?php
$config_servernameorip = (isset($_SERVER['HTTPS']) ? "https" : "http")."://$_SERVER[HTTP_HOST]";

define ('XIM_APP_NAME', "EOQUAL" );
define ('XIM_APP_CLIENT', "XIMEO-PC01" );

$GLOBALS['approot'] = '/eoQUALBootstrap';

// Libraries
$GLOBALS['ximlibwebbasepath']	='/ximlibweb';



$config_approot = $GLOBALS['approot'];

$config_cssversion 		= '1';

//DB INFO
$GLOBALS["DB_PORT"] 	= "5432";
$GLOBALS["DB_IP"] 		= "localhost";
$GLOBALS["DB_NAME"]     = "eoQUAL";

$GLOBALS["DB_USER"] 	= "postgres";
$GLOBALS["DB_PWD"] 		= "manager";



/** DEBUG */
$GLOBALS["active_debug"] 	= false;
$GLOBALS["debug_dir"] 		= 'c:/foo/';
/******************************************************************************/

/** REPORT DEFAULT TEMPLATE */
$GLOBALS["default_templateid"] = 34;

/******************************************************************************/
/** CALENDAR **/

$GLOBALS["calendar_defaultview"] 	= 0;		// 0: day, 1 : week, 2: fullweek
$GLOBALS["calendar_hoursize"]		= 60;		// Pixels
$GLOBALS["calendar_firsthour"]		= 7;		
$GLOBALS["calendar_lasthour"]		= 19;
$GLOBALS["calendar_division"]		= 10;		// Minutes
$GLOBALS["calendar_modalschedtype"]	=  1;		// 0 : modality, 1 : ragiologists
/*
$GLOBALS["PACS_DB_PORT"]=5432;
$GLOBALS["PACS_DB_IP"]="localhost";
$GLOBALS["PACS_DB_NAME"]="eoPACS";
$GLOBALS["PACS_DB_USER"]="postgres";
$GLOBALS["PACS_DB_PWD"]="manager";
*/

//RIS DB INFO
$GLOBALS["DB_PORT_RIS"] = "5433";
$GLOBALS["DB_IP_RIS"] = "192.168.64.10";	// "10.0.0.130";
$GLOBALS["DB_NAME_RIS"] = "eoRISDev";
$GLOBALS["DB_USER_RIS"] = "postgres";
$GLOBALS["DB_PWD_RIS"] = "manager";


$GLOBALS["EOQUAL_SERVER_URL"]   = "http://192.168.64.10";
$GLOBALS["EOQUAL_FOLDER"]       = '/eoQUALBootstrap';
$GLOBALS["EOQUAL_ROOT"]         = $GLOBALS["EOQUAL_FOLDER"];


$GLOBALS["date_planned_maintenance"] = "now() + interval '1 month'";
$GLOBALS["date_planned_inspection"] = "now() + interval '1 month'";


$GLOBALS["upload_folder"] 			= $_SERVER["DOCUMENT_ROOT"].$GLOBALS["approot"]."/uploads";


// =======================================================================================================
// Document storage
//

$GLOBALS["document_storage_url"]    = "http://192.168.64.10/eoQUALData";
$GLOBALS["document_storage"]        = "c:/XIMEO/eoQUAL/Storage";
// Warning un alias doit être défini dans la configuration d'Apache pour refléter les 2 chemins ci-dessus

// =======================================================================================================

$GLOBALS["onlyoffice_temp_folder"] 	= "/var/www/html/eoQUALBootstrap/OnlyOffice/documents";
$GLOBALS["onlyoffice_server"]  	    = "http://192.168.64.184";  // OnlyOffice Document Server


$GLOBALS["connector_ris_user"] 		= "get_eoris_user.php";
$GLOBALS["connector_ris_modality"] 	= "get_eoris_modality.php";
$GLOBALS['connector_ris_chart'] 	= '../database/common/statistic/get_eoris_chart.php';
$GLOBALS["connector_ris_data"] 		= "get_eoris_data.php";



if ( !isset ($GLOBALS["onlyoffice_server"]) )
{
    $interface = 'enp0s3';
    $output = shell_exec("ip -4 addr show $interface");

    if (preg_match('/inet ([0-9\.]+)\//', $output, $matches)) 
    {
        $ipv4 = $matches[1];

        $GLOBALS["onlyoffice_server"] = "http://".$ipv4;
        error_log ( "OnlyOffice server address : ".$GLOBALS["onlyoffice_server"] );
    } 
    else 
    {
        error_log ( "Impossible de trouver l'adresse IPv4 pour l'interface".$interface);
    }
}

?>
