/*
* This file is part of PhpCompta.
*
* PhpCompta 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.
*
* PhpCompta 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 PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* !\file
*/
/* \brief confirm the removal of a template , folder and remove it if confirmed
*
*/
include_once("postgres.php");
include_once("debug.php");
include_once("ac_common.php");
$rep=DbConnect();
include_once ("class_user.php");
$User=new cl_user($rep);
html_page_start($User->theme,'onLoad="window.focus();"');
$User->Check();
if ($User->admin != 1) {
print "
Désolé mais vous ne pouvez pas effacer les modèles de base
";
return;
}
break;
default:
print '
';
print "Désolé mais que voulez-vous effacer ? ";
print '
';
return;
}
if ( isset($_POST['remove']) )
{
// Check if the radio is checked
// if yes removed the template and show a confirmation message
if ( isset($_POST['confirm']) )
{
switch( $_POST['p_type'] )
{
// Drop Modele
case 'mod':
$sql="drop database ".domaine."mod".$_POST['ob_id'];
ob_start();
if ( pg_query($cn,$sql)==false) {
ob_clean();
echo "
Base de donnée ".domaine."mod".$_POST['ob_id']." est accèdée, déconnectez-vous d'abord
";
exit;
}
ob_flush();
$sql="delete from modeledef where mod_id=".$_POST['ob_id'];
ExecSql($cn,$sql);
print '
';
print "Voilà le modèle $name est effacé";
print "
";
break;
case 'db':
$sql="drop database ".domaine."dossier".$_POST['ob_id'];
ob_start();
if ( pg_query($cn,$sql)==false) {
ob_clean();
echo "
Base de donnée ".domaine."mod".$_POST['ob_id']." est accèdée, déconnectez-vous d'abord
";
exit;
}
ob_flush();
$sql="delete from priv_user where priv_id in (select jnt_id from jnt_use_dos where dos_id=".$_REQUEST['ob_id'].")";
ExecSql($cn,$sql);
$sql="delete from jnt_use_dos where dos_id=".$_REQUEST['ob_id'];
ExecSql($cn,$sql);
$sql="delete from ac_dossier where dos_id=".$_REQUEST['ob_id'];
ExecSql($cn,$sql);
print '
';
print "Voilà le modèle $name est effacé";
print "
";
}
}
else
{
print '
';
print "$msg $name n'est pas effacé";
print '
';
print "";
print "Vous n'avez pas coché la case";
}
}
else
{
print "