Migration

This commit is contained in:
2016-02-21 01:33:05 +01:00
commit 6db8a86a48
386 changed files with 17311 additions and 0 deletions

126
0.7.1/daemon/GestionFtp.php Executable file
View File

@@ -0,0 +1,126 @@
<?php
/*
Copyright (C) 2007 Mercier Benjamin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
[ERREUR 1] => L'utilisateur n'est pas trouv<75> dans la table utilisateur (afin de detecter le serveur de stockage)
[ERREUR 2] => L'utilisateur n'a aucun serveur d'attribu<62>
[ERREUR 3] => L'insertion dans la table accessible via proftpd <20> <20>chou<6F>
[ERREUR 4] => La mise a jour du compte ftp sur le panel a <20>chou<6F>
[ERREUR 5] => La suppression de la table accessible via proftpd <20> <20>chou<6F>
[ERREUR 6] => La suppression du compte ftp sur le panel <20> <20>chou<6F>
*/
// Annulation de la connexion MySql locale :
$ConnexionLocale = "non";
// Inclusion du core
require ('/var/www/daemon/system/core.php');
/* -------- */
/* Cr<43>ation */
/* -------- */
$ListFtp = $ConnexionPanel->Select ("*", "ftp", "Status='1'", "", "", "", "");
if ( $ListFtp != FALSE )
{
$CountFtp = count ($ListFtp);
echo "\nCompte(s) en attente de cr<63>ation : ".$CountFtp."\n";
for ($i=0; $i < $CountFtp; $i++)
{
echo "Compte de ".$ListFtp[$i]["Utilisateur"]." : ".$ListFtp[$i]["Nom"];
$SelectServeur = $ConnexionPanel->Select ("*", "utilisateur", "Utilisateur='".$ListFtp[$i]["Utilisateur"]."'", "", "", "", "");
if ( $SelectServeur != FALSE )
{
if ( !empty($SelectServeur[0]["ServeurFichier"]) )
{
$Champs = "userid, passwd, homedir, Server";
$Valeurs = "'".$ListFtp[$i]["Nom"]."', ENCRYPT('".$ListFtp[$i]["Password"]."'), '/var/www/web/".$ListFtp[$i]["Utilisateur"].$ListFtp[$i]["Chemin"]."', '".$SelectServeur[0]["ServeurFichier"]."'";
$InsertFtp = $ConnexionSystem->Insert ($Champs, $Valeurs, "ftpuser");
if ( $InsertFtp != FALSE )
{
$MajPanel = $ConnexionPanel->Update ("ftp", "Status", "2", "Nom='".$ListFtp[$i]["Nom"]."'");
if ( $MajPanel != FALSE )
{
echo "\t\t\t[OK]\n";
}
else
{
echo "\t\t\t[ERREUR 4]\n";
}
}
else
{
echo "\t\t\t[ERREUR 3]\n";
}
}
else
{
echo "\t\t\t[ERREUR 2]\n";
}
}
else
{
echo "\t\t\t[ERREUR 1]\n";
}
}
}
else
{
echo "Aucun compte n'est en attente de cr<63>ation\n";
}
/* ----------- */
/* Suppression */
/* ----------- */
$ListFtp = $ConnexionPanel->Select ("*", "ftp", "Status='3'", "", "", "", "");
if ( $ListFtp != FALSE )
{
$CountFtp = count ($ListFtp);
echo "\nCompte(s) en attente de suppression : ".$CountFtp."\n";
for ($i=0; $i < $CountFtp; $i++)
{
echo "Compte de ".$ListFtp[$i]["Utilisateur"]." : ".$ListFtp[$i]["Nom"];
$SuppressionSystem = $ConnexionSystem->Delete ("ftpuser", "userid='".$ListFtp[$i]["Nom"]."'");
if ( $SuppressionSystem != FALSE )
{
$SuppressionPanel = $ConnexionPanel->Delete ("ftp", "Nom='".$ListFtp[$i]["Nom"]."'");
if ( $SuppressionPanel != FALSE )
{
echo "\t\t\t[OK]\n";
}
else
{
echo "\t\t\t[ERREUR 6]\n";
}
}
else
{
echo "\t\t\t[ERREUR 5]\n";
}
}
}
else
{
echo "Aucun compte n'est en attente de supression\n";
}
?>