<?php

/**-----------------------------------------------
*
* Rooty, 2018 <rooty@rooty.me>
*
*
* This software is protected by copyright, please
* read the file COPYRIGHT.
* This program is distributed in the hope that it
* will be useful, but without any warranty; without
* even the implied warranty of merchantability or
* fitness for a particular purpose. Please
* read the file LICENCE.
*
* Ce fichier contient la classe InstallManager (gestion des installations granilim)
* @copyright Copyright &copy; 2009-2018, Rooty
* @author Rooty <www.rooty.me|rooty@rooty.me>
* @since 2004/06/07
* @version 0.3
* @link www.rooty.me
* @package object_coordination
* @subpackage InstallManager
*/
if ( !defined('SYSTEM_IN') )
{
die("Hacking attempt");
}


/**
* Temps avant reactualisation du cache ftp en minute
*/
define ("CACHETIME",0);

/**
* Classe InstallManager
*
* classe de gestion des instance d'objets de coordination
*
* @package object_coordination
* @subpackage InstallManager
*/
Class InstallManager extends CoordinationObj
{
/**
* @access private
* @return true
*/
	function tabeCreate()
	{
		$tabPictoTabe = array("eye","minus", "cogs");
		$tabTabe = array("BtnUpload","BtnInstall", "BtnBkp");
		$tabAction = array(array("actionInstall"), array("listInstall", "beforeInstall", "install","afterInstall", "beforeUninstall", "uninstall", "afterUninstall"), array("bkpManageInstall"));
		$tabUrlTabe = array(formatUrl($this->getId(), "InstallManager", "actionInstall"),formatUrl($this->getId(), "InstallManager", "listInstall"),formatUrl($this->getId(), "InstallManager", "bkpManageInstall"));
		printTabeAdmin("TabeB",$tabTabe, $tabUrlTabe, $tabPictoTabe, $tabAction);
		return true;
	}

/**
* actionAdmin:affichage de l'interface principale de gestion des droits utilisateurs
*<P>Permet l'affichage des packets disponibles pour l'administrateur</P>
*<P>Note: # Cette methode se sert du fichier "message" InstallManager.ini</P>
*<p>Le nom du répertoire ftp doit être de la forme:<br/>
* type-nom_package-version (garder le - comme séparateur.)<br/>
* avec type=<br/>
* - template<br/>
* - object_coordination<br/>
* - object_plugin<br/>
* - object_printing<br/>
* - upgrade<br/>
*</p>
* @access public
* @return chaine code message
*/
	function actionInstall()
	{
		addMessageFile("installmanager.ini");
		includePackage ("ftp.php");
		includePackage ("backup.php");

		/* gestion du lib en fonction de la langue courante */
		$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
		$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
		/* fin récupèration des codes par defaut */
		
		mxPageTitle("actionInstallTitlePage");
		
		$arrayCallCss = array();
		$arrayCallCss[] = "data/css/dataTables.bootstrap4/1.10.22/dataTables.bootstrap4.min.css";
		mxCallCss($arrayCallCss);
		
		$arrayCallJs = array();
		$arrayCallJs[] = "data/javascript/jquery.dataTables/1.10.22/jquery.dataTables.min.js";
		$arrayCallJs[] = "data/javascript/dataTables.bootstrap4/1.10.22/dataTables.bootstrap4.min.js";
		mxCallJs($arrayCallJs);
		
		$arrayRawJs[] = "\$(document).ready(function(){\$('#tabObjectCoordination').dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		$arrayRawJs[] = "\$(document).ready(function(){\$('#tabObjectPlugin').dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		$arrayRawJs[] = "\$(document).ready(function(){\$('#tabObjectPrinting').dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		$arrayRawJs[] = "\$(document).ready(function(){\$('#tabTemplate').dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		$arrayRawJs[] = "\$(document).ready(function(){\$('#tabUpgrade').dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		mxRawJs($arrayRawJs);
		
		withBlocPath("InstallManager", "actioninstall");

		$this->tabeCreate();
		$tabdir=array();
		$tabpatch=array();
		$tabTmp=array();
		$tabPackage=array();
		$tabSize=array();
		$msg="";
		$detailId=(isset($_GET["detailId"]))?$_GET["detailId"]:"";
		$ftp=$this->getData("ftp");
		$login=$this->getData("login");
		$passwd=$this->getData("passwd");
		$connection	=new ftp($ftp, $login, $passwd);
		$backup		=new backup();
		$cache_time	=null;
		
		#################################################################
		# Récupération des packages disponibles
		#################################################################
// 		$pathCache=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/cache/cache.dat";
// 		if (file_exists($pathCache))
// 		{
// 			$file=new File($pathCache, "r");
// 			$tab=unserialize(base64_decode($file->readAll()));
// 			$file->close();
// 			// On recup aussi $cache_time
// // 			extract($tab);
// 		}

// 		if ( ($cache_time==null) || (date("H:i:s",$cache_time)<date("H:i:s",(time()-mktime(0,CACHETIME,0,0,0)))) )
// 		{
			$tabPackage=array();
			if ($connection->connect())
			{
				//Listing du rep distant
				$tabdir=$connection->getContentDir(".");
				
				//Teste de l'existence des packages et telechargement si on les possede pas deja
				for ($i=0;$i<count($tabdir);$i++)
				{
					//On recupere le nom du package distant et on vérifie si on les possede ou pas
					if (($tabdir[$i][1]=="Directory"))
					{
						//Si pas installer affichage de la liste des packages
						$tabPackage[]=$tabdir[$i][2];
						$tabSize[$tabdir[$i][2]]=$connection->getSize($tabdir[$i][0]."/".$tabdir[$i][2].".tar");
// 						$tabSize[$tabdir[$i][2]]=$connection->getSize($tabdir[$i][0]."/".$tabdir[$i][2]);
					}
				}
				$tab["tabPackage"]=$tabPackage;
				$tab["tabSize"]=$tabSize;
// 				$tab["cache_time"]=time();
// 				$file=new File($pathCache, "w");
// 				$file->addLine(base64_encode(serialize($tab)));
// 				$file->close();
			}
			else
			{
				$msg="MsgConnexionFailed";
			}
// 		}
		
		// on vérifie si les packages sont installés ou non?
		$tabpatch=$backup->getAllPatch();

		for($i=0; $i<count($tabpatch); $i++){
			$tabTmp[]=$tabpatch[$i]["nom"];
		}
		
		// on verifie que les éléments sont uploadés ou non...
		if( $tabDownload=$backup->getContentDir($GLOBALS["CONF_DATA_PATH"]."data/upload/install/packagesrc/") )
		{
            $tabDownLoadCp=array();
            for($i=0;$i<count($tabDownload);$i++)
            {
                if (strpos($tabDownload[$i][2], ".tar")!==false)
                    $tabDownLoadCp[]=substr($tabDownload[$i][2], 0, (strlen($tabDownload[$i][2])-4));
            }
        }
        
		//Teste de l'existence des packages et telechargement si on les possede pas deja
		$nb=count($tabPackage);
		for ($i=0;$i<$nb;$i++)
		{
			//On recupere le nom du package distant et on vérifie si on les possede ou pas
			if ((in_array($tabPackage[$i],$tabTmp)) || (in_array($tabPackage[$i],$tabDownLoadCp)) )
			{
				unset($tabPackage[$i]);
			}
		}
		sort($tabPackage);
		reset($tabPackage);

		#################################################################
		# affichage des éléments
		#################################################################
		$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("urlUpload", formatUrl($this->getId(), "InstallManager", "uploadInstall"));
		$tabDel=array();
		
// 		if( is_array($tabPackage) && count($tabPackage) > 0 )
// 		{
			foreach($tabPackage as $key=>$val)
			{
				$tmp=mb_split("-", $val);
				if (count($tmp)==3)
				{
					###########################################################################
					# Doit-on afficher le détail?
					###########################################################################
					if ($detailId==$val)
					{
						$content=getMessage("TxtDetailNotAvailable");
						$file=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/cache/".$val.".".strtolower(lcode());
						if (!file_exists($file))
						{
							if ($connection->connect())
							{
								$tabFile=$connection->getContentDir("./".$val);
								for($i=0; $i<count($tabFile); $i++){
// 									if($tabFile[0][2]=="./".$val."/".$detailId.".".strtolower(lcode()))
									if($tabFile[0][2]==$detailId.".".strtolower(lcode()))
									{
										if($connection->downloadFile("./".$val."/".$val.".".strtolower(lcode()) , $file))
										{
											$detail=new File($file, "r");
											$content=$detail->readAll();
											$detail->close();
										}
									}
								}
								$connection->close();
							}
						}else{
							$detail=new File($file, "r");
							$content=$detail->readAll();
							$detail->close();
						}
						$GLOBALS["SYSTEM_TEMPLATE"]->MxText($tmp[0].".DETAIL.detail", $content);
					}else{
						$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc($tmp[0].".DETAIL", "delete");
					}
					###########################################################################
					$tabDel[$tmp[0]]=true;
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText($tmp[0].".size", (isset($tabSize[$val]) && $tabSize[$val]!=null)?(round($tabSize[$val]/1024,2)):getMessage("TxtNoSize"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText($tmp[0].".name", $tmp[1]);
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText($tmp[0].".version", $tmp[2]);
					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut($tmp[0].".urlDetail", formatUrl($this->getId(), "InstallManager", "actionInstall", "&detailId=".$val));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText($tmp[0].".BtnView", getMessage("BtnView"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut($tmp[0].".urlDownload", formatUrl($this->getId(), "InstallManager", "downloadSourceInstall", "","&detailId=".$val));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText($tmp[0].".TxtUploadFromFtp", getMessage("TxtUploadFromFtp"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc($tmp[0], "loop");
				}
			}
// 		} else {
// 			systemRedirect(formatUrl($this->getId(),"InstallManager", "actionInstall", "TxtNoPackageAvailable"));
// 			return "";
// 		}
		# On efface les blocs qui ne servent à rien...
		$tabTest=array("object_coordination", "object_printing", "object_plugin", "template", "upgrade");
		foreach($tabTest as $key=>$val)
		{
			if (!isset($tabDel[$val]))
				$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc($val, "delete");
		}
		#################################################################
		return $msg;
	}

/**
* Téléchargement du fichier .tar...
* @access public
* @return chaine code message
*/
	function downloadSourceInstall(){

		includePackage ("ftp.php");
		includePackage ("backup.php");

		$detailId=(isset($_GET["detailId"]))?$_GET["detailId"]:"";
		$ftp=$this->getData("ftp");
		$login=$this->getData("login");
		$passwd=$this->getData("passwd");
		$connection=new ftp($ftp,$login,$passwd);
		
		if($detailId!="")
		{
			if ($connection->connect()){
				$srcPath="./".$detailId."/".$detailId.".tar";
				$destPath=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/packagesrc/".$detailId.".tar";
				if($connection->downloadFile($srcPath, $destPath))
				{
					// Vérification du md5 du fichier...
					$src5Path="./".$detailId."/".$detailId.".md5";
					$dest5Path=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/packagesrc/".$detailId.".md5";
					if ($connection->downloadFile($src5Path, $dest5Path)){
						$tabMd=parse_ini_file($dest5Path);
						if( (isset($tabMd["md5"])) && ($tabMd["md5"]==md5_file($destPath)) ){
							systemRedirect(formatUrl($this->getId(), "InstallManager", "actionInstall", "MsgDownloaded"));
							return "";
						}
					}
					@unlink($destPath);
					@unlink($dest5Path);
					systemRedirect(formatUrl($this->getId(), "InstallManager", "actionInstall", "MsgFailedForMd5"));
					return "";

					$connection->close();
				}
				$connection->close;
			}
		}
		systemRedirect(formatUrl($this->getId(), "InstallManager", "actionInstall", "MsgDownloadError","&detailId=".$detailId));
		return "";
	}

/**
* Interface permettant de lister les package installés ou non...
* @access public
* @return chaine code message
*/
	function listInstall(){

		addMessageFile("installmanager.ini");

		includePackage ("ftp.php");
		includePackage ("backup.php");
		
		/* gestion du lib en fonction de la langue courante */
		$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
		$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
		/* fin récupèration des codes par defaut */
		
		mxPageTitle("listInstallTitlePage");
		
		$arrayCallCss = array();
		$arrayCallCss[] = "data/css/dataTables.bootstrap4/1.10.22/dataTables.bootstrap4.min.css";
		mxCallCss($arrayCallCss);
		
		$arrayCallJs = array();
		$arrayCallJs[] = "data/javascript/jquery.dataTables/1.10.22/jquery.dataTables.min.js";
		$arrayCallJs[] = "data/javascript/dataTables.bootstrap4/1.10.22/dataTables.bootstrap4.min.js";
		mxCallJs($arrayCallJs);
		
		$arrayRawJs[] = "\$(document).ready(function(){\$('#tabObjectCoordination').dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		$arrayRawJs[] = "\$(document).ready(function(){\$('#tabObjectPlugin').dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		$arrayRawJs[] = "\$(document).ready(function(){\$('#tabObjectPrinting').dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		$arrayRawJs[] = "\$(document).ready(function(){\$('#tabTemplate').dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		$arrayRawJs[] = "\$(document).ready(function(){\$('#tabUpgrade').dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		mxRawJs($arrayRawJs);

		withBlocPath("InstallManager", "listinstall");

		$this->tabeCreate();
		$tabdir=array();
		$tabpatch=array();
		$tabTmp=array();
		$msg="";
		$detailId=(isset($_GET["detailId"]))?$_GET["detailId"]:"";
		$ftp=$this->getData("ftp");
		$login=$this->getData("login");
		$passwd=$this->getData("passwd");
		$connection=new ftp($ftp,$login,$passwd);
		$backup=new backup();

		// on vérifie si les packages sont installés ou non?
		$tabpatch=$backup->getAllPatch();

		for($i=0; $i<count($tabpatch); $i++){
			$tabTmp[]=$tabpatch[$i]["nom"];
		}

		// on verifie que les éléments sont uploadés ou non...
		$tabDownload=$backup->getContentDir($GLOBALS["CONF_DATA_PATH"]."data/upload/install/packagesrc/");
		$tabDownLoadCp=array();
		for($i=0;$i<count($tabDownload);$i++)
		{
			if (strpos($tabDownload[$i][2], ".tar")!==false)
			{
				$tabDownLoadCp[]=substr($tabDownload[$i][2], 0, (strlen($tabDownload[$i][2])-4));
			}
		}
		$tabPackage=$tabDownLoadCp;
		sort($tabPackage);
		reset($tabPackage);

		// urlUpload
		$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("urlUpload", formatUrl($this->getId(), "InstallManager", "uploadInstall"));

		// tabDownloadCp == package pouvant être installé
		// tabTmp = package déjà installé
		#################################################################
		# affichage des éléments
		#################################################################
		$tabDel=array();
		foreach($tabPackage as $key=>$val)
		{
			$tmp=mb_split("-", $val);
			if (count($tmp)==3)
			{
				###########################################################################
				# Doit-on afficher le détail ?
				###########################################################################
				if ($detailId==$val)
				{	
					$content=getMessage("TxtDetailNotAvailable");
					$file=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/cache/".$val.".".strtolower(lcode());
					if (!file_exists($file))
					{
						if ($connection->connect())
						{
							$tabFile=$connection->getContentDir("./".$val);
							for($i=0; $i<count($tabFile); $i++){
								
								if($tabFile[$i][2]==$detailId.".".strtolower(lcode())){
									if($connection->downloadFile("./".$val."/".$val.".".strtolower(lcode()) , $file))
									{
										$detail=new File($file, "r");
										$content=$detail->readAll();
										$detail->close();
									}
								}
							}
							$connection->close();
						}
					}else{
						$detail=new File($file, "r");
						$content=$detail->readAll();
						$detail->close();
					}
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText($tmp[0].".DETAIL.detail", $content);
				}else{
					$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc($tmp[0].".DETAIL", "delete");
				}
				###########################################################################

				$tabDel[$tmp[0]]=true;
				$GLOBALS["SYSTEM_TEMPLATE"]->MxText($tmp[0].".name", $tmp[1]);
				$GLOBALS["SYSTEM_TEMPLATE"]->MxText($tmp[0].".version", $tmp[2]);
				$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut($tmp[0].".urlDetail", formatUrl($this->getId(), "InstallManager", "listInstall", "&detailId=".$val));

				###########################################################################
				if (!in_array($val, $tabTmp)){
					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut($tmp[0].".class", "lnColor1");
					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut($tmp[0].".INSTALL.urlInstall", formatUrl($this->getId(), "InstallManager", "beforeInstall", "","&detailId=".$val));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut($tmp[0].".INSTALL.urlDeleteSrc", formatUrl($this->getId(), "InstallManager", "deletePackageInstall", "","&detailId=".$val));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc($tmp[0].".UNINSTALL", "delete");
				}else{
					// Package non installïżœ					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut($tmp[0].".class", "lnColor3");
					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut($tmp[0].".UNINSTALL.urlUnInstall", formatUrl($this->getId(), "InstallManager", "beforeUninstall", "","&detailId=".$val));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc($tmp[0].".INSTALL", "delete");
				}
				###########################################################################
				$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc($tmp[0], "loop");
			}
		}

		# On efface les blocs qui ne servent à rien...
		$tabTest=array("object_coordination", "object_printing", "object_plugin", "template", "upgrade");
		foreach($tabTest as $key=>$val)
		{
			if (!isset($tabDel[$val]))
				$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc($val, "delete");
		}
		#################################################################
		return "";
	}

	//
	// Upload
	//
/**
* upload d'un fichier depuis le poste client...
* @access public
* @return chaine code message
*/
	function uploadInstall()
	{
		includePackage("upload.php");
		includePackage("backup.php");

		$backup=new backup();
		$chmod=$backup->checkConfigForPerms();
		$uploadDir=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/packagesrc/";
		
		// On check le format du nom du fichier avant de l'analyser
		if ( (count($tmp)!=3) && (strpos($_FILES["uploadFile"]["name"], ".tar")!==false) )
		{
			if( strpos($_FILES["uploadFile"]["name"], '-') !== false )
			{
				$tmp=mb_split("-", $_FILES["uploadFile"]["name"]);
			} else {
				systemRedirect(formatUrl($this->getId(),"InstallManager", "actionInstall", "msgPackageNameNotValid"));
				return "";
			}
		} else {
			systemRedirect(formatUrl($this->getId(),"InstallManager", "actionInstall", "msgPackageNotValid"));
			return "";
		}

		// on test si le package a été uploadé...
		if(file_exists($uploadDir.$_FILES["uploadFile"]["name"])){
			systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "msgAllreadyExist"));
			return "";
		}

		$myUpload=new UploadToDir("uploadFile", $uploadDir);
		if ($myUpload->uploadFile(nid(), $this->getId(), uid(), "NONE", $chmod)!=false){
			systemRedirect(formatUrl($this->getId(),"InstallManager", "beforeInstall", "msgDone", "&detailId=".substr($_FILES["uploadFile"]["name"],0 , (strlen($_FILES["uploadFile"]["name"])-4))));
			return "";
		}else{
			systemRedirect(formatUrl($this->getId(),"InstallManager", "actionInstall", "wrongArgument"));
			return "";
		}
	}

/**
* upload d'un fichier depuis le poste client...
* @access public
* @return chaine code message
*/
	function deletePackageInstall(){

		includePackage ("backup/backupfile.php");

		# test de validité du package
		$detailId=(isset($_GET["detailId"]))?$_GET["detailId"]:"";
		$path=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/packagesrc/".$detailId.".tar";
		$path5=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/packagesrc/".$detailId.".md5";
		if ($detailId!="" && file_exists($path)){
		
			# check le fichier descriptif
			$file=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/cache/".$detailId.".".strtolower(lcode());
			if (file_exists($file))
				@unlink($file);

			# check pour le rep déompressé	
			if (is_dir($GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId)){
				$backup=new BackupFile();
				$backup->deleteDir($GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId);
			}

			if(unlink($path)){
				if (file_exists($path5)){
					@unlink($path5);
				}
				systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "msgSourceDeleted"));
				return "";
			}
		}
		systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "wrongArgument"));
		return "";
	}

	//
	// Installation
	//
/**
* avant installation... 
*
* - décompression des fichiers
* - création de l'installeur et appel a sa méthode before install (fichier installdriver".$pkgName.".php)
* si l'obj d'install n'est pas présent dans le packet, utilisation de l'install/défaut
* @access public
* @return chaine code message
*/
	function beforeInstall(){

		addMessageFile("installmanager.ini");

		# test de validité du package
		$detailId=(isset($_GET["detailId"]))?$_GET["detailId"]:"";
		$path=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/packagesrc/".$detailId.".tar";
		if ($detailId=="" || !file_exists($path)){
			# Erreur : package demandé non disponible... :-(
			systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "wrongArgument"));
			return "";
		}

		# Décompression du package
// 		includePackage("archive.php");
// 		includePackage("backup.php");
// 		$backup=new backup();
// 		$chmod=$backup->checkConfigForPerms();
		
		try {
			$archive = new PharData($GLOBALS["CONF_DATA_PATH"]."data/upload/install/packagesrc/".$detailId.".tar");
			$archive->extractTo($GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId, null, true);
		} catch (Exception $e) {
			# Décompression non valide
			systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "wrongArgument"));
			return "";
		}
		#TODO : Check and define scripts permissions
// 		$archive->extract_files($chmod);

		# Construction du manager...
		includeDep("installmanager/installfactory.php");
		includeDep("installmanager/installdriver.php");

		$installDriver=InstallFactory::getInstallDriver($detailId, $GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId);
		$url=formatUrl($this->getId(), "InstallManager", "install", "","&detailId=".$detailId);
		$end=$installDriver->__beforeInstall($url);
		$this->tabeCreate();

		return $end;
	}

/**
* installation
*
* Installation du package...
* @access public
* @return chaine code message
*/
	function install(){

		addMessageFile("installmanager.ini");

		# test de validité du package
		$detailId=(isset($_GET["detailId"]))?$_GET["detailId"]:"";
		$doBackup=(isset($_POST["backup"]) && ($_POST["backup"]==1))?true:false;
		
		$path=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId."/";
		if ($detailId=="" || !is_dir($path)){
			# Erreur : package demandé non disponible... :-(
			systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "wrongArgument"));
			return "";
		}

		# Construction du manager...
		includeDep("installmanager/installfactory.php");
		includeDep("installmanager/installdriver.php");

		$installDriver=InstallFactory::getInstallDriver($detailId, $GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId);
		$end=$installDriver->__install($detailId, $doBackup, formatUrl($this->getId(),"InstallManager", "afterInstall", "", "&detailId=".$detailId));
		$this->tabeCreate();
		
		return $end;
	}

/**
* après installation... 
*
* Affiche un récapitulatif de l'installation...
* @access public
* @return chaine code message
*/
	function afterInstall(){

		addMessageFile("installmanager.ini");

		# test de validité du package
		$detailId=(isset($_GET["detailId"]))?$_GET["detailId"]:"";
		$path=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId."/";
		if ($detailId=="" || !is_dir($path)){
			# Erreur : package demandé non disponible... :-(
			systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "wrongArgument"));
			return "";
		}

		# Construction du manager...
		includeDep("installmanager/installfactory.php");
		includeDep("installmanager/installdriver.php");

		$installDriver=InstallFactory::getInstallDriver($detailId, $GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId);
		$end=$installDriver->__afterInstall();
		$this->tabeCreate();

		return $end;	
	}

	//
	// Désinstallation
	//
/**
* avant désinstallation... 
*
* - décompression des fichiers
* - création de l'installeur et appel a sa méthode before install (fichier installdriver".$pkgName.".php)
* si l'obj d'install n'est pas présent dans le packet, utilisation de l'install/défaut
* @access public
* @return chaine code message
*/
	function beforeUninstall(){

		addMessageFile("installmanager.ini");

		# test de validité du package
		$detailId=(isset($_GET["detailId"]))?$_GET["detailId"]:"";
		$path=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/packagesrc/".$detailId.".tar";
		if ($detailId=="" || !file_exists($path)){
			# Erreur : package demandé non disponible... :-(
			systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "wrongArgument"));
			return "";
		}

		# Décompression du package
		includePackage("archive.php");
		includePackage("backup.php");
		$backup=new backup();
		$chmod=$backup->checkConfigForPerms();
		$archive = new tar_file("../packagesrc/".$detailId.".tar");
		$archive->set_options(array("basedir" => ($GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/"), "overwrite" => 1) );
		$archive->extract_files($chmod);
		if (count($archive->error)!=0){
			# Décompression non valide
			systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "wrongArgument"));
			return "";
		}

		# Construction du manager...
		includeDep("installmanager/installfactory.php");
		includeDep("installmanager/installdriver.php");

		$installDriver=InstallFactory::getInstallDriver($detailId, $GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId);
		$url=formatUrl($this->getId(), "InstallManager", "uninstall", "","&detailId=".$detailId);
		$end=$installDriver->__beforeUninstall($url);
		$this->tabeCreate();

		return $end;
	}

