forked from blamarche/openbookmark
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfolder_move.php
60 lines (50 loc) · 1.64 KB
/
folder_move.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
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
require_once ("./header.php");
logged_in_only ();
require_once (ABSOLUTE_PATH . "folders.php");
$sourcefolder = set_post_sourcefolder ();
$tree = new folder;
$parents = $tree->get_path_to_root ($folderid);
if ($sourcefolder == "") {
?>
<h2 class="title">Move Folder</h2>
<form action="<?php echo $_SERVER['SCRIPT_NAME'] . "?folderid=" . $folderid . "&expand=" . implode (",", $expand);?>" method="POST" id="fmove">
<div style="width:100%; height:330px; overflow:auto;">
<?php
$tree->make_tree (0);
$tree->print_tree ();
?>
</div>
<br>
<input type="hidden" name="sourcefolder">
<input type="submit" value=" OK ">
<input type="button" value=" Cancel " onClick="self.close()">
<input type="button" value=" New Folder " onClick="self.location.href='javascript:foldernew(<?php echo $folderid; ?>)'">
</form>
<script type="text/javascript">
this.focus();
document.getElementById('fmove').sourcefolder.value = self.name;
</script>
<?php
}
else if ($sourcefolder == $folderid) {
echo '<script language="JavaScript">self.close();</script>';
}
else if (in_array ($sourcefolder, $parents)){
message ("A folder cannot be moved to one of its own subfolders");
}
else if ($sourcefolder != "" && $sourcefolder != $folderid){
$query = sprintf ("UPDATE folder SET childof='%d' WHERE id='%d' AND user='%s'",
$mysql->escape ($folderid),
$mysql->escape ($sourcefolder),
$mysql->escape ($username));
if ($mysql->query ($query)) {
echo "Folder moved<br>\n";
echo '<script language="JavaScript">reloadclose();</script>';
}
else {
message ($mysql->error);
}
}
require_once (ABSOLUTE_PATH . "footer.php");
?>