-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.php
47 lines (42 loc) · 1.11 KB
/
utils.php
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
<?php
/**
* This class contains general tools needed for the project internal operations.
* Check below for specific details.
*
* @author Anastasios Glaros
* @version v1.0, 2015-3-10
*/
class Utils
{
const LOCAL_FPATH = "/home/mmb/www/temp/";
/**
* This function is used to delete a file or a folder. For security
* reasons it is set to delete files only under 'temp' folder.
* @param string pathOrFile
* @return boolean
*/
public function deletePdbFile($filename){
$filename = self::LOCAL_FPATH . $filename;
if(@unlink($filename)){
//echo "File " . $filename . " : Deleted.<br>";
return true;
}
}
public function deleteUserFolder($folderName){
stripslashes($folderName);
if($folderName != NULL){
$folderName = self::LOCAL_FPATH . $folderName;
if(($folderName != NULL) && (is_dir($folderName))){
array_map('unlink', glob("$folderName/*.*"));
if(rmdir($folderName)){
//echo "File " . $folderName . " : Deleted.<br>";
return true;
}
else return false;
}
else return false;
}
else return false;
}
}
?>