/**
* désinstallation
*
* désinstallation du package...
* @access public
* @return chaine code message
*/
	function uninstall(){

		addMessageFile("installmanager.ini");

		# test de validité du package
		$detailId=(isset($_GET["detailId"]))?$_GET["detailId"]:"";
		$path=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId."/";
		if ($detailId=="" || !is_dir($path)){
			# Erreur : package demandé non disponible... :-(
			systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "wrongArgument"));
			return "";
		}

		# Construction du manager...
		includeDep("installmanager/installfactory.php");
		includeDep("installmanager/installdriver.php");

		$installDriver=InstallFactory::getInstallDriver($detailId, $GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId);
		$url=formatUrl($this->getId(), "InstallManager", "afterUninstall", "","&detailId=".$detailId);
		$end=$installDriver->__uninstall($url);
		$this->tabeCreate();
		
		return $end;
	}

/**
* après désinstallation... 
*
* Affiche un récapitulatif de la désinstallation...
* @access public
* @return chaine code message
*/
	function afterUninstall(){

		addMessageFile("installmanager.ini");

		# test de validité du package
		$detailId=(isset($_GET["detailId"]))?$_GET["detailId"]:"";
		$path=$GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId."/";
		if ($detailId=="" || !is_dir($path)){
			# Erreur : package demandé non disponible... :-(
			systemRedirect(formatUrl($this->getId(),"InstallManager", "listInstall", "wrongArgument"));
			return "";
		}

		# Construction du manager...
		includeDep("installmanager/installfactory.php");
		includeDep("installmanager/installdriver.php");

		$installDriver=InstallFactory::getInstallDriver($detailId, $GLOBALS["CONF_DATA_PATH"]."data/upload/install/package/".$detailId);
		$end=$installDriver->__afterUninstall();
		$this->tabeCreate();

		return $end;
	}

