<?php
session_start();
include 'db.php';

$folder_name = $_GET['folder_name'];
$case_id = $_GET['case_id'];
/* This to delete files off of server */
$unlink_query = mysql_query("SELECT * FROM `cm_documents` WHERE `folder` = '$folder_name' AND `case_id` = '$case_id' AND `url` != ''");
while ($r = mysql_fetch_array($unlink_query))
{
$doc = $r['url'];
unlink($doc);

}

/* This to delete document database entry */

$query = mysql_query("DELETE FROM `cm_documents` WHERE `folder` = '$folder_name' and `case_id` = '$case_id'");
echo "<br><br><a href=\"#\" onClick=\"killDroppables();createTargets('case_activity','case_activity');sendDataGet('cm_docs.php?id=$case_id');return false;\">OK</a> ";





?>

<?php
session_start();
include 'db.php';

$folder_name = $_GET['folder_name'];
$case_id = $_GET['case_id'];
/* This to delete files off of server */
$unlink_query = mysql_query("SELECT * FROM `cm_documents` WHERE `folder` = '$folder_name' AND `case_id` = '$case_id' AND `url` != ''");

shell_exec('chmod 777 docs');

while ($r = mysql_fetch_array($unlink_query))
{
$doc = $r['url'];
unlink($doc);

}

shell_exec('chmod 644 docs');

/* This to delete document database entry */

$query = mysql_query("DELETE FROM `cm_documents` WHERE `folder` = '$folder_name' and `case_id` = '$case_id'");
echo "<br><br><a href=\"#\" onClick=\"killDroppables();createTargets('case_activity','case_activity');sendDataGet('cm_docs.php?id=$case_id');return false;\">OK</a> ";





?>

Allow script to temporarily change directory mode to 777 and then return it to 644. Improves security of docs directory
Allow script to temporarily change directory mode to 777 and then return it to 644.  Improves security of docs directory

git-svn-id: e691eac7f4e7c267eb8bf668e75dc601c2a71df8@632 54a900ba-8191-11dd-a5c9-f1483cedc3eb
