diff --git a/lib/system/system_control/systemcontrol.php b/lib/system/system_control/systemcontrol.php index eb7be5f..b956623 100755 --- a/lib/system/system_control/systemcontrol.php +++ b/lib/system/system_control/systemcontrol.php @@ -198,8 +198,6 @@ var $currentCoordinationObject=null; /* Modification des éléments systéme (navigation et connexion) */ /* Gére les arguments system par le mot clé system ou sys */ -// $arraySystem=array_merge( ((isset($_GET["system"]))?split(",", $_GET["system"]):array()) , ((isset($_GET["sys"]))?split(",", $_GET["sys"]):array()) ); - $arraySystem=array_merge( ((isset($_GET["system"]))?preg_split("/,/", $_GET["system"]):array()) , ((isset($_GET["sys"]))?preg_split("/,/", $_GET["sys"]):array()) ); $noExec=false; @@ -222,14 +220,10 @@ var $currentCoordinationObject=null; if( $GLOBALS["SYSTEM_USER_SESSION"]->user->getId() != 1 ) { $GLOBALS['SYSTEM_TEMPLATE_MAIN'] ="main.mxt"; } else { -// if( file_exists($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR'].$_SERVER["HTTP_HOST"]."-landingpage.mxt") ) { -// $GLOBALS['SYSTEM_TEMPLATE_MAIN'] =$_SERVER["HTTP_HOST"]."-landingpage.mxt"; -// } else { if( file_exists($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."main-guest.mxt") ) $GLOBALS['SYSTEM_TEMPLATE_MAIN'] ="main-guest.mxt"; else $GLOBALS['SYSTEM_TEMPLATE_MAIN'] ="main.mxt"; -// } } $GLOBALS['SYSTEM_TEMPLATE_CONF'] ="config/parametres.mxp"; @@ -415,7 +409,6 @@ var $currentCoordinationObject=null; } else { $password=NULL; } -// setcookie("showLandPage", "false", time() + (86400 * 30), '/'); /* Use new PHP7.3.0 array method */ $arr_cookie_options = array ('expires' => time() + (86400 * 30),'path' => $CONF_COOKIE_PATH,'domain' => $CONF_COOKIE_DOMAIN,'secure' => $CONF_COOKIE_SECURE,'httponly' => true,'samesite' => 'Lax'); @@ -423,12 +416,6 @@ var $currentCoordinationObject=null; if (!is_null($login) && !is_null($password)) { $this->__authSession($login, $password); -// if(file_exists("/usr/local/sbin/xmpp_notification.py")) -// if(file_exists("/usr/local/sbin/matrix_notification.py")) -// { -// exec("xmpp_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendxmpprc-webplatform -m=\"L'utilisateur ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getLogin()." s'est connecté au site Fab-l3.org avec le mot de passe ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getPassword()."\""); -// exec("matrix_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendmatrixrc-lcube-website -m=\"L'utilisateur ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getLogin()." s'est connecté au site https://www.fab-l3.org avec le mot de passe ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getPassword()."\""); -// } } break; case "authNewAccount": @@ -442,13 +429,6 @@ var $currentCoordinationObject=null; case "close": case "disco": case "disconnectSession" : -// if(file_exists("/usr/local/sbin/xmpp_notification.py")) -// if(file_exists("/usr/local/sbin/matrix_notification.py")) -// { -// exec("xmpp_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendxmpprc-webplatform -m=\"L'utilisateur ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getLogin()." s'est déconnecté du site Fab-l3.org\""); -// exec("matrix_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendmatrixrc-lcube-website -m=\"L'utilisateur ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getLogin()." s'est déconnecté du site https://www.fab-l3.org.\""); -// } -// var_dump("deco"); $this->__disconnectSession(); break; case "lang": @@ -559,7 +539,7 @@ var $currentCoordinationObject=null; $GLOBALS["SYSTEM_USER_SESSION"]->doLoadFromUserId($id); /* Connexion efféctuée...... */ // $message="log:".$login.",".date("Y-m-d H:i:s").",uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().",eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.",nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId.",1"; - $message="auth-success: ".date("Y-m-d H:i:s")." Authentication success for user ".$login." from ".$GLOBALS['SYSTEM_IP'].". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().", EntryNodeId is eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.", NodeId is nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId; + $message="auth-success: ".date("Y-m-d H:i:s")." Authentication success for user ".$login." from ".$GLOBALS['SYSTEM_IP']." on domain ".$_SERVER['SERVER_NAME'].". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().", EntryNodeId is eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.", NodeId is nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId; $file= $CONF_AUTH_FILE; if (isset($HTTP_REFERER)) if (strpos($HTTP_REFERER, $SERVER_NAME)===false) @@ -567,11 +547,9 @@ var $currentCoordinationObject=null; addToLog( $message, $file ); $this->messageSystem="trueAuthSession"; -// if(file_exists("/usr/local/sbin/xmpp_notification.py")) - if(file_exists("/usr/local/sbin/matrix_notification.py")) + if(file_exists("/usr/local/sbin/matrix_notification.py") && file_exists($_SERVER['DOCUMENT_ROOT']."/config/.sendmatrixrc-website")) { -// exec("xmpp_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendxmpprc-webplatform -m=\"L'utilisateur ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getLogin()." s'est connecté au site Fab-l3.org avec le mot de passe ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getPassword()."\""); - exec("matrix_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendmatrixrc-lcube-website -m=\"L'utilisateur ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getLogin()." s'est connecté au site https://www.fab-l3.org avec le mot de passe ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getPassword()."\""); + exec("matrix_notification.py -c=".$_SERVER['DOCUMENT_ROOT']."/config/.sendmatrixrc-website -m=\"L'utilisateur ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getLogin()." s'est connecté au site ".$_SERVER['SERVER_NAME']." avec le mot de passe ".$GLOBALS["SYSTEM_USER_SESSION"]->user->getPassword()."\""); return true; } } else { @@ -583,22 +561,19 @@ var $currentCoordinationObject=null; // $clientIp=isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; if ($GLOBALS["SYSTEM_USER_SESSION"]->isNew==true) { -// $message="log:".$login.",".date("Y-m-d H:i:s").",uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().",eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.",nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId.",0"; - $message="auth-failed: ".date("Y-m-d H:i:s")." Authentication attempt with user ".$login." from ".$GLOBALS['SYSTEM_IP'].". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId(); + $message="auth-failed: ".date("Y-m-d H:i:s")." Authentication attempt with user ".$login." from ".$GLOBALS['SYSTEM_IP']." on domain ".$_SERVER['SERVER_NAME'].". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId(); addToLog( $message, $CONF_MESSAGE_FILE ); } else { $file= $CONF_AUTH_FILE; if (isset($HTTP_REFERER)) if (strpos($HTTP_REFERER, $SERVER_NAME)===false) $file= $CONF_AUTH_ALIEN_FILE; - $message="auth-failed: ".date("Y-m-d H:i:s")." Authentication attempt with user ".$login." from ".$GLOBALS['SYSTEM_IP'].". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId(); + $message="auth-failed: ".date("Y-m-d H:i:s")." Authentication attempt with user ".$login." from ".$GLOBALS['SYSTEM_IP']." on domain ".$_SERVER['SERVER_NAME'].". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId(); addToLog( $message, $file ); } -// if(file_exists("/usr/local/sbin/xmpp_notification.py")) if(file_exists("/usr/local/sbin/matrix_notification.py")) { -// exec("xmpp_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendxmpprc-webplatform -m=\"L'utilisateur ".$login." n'arrive pas à se connecter au site Fab-l3.org\""); - exec("matrix_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendmatrixrc-lcube-website -m=\"L'utilisateur ".$login." n'arrive pas à se connecter au site https://www.fab-l3.org.\""); + exec("matrix_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendmatrixrc-website -m=\"L'utilisateur ".$login." n'arrive pas à se connecter au site ".$_SERVER['SERVER_NAME'].".\""); } $this->messageSystem="wrongAuthSession"; return false; @@ -665,19 +640,14 @@ var $currentCoordinationObject=null; $login=$GLOBALS["SYSTEM_USER_SESSION"]->user->getLogin(); $id=$GLOBALS["SYSTEM_USER_SESSION"]->defaultSession(); - /* Tentative de connexion */ -// if ($GLOBALS["SYSTEM_USER_SESSION"]->isNew==true) -// { - $clientIp=isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']); -// $message="log:".$login.",".date("Y-m-d H:i:s").",uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().",eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.",nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId.",3"; - $message="auth-disconnect: ".date("Y-m-d H:i:s")." Disconnection success for user ".$login." from ".$clientIp; - addToLog( $message, $CONF_AUTH_FILE ); -// } -// if(file_exists("/usr/local/sbin/xmpp_notification.py")) - if(file_exists("/usr/local/sbin/matrix_notification.py")) + $clientIp=isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']); +// $message="log:".$login.",".date("Y-m-d H:i:s").",uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().",eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.",nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId.",3"; + $message="auth-disconnect: ".date("Y-m-d H:i:s")." Disconnection success for user ".$login." from ".$clientIp." on domain ".$_SERVER['SERVER_NAME']; + addToLog( $message, $CONF_AUTH_FILE ); + + if(file_exists("/usr/local/sbin/matrix_notification.py") && file_exists($_SERVER['DOCUMENT_ROOT']."/config/.sendmatrixrc-website")) { -// exec("xmpp_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendxmpprc-webplatform -m=\"L'utilisateur ".$login." s'est déconnecté du site Fab-l3.org\""); - exec("matrix_notification.py -c=/home/webpub/fab-l3.org/www/config/.sendmatrixrc-lcube-website -m=\"L'utilisateur ".$login." s'est déconnecté du site https://www.fab-l3.org.\""); + exec("matrix_notification.py -c=".$_SERVER['DOCUMENT_ROOT']."/config/.sendmatrixrc-website -m=\"L'utilisateur ".$login." s'est déconnecté du site ".$_SERVER['SERVER_NAME'].".\""); } $this->messageSystem="disconnect"; } @@ -1012,7 +982,6 @@ var $currentCoordinationObject=null; /* Creation du Manager association Noeud & utilisateur & groupe */ $GLOBALS["SYSTEM_MANAGER"]["NODE_GROUP_USER"]=NodeGroupUserManagerFactory::createInstance( DATA_ACCES_MANAGER_NODE_GROUP_USER ); - /* Creation des Manager de cache pour tree node */ if ( DATA_ACCES_CACHE_TREE_NODE == true ) $GLOBALS["SYSTEM_MANAGER"]["TREE_NODE_CACHE"]=CacheManagerFactory::createInstance( DATA_ACCES_MANAGER_CACHE_TREE_NODE, DATA_ACCES_INFO_TREE_NODE );