/**
* affichage de tous les bkp...
*
* Affcihage des bkps fait (lors d'une install ou non)
* @access public
* @return chaine code message
*/
	function bkpManageInstall(){

		addMessageFile("installmanager.ini");

		/* gestion du lib en fonction de la langue courante */
		$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
		$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
		/* fin récupèration des codes par defaut */
		
		mxPageTitle("bkpManageInstallTitlePage");
		
		$arrayCallCss = array();
		$arrayCallCss[] = "data/css/dataTables.bootstrap4/1.10.22/dataTables.bootstrap4.min.css";
		mxCallCss($arrayCallCss);
		
		$arrayCallJs = array();
		$arrayCallJs[] = "data/javascript/jquery.dataTables/1.10.22/jquery.dataTables.min.js";
		$arrayCallJs[] = "data/javascript/dataTables.bootstrap4/1.10.22/dataTables.bootstrap4.min.js";
		mxCallJs($arrayCallJs);
		
		$arrayRawJs[] = "\$(document).ready(function(){\$(\"#tabBkpList\").dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
		mxRawJs($arrayRawJs);

		withBlocPath("InstallManager", "bkpmanageinstall");

		$this->tabeCreate();
		
		includePackage ("backup.php");
		
		# Affichage des différents backups existants
		$backup		=new backup();

		// on vérifie si les packages sont installés ou non?
		$tabpatch=$backup->getAllPatch();

		for ($i=0; $i<count($tabpatch); $i++){
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut("BACKUP.js", "javascript:visible('".$tabpatch[$i]["backup_id"]."');");
			$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("BACKUP.id", $tabpatch[$i]["backup_id"]);
			$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.id", $tabpatch[$i]["backup_id"]);
			$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.nom", $tabpatch[$i]["backup_nom"]);
			$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.BtnView", getMessage("BtnView"));
			$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.date", date("Y-m-d H:i:s", $tabpatch[$i]["backup_date"]));
			
			# Affichage des backups de db...
			if ($tabpatch[$i]["db"]!==false){
				$tabDb=$backup->getAllDbArchiveForPatch($tabpatch[$i]["id"]);
				for ($j=0; $j<count($tabDb); $j++){
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.DB.id", $tabDb[$j]["id"]);
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.DB.nom", $tabDb[$j]["nom"]);
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.DB.TxtName", getMessage("TxtName"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.DB.TxtAction", getMessage("TxtAction"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("BACKUP.DB.link", "javascript:validExecBd('".formatUrl($this->getId(), "installmanager", "dbExecInstall", "", "&idDbBkp=".$tabDb[$j]["id"]."');"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("BACKUP.DB.linkDel", "javascript:validDeleteBd('".formatUrl($this->getId(), "installmanager", "dbDeleteInstall", "", "&idDbBkp=".$tabDb[$j]["id"]."');"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("BACKUP.DB", "loop");
				}
			}else{
				$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("BACKUP.DB", "delete");
			}
			
			# Affichage des backups de script...
			if ($tabpatch[$i]["script"]!==false){
				$tabScript=$backup->getAllScriptArchiveForPatch($tabpatch[$i]["id"]);
				for ($j=0; $j<count($tabScript); $j++){
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.SCRIPT.id", $tabScript[$j]["id"]);
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.SCRIPT.newname", $tabScript[$j]["newname"]);
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.SCRIPT.oldname", $tabScript[$j]["oldname"]);
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.SCRIPT.TxtAction", getMessage("TxtAction"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.SCRIPT.TxtName", getMessage("TxtName"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("BACKUP.SCRIPT.link", "javascript:validExecScript('".formatUrl($this->getId(), "installmanager", "scriptExecInstall", "", "&idScriptBkp=".$tabScript[$j]["id"]."');"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("BACKUP.SCRIPT.linkDel", "javascript:validDeleteScript('".formatUrl($this->getId(), "installmanager", "scriptDeleteInstall", "", "&idScriptBkp=".$tabScript[$j]["id"]."');"));
					$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("BACKUP.SCRIPT", "loop");
				}
			}else{
				$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("BACKUP.SCRIPT", "delete");
			}
			
			if ($tabpatch[$i]["script"]===false && $tabpatch[$i]["db"]===false){
				$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.NOBKP.MsgNoBkp", getMessage("MsgNoBkp"));
			}else{
				$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("BACKUP.NOBKP", "delete");
			}

			$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("BACKUP", "loop");
		}

		if (count($tabpatch)==0)
			$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("BACKUP", "delete");

		$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("jsDoBkp", "javascript:validDoBkp('".formatUrl($this->getId(), "InstallManager", "createDbBkpInstall", "")."');");
	}
/**
* execution d'un bkp db...
*
* execution d'un backup...
* @access public
* @return chaine code message
*/
	function scriptExecInstall(){
		$idScriptBkp =( (isset($_GET["idScriptBkp"])) && (is_numeric($_GET["idScriptBkp"])) )?$_GET["idScriptBkp"]:null;
		if ($idScriptBkp==null){
			# Erreur : package demandé non disponible... :-(
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "wrongArgument"));
			return "";
		}
		includePackage("backup.php");
		$backup=new Backup();
		
		# Récupération du nom de la bd a executer...
		$script=$backup->getScriptArchiveFromId($idScriptBkp);
		if ($script!==false){
			@copy($script["newname"], $script["oldname"]);
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "MsgRestaurationOk"));
		}else{
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "wrongArgument"));
		}
		return "";
	}

/**
* destruction de la sauvegarde de Bd...
*
* @access public
* @return chaine code message
*/
	function scriptDeleteInstall(){
		//$prefixe=(!defined("DATA_ACCES_TABLE_PREFIX"))?"": DATA_ACCES_TABLE_PREFIX ;
		$idScriptBkp =( (isset($_GET["idScriptBkp"])) && (is_numeric($_GET["idScriptBkp"])) )?$_GET["idScriptBkp"]:null;
		if ($idScriptBkp==null){
			# Erreur : package demandé non disponible... :-(
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "wrongArgument"));
			return "";
		}
		includePackage("backup.php");
		$backup=new Backup();
		
		# Récupération du nom de la bd a executer...
		$script=$backup->getDbArchiveFromId($idScriptBkp);
		if ($script!==false){
			$sql_bd="DELETE FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backupfile WHERE id=".$idScriptBkp;
			$query_bd=$GLOBALS["SYSTEM_DATABASE_CONN"]->sql_query($sql_bd);
			@unlink($script["newname"]);
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "MsgDeleted"));
		}else{
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "wrongArgument"));
		}
		return "";
	}

