forked from hypercities/hypercities
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeleteObject.php
More file actions
41 lines (33 loc) · 1.26 KB
/
deleteObject.php
File metadata and controls
41 lines (33 loc) · 1.26 KB
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
<?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'];
try {
//do not delete object from database, remove object relation and mark
//the object as "deleted" if all relations are gone
$allQueryOk = deleteObject($objectId, $parentId);
//do not update Public collection's boundary and time because of performance issues
if ($parentId != HC_PUBLIC_COLLECTIONS_ID) {
//update the boundary and timespan of the collection and its parents
//up to base collections
$object = updateColTimeBoundBottomUp($parentId);
}
if ($allQueryOk) HC_reportSuccess("Object successfully deleted.");
else HC_reportError("Object deletion error!");
} catch (MysqlException $e) {
$message = 'Caught exception: '.$e->getMessage();
HC_errorLog($message);
HC_reportDBError("deleting the object");
} catch (Exception $e) {
$message = 'Caught exception: '.$e->getMessage();
HC_errorLog($message);
HC_reportGeneralError("deleting the object");
}
?>