*/
include("session.php");
require_once('class_functions.php');
require_once("class_db.php");
require_once("class_letterbox.php");
require_once("class_folders.php");
$func = new functions();
$folders = new folders();
if(file_exists($_SESSION['config']['lang'].'.php'))
{
include($_SESSION['config']['lang'].'.php');
}
else
{
$_SESSION['error'] = "Language file missing...
";
}
//The Fileplan
if(isset($_GET['fileplan_id']))
{
$fileplanId = addslashes($func->wash($_GET['fileplan_id'], "no", _FILEPLAN));
}
else
{
$fileplanId = "";
}
//Le classeur
if(!isset($_GET['folder_id']) || empty($_GET['folder_id']))
{
$_SESSION['error'] = _SELECT_FOLDER_FIRST;
}
else
{
$folderId = addslashes($func->wash($_GET['folder_id'], "no", _THE_FOLDER));
}
//Le document
if(!isset($_GET['id']) || empty($_GET['id']))
{
$_SESSION['error'] = _NO_DOCUMENT_CORRESPOND_TO_IDENTIFIER;
}
else
{
$s_id = addslashes($func->wash($_GET['id'], "num", _THE_DOC));
}
//L'action
if(isset($_GET['action']))
{
$action = $_GET['action'];
}
else
{
$action = "";
}
//L'origine
$from = $_GET['from'];
if(!empty($_SESSION['error']))
{
if ($from == 'main')
{
?>
connect();
$db_user->connect();
$db_right->connect();
$db_user->query("select * from ".$_SESSION['tablename']['folders']." where FOLDER_ID = ".$folderId);
$line = $db_user->fetch_object();
if ($line->USER_ID <> $_SESSION['user']['UserId'] ) {
$db_right->query("select * from ".$_SESSION['tablename']['folderscope']." where FOLDER_ID = ".$folderId." and write_right = 'Y'");
if ($db_right->nb_result() == 0) {
$db->query("delete from ".$_SESSION['tablename']['folderres']." where RES_ID = ".$s_id." and FOLDER_ID = '".$folderId."'");
}
}
if ($line->USER_ID == $_SESSION['user']['UserId'] ) {
$db->query("delete from ".$_SESSION['tablename']['folderres']." where RES_ID = ".$s_id." and FOLDER_ID = '".$folderId."'");
}
if ($from == 'main')
{
ob_start();
header("location: view_folders.php?id=".$fileplanId."&action=".$action."&folder_id=".$folderId);
ob_end_flush();
}
elseif ($from =='popup')
{
//$link = "folders_put.php?fileplan_id=".$fileplanId."&action=del&folder_id=".$folderId;
ob_start();
header("location: folders_put.php?fileplan_id=".$fileplanId."&action=del&folder_id=".$folderId);
ob_end_flush();
}
elseif ($from =='perso')
{
ob_start();
header("location: index.php?page=folders&action=del&folder_id=".$folderId);
ob_end_flush();
}
exit;
}
?>