/**
* execution d'un bkp db...
*
* execution d'un backup...
* @access public
* @return chaine code message
*/
	function dbExecInstall(){
		$idDbBkp =( (isset($_GET["idDbBkp"])) && (is_numeric($_GET["idDbBkp"])) )?$_GET["idDbBkp"]:null;
		if ($idDbBkp==null){
			# Erreur : package demandé non disponible... :-(
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "wrongArgument"));
			return "";
		}
		includePackage("backup.php");
		$backup=new Backup();
		
		# Récupération du nom de la bd a executer...
		$db=$backup->getDbArchiveFromId($idDbBkp);
		if ($db!==false){
			$backup->restoreBackUpDb($GLOBALS["CONF_DATA_PATH"]."data/backup/", $db["nom"]);
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "MsgRestaurationOk"));
		}else{
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "wrongArgument"));
		}
		return "";
	}
/**
* destruction de la sauvegarde de Bd...
*
* @access public
* @return chaine code message
*/
	function dbDeleteInstall(){
		//$prefixe=(!defined("DATA_ACCES_TABLE_PREFIX"))?"": DATA_ACCES_TABLE_PREFIX ;
		$idDbBkp =( (isset($_GET["idDbBkp"])) && (is_numeric($_GET["idDbBkp"])) )?$_GET["idDbBkp"]:null;

		if ($idDbBkp==null){
			# Erreur : package demandé non disponible... :-(
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "wrongArgument"));
			return "";
		}
		includePackage("backup.php");
		$backup=new Backup();

		# Récupération du nom de la bd a executer...
		$db=$backup->getDbArchiveFromId($idDbBkp);
		if ($db!==false){
			$sql_bd="DELETE FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backupbd WHERE id=".$idDbBkp;
			$query_bd=$GLOBALS["SYSTEM_DATABASE_CONN"]->sql_query($sql_bd);
			@unlink($GLOBALS["CONF_DATA_PATH"]."data/backup/".$db["nom"]);
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "MsgDeleted"));
		}else{
			systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "wrongArgument"));
		}
		return "";
	}

