deletefile.blade.php
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
if($wakka->GetUser())
{
$filename=Input::get("fpath");
$empid=Input::get("varid");
$storagepath=$wakka->GetThemePath("/")."/recruits/$empid/";
if(trim($empid)!="")
{
$empdata=$wakka->getPerson($empid);
if($wakka->recordEditAccess($empdata["peopledata"]))
{
if(file_exists($storagepath.$filename))
{
if(unlink($storagepath.$filename))
{
$updatetime=time();
$empdata['modifylog'][$updatetime]=$wakka->GetUserName()."::";
$empdata['modifylog']["updated"]=$updatetime;
$empdata['modifylog'][$updatetime].="DeleteFile|$filename|DELETED,";
$wakka->setPerson($empid,$empdata);
echo "<script>simpleNotification('success','topRight','File Deleted');</script>";
}
else echo "<script>simpleNotification('error','topRight','Failed to Delete');</script>";
}
else echo "<script>simpleNotification('error','topRight','File doesnot exists');</script>";
}
else
{
echo "<script>simpleNotification('error','topRight','No Access');</script>";
}
}
else
{
if($wakka->IsAdmin())
{
if(file_exists($filename))
{
if(unlink($filename))echo "<script>simpleNotification('success','topRight','File Deleted');</script>";
else echo "<script>simpleNotification('error','topRight','Failed to Delete');</script>";
}
else echo "<script>simpleNotification('error','topRight','File doesnot exists');</script>";
}
else echo "<script>simpleNotification('error','topRight','No Access');</script>";
}
}
?>