summaryrefslogtreecommitdiff
path: root/lib/file/delfld.php
blob: 9a2bf1fa6462a30dbcfeeb1d887d0bd16c2c59e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

assert_redir(count($args) >= 3, 'file');
$fldid = intval($args[2]);

$fld = mysql_fetch_assoc(sql(
	"SELECT id, name, comment, public, owner ".
	"FROM folders WHERE id = $fldid"
	));
assert_error($fld && ($fld['owner'] == $user['id'] || $user['priv'] >= $priv_admin),
	"This folder does not exist, or you are not allowed to edit it.");

token_validate("Do you really want to delete this folder ?", "folder-file-$fldid");
sql("DELETE FROM folders WHERE id = $fldid");
sql("UPDATE files SET folder = 0 WHERE folder = $fldid");
header("location: file");