/**
* Creation d'un backup utilisateur
*/
	function createDbBkpInstall(){

		includePackage("backup.php");
		$backup=new Backup();
		$name="bkp-".date("Y-m-d");
		$id=$backup->createBackup($name);
		$backup->bkpDbFromTab($id, $name, 0000);
		systemRedirect(formatUrl($this->getId(),"InstallManager", "bkpManageInstall", "MsgBkpOk"));
	}


#######################################################################################################################################
### Parametrage de l'instance!!!
#######################################################################################################################################
#### On surcharge
###### ici les methodes de CoordinationObj pour avoir un form permettant de saisir la racine de fonctionnement de l'objet

/**
* Surcharge des methodes de la classe CoordinationObjet
* @param chaine url pour le form
* @param chaine url pour le form de retour
* @param entier groupe de configuration...
* @param entier noeud de configuration endroit ou l'objet a été créé
* @param tableau
* @access public
* @return chaine code Message
*/
	function configurePrint($url, $urlReturn, $groupIdPass, $nodeIdPass, $tabForbiddenPass)
	{
		addMessageFile("installmanager.ini");
		$end=parent::configurePrint($url, $urlReturn, $groupIdPass, $nodeIdPass, $tabForbiddenPass);

		$ftp=$this->getData("ftp");
		$login=$this->getData("login");
		$passwd=$this->getData("passwd");
		$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("ftp", "text", "ftp", $ftp);
		$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("login", "text", "login", $login);
		$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("passwd", "password", "passwd", $passwd);

		return $end;
	}

