-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdenuke_helpers.php
40 lines (33 loc) · 1.35 KB
/
denuke_helpers.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
<?php
function recurse_copy($src, $dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (($file == '.' ) || ( $file == '..' )) {
continue;
}
if (is_dir($src . '/' . $file)) {
recurse_copy($src . '/' . $file, $dst . '/' . $file);
}
else {
copy($src . '/' . $file, $dst . '/' . $file);
printf('.');
}
}
closedir($dir);
}
function parse_nucleus_templates($data, $uid, $path) {
$path_user = $path . "/" . $uid . "/";
// if file with dirname - 'everyone' or user number
$data = preg_replace("/<\%image\((.+\/.+)\|(\d+)\|(\d+)\|(.*)\){0,1}\%>/",
"<img src=\"" . $path . "/$1\" width=\"$2\" height=\"$3\" alt=\"$4\" title=\"$4\" />", $data);
// in current user's private dir
$data = preg_replace("/<\%image\((.+)\|(\d+)\|(\d+)\|(.*)\){0,1}\%>/",
"<img src=\"" . $path_user . "$1\" width=\"$2\" height=\"$3\" alt=\"$4\" title=\"$4\" />", $data);
$data = preg_replace("/<\%popup\((.+\/.+)\|(\d+)\|(\d+)\|(.*)\)\%>/",
"<a href=\"" . $path . "/$1\" target=\"_blank\" title=\"Show picture in a new window\">$4</a>", $data);
$data = preg_replace("/<\%popup\((.+)\|(\d+)\|(\d+)\|(.*)\)\%>/",
"<a href=\"" . $path_user . "$1\" target=\"_blank\" title=\"Show picture in a new window\">$4</a>", $data);
return $data;
}
?>