blob: 21d65f93e6df6a712303d8cb656e28db61e046e8 (
plain)
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
|
<?php
/*
* File: ratatoeskr/sys/utils.php
*
* Various useful helper functions.
*
* License:
* This file is part of Ratatöskr.
* Ratatöskr is licensed unter the MIT / X11 License.
* See "ratatoeskr/licenses/ratatoeskr" for more information.
*/
/*
* Function: intcmp
* Compare integers (equavilent to strcmp)
*/
function intcmp($a, $b)
{
return ($a == $b) ? 0 : (($a < $b) ? -1 : 1);
}
/*
* Function: delete_directory
* Delete a directory and all of its content.
*/
function delete_directory($dir)
{
$dir_content = scandir($dir);
foreach ($dir_content as $f) {
if (($f == "..") or ($f == ".")) {
continue;
}
$f = "$dir/$f";
if (is_dir($f)) {
delete_directory($f);
} else {
unlink($f);
}
}
rmdir($dir);
}
/*
* Constant: SITE_BASE_PATH
* The Base path of this ratatoeskr site.
*/
define("SITE_BASE_PATH", dirname(dirname(dirname(__FILE__))));
|