/**
* __createObject : retourne la chaine d'affichage de création de l'objet (/dïżœaut)
* @param chaine url pour le form
* @param chaine url pour le form de retour
* @param entier groupe de configuration...
* @param entier noeud de configuration endroit ou l'objet a été créé
* @param tableau
* @access public
* @return chaine code Message
*/
	function __createObject($url, $urlReturn, $groupIdPass, $nodeIdPass, $tabForbiddenPass)
	{
		withBlocPath("InstallManager", "configuration");
		$end=$this->configurePrint($url, $urlReturn, $groupIdPass, $nodeIdPass, $tabForbiddenPass);
		exitBloc();
		return $end;
	}

/**
* __ExecCreateObject : retourne la chaine d'affichage de création de l'objet (traitement)
* @param entier groupe de configuration...
* @param entier noeud de configuration endroit ou l'objet a été créé
* @param tableau
* @access public
* @return chaine code Message
*/
	function __execCreateObject($groupIdPass, $nodeIdPass, $tabForbiddenPass)
	{
		$ftp=(isset($_POST["ftp"]))?$_POST["ftp"]:"";
		$this->setData("ftp", $ftp);
		$login=(isset($_POST["login"]))?$_POST["login"]:"";
		$this->setData("login", $login);
		$passwd=(isset($_POST["passwd"]))?$_POST["passwd"]:"";
		$this->setData("passwd", $passwd);

		$end=parent::__execCreateObject($groupIdPass, $nodeIdPass, $tabForbiddenPass);
		return $end;
	}

