clear(); return $myPage; } // initialisation statique "simple" public static function init() : void { if ( ! is_dir( self::getAppPath() ) ) die( "\darkauth\DwDarkAuth::init()[error] no app dir! '".self::getAppPath()."'" ); if ( ! is_dir( self::getDataPath() ) ) die( "\darkauth\DwDarkAuth::init()[error] no data dir! '".self::getDataPath()."'" ); if ( ! is_dir( self::getRamDataPath() ) ) die( "\darkauth\DwDarkAuth::init()[error] no ram data dir! '".self::getRamDataPath()."'" ); } private static $instanceForNode; //\darkauth\DwDarkAuth::isNode(); public static function isNode() : bool { if ( ! isset( self::$instanceForNode ) ) { $nodeVarDir="/var/node"; self::$instanceForNode = substr( self::getAppPath() ,0 ,strlen( $nodeVarDir ) ) == "{$nodeVarDir}" ; } return self::$instanceForNode; } //\darkauth\DwDarkAuth::getNodePath(); public static function getNodePath() : string { return "/var/node/".self::getNodeId(); } private static $nodeId; // \darkauth\DwDarkAuth::getNodeId(); public static function getNodeId() : string { if ( ! isset( self::$nodeId ) ) { if ( self::isNode() ) { $frDarkwebNetworkDir = realpath( self::getAppPath()."/.." ); $nodeVarDir="/var/node"; if ( "{$nodeVarDir}" == substr( $frDarkwebNetworkDir ,0 ,strlen( $nodeVarDir ) ) ) { $nodePath = realpath( $frDarkwebNetworkDir . '/..' ); self::$nodeId = substr( $nodePath ,strrpos( $nodePath ,'/' )+1 ); } else { die( "echec nodeID" ); } }elseif ( isset( $_SERVER ) && isset( $_SERVER[ "NODE_ID" ] ) ) self::$nodeId = $_SERVER[ "NODE_ID" ]; } return self::$nodeId; } } \darkauth\DwDarkAuth::init(); ?>