forked from hypercities/hypercities
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deleteCollection.php
50 lines (45 loc) · 1.51 KB
/
deleteCollection.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
<?php
include_once('includes/connect_db.inc');
include_once('includes/util.inc');
include_once('includes/dbUtil.inc');
include_once('includes/serverSession.inc');
///*
cServerSession::start();
HC_checkReferer();
$HC_POST = HC_cleanInput($_POST, array('objectId'=>'int', 'parentId'=>'int'),
array('objectId', 'parentId'), null);
$objectId = $HC_POST['objectId'];
$parentId = $HC_POST['parentId'];
$userId = cServerSession::getUserId();
//*/
///* For Quick Manual Delete
//$userId = 13;
//$objectId = 16269;
//$parentId = 13763;
//*/
try {
if (isOwner($objectId, $userId)) {
//if current user is the owner, delete this collection from all
//other collections and mark it as deleted
$allQueryOk = deleteCollectionAll($objectId);
} else {
//do not delete object from database, simply mark the object as "deleted"
$allQueryOk = deleteCollection($objectId, $parentId);
}
//do not update Public collection's boundary and time because of performance issues
if ($parentId != HC_PUBLIC_COLLECTIONS_ID) {
/*update the boundary of the collecton*/
$object = updateColTimeBoundBottomUp($parentId);
}
if ($allQueryOk) HC_reportSuccess("Delete collection success!");
else HC_reportError("Delete collection error!");
} catch (MysqlException $e) {
$message = 'Caught exception: '.$e->getMessage();
HC_errorLog($message);
HC_reportDBError("deleting the collection");
} catch (Exception $e) {
$message = 'Caught exception: '.$e->getMessage();
HC_errorLog($message);
HC_reportGeneralError("deleting the collection");
}
?>