/**
* __ExecUpdateObject : retourne la chaine d'affichage de modification de l'objet (traitement)
* @param entier groupe de configuration...
* @param entier noeud de configuration endroit ou l'objet a été créé
* @param tableau
* @access public
* @return chaine code Message
*/
	function __execUpdateObject($groupIdPass, $nodeIdPass, $tabForbiddenPass)
	{
		$ftp=(isset($_POST["ftp"]))?$_POST["ftp"]:"";
		$this->setData("ftp", $ftp);
		$login=(isset($_POST["login"]))?$_POST["login"]:"";
		$this->setData("login", $login);
		$passwd=(isset($_POST["passwd"]))?$_POST["passwd"]:"";
		$this->setData("passwd", $passwd);
		$end=parent::__execUpdateObject($groupIdPass, $nodeIdPass, $tabForbiddenPass);
		return $end;
	}

/**
* __updateObject : surchage updateObject de l'objet de coordination
* @param chaine url pour le form
* @param chaine url pour le form de retour
* @param entier groupe de configuration...
* @param entier noeud de configuration endroit ou l'objet a été créé
* @param tableau
* @access public
* @return chaine code Message
*/
	function __updateObject($url, $urlReturn, $groupIdPass, $nodeIdPass, $tabForbiddenPass)
	{
		withBlocPath("InstallManager", "configuration");
		$end=$this->configurePrint($url, $urlReturn, $groupIdPass, $nodeIdPass, $tabForbiddenPass);
		exitBloc();
		return $end;
	}
}
?>
