|
1
|
|
|
<?php |
|
2
|
|
|
if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3
|
|
|
die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4
|
|
|
} |
|
5
|
|
|
if(!$modx->hasPermission('delete_document')) { |
|
6
|
|
|
$modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7
|
|
|
} |
|
8
|
|
|
|
|
9
|
|
|
$rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), "deleted=1"); |
|
10
|
|
|
$ids = $modx->getDatabase()->getColumn('id', $rs); |
|
11
|
|
|
|
|
12
|
|
|
// invoke OnBeforeEmptyTrash event |
|
13
|
|
|
$modx->invokeEvent("OnBeforeEmptyTrash", |
|
14
|
|
|
array( |
|
15
|
|
|
"ids"=>$ids |
|
16
|
|
|
)); |
|
17
|
|
|
|
|
18
|
|
|
// remove the document groups link. |
|
19
|
|
|
$sql = "DELETE document_groups |
|
20
|
|
|
FROM ".$modx->getDatabase()->getFullTableName('document_groups')." AS document_groups |
|
21
|
|
|
INNER JOIN ".$modx->getDatabase()->getFullTableName('site_content')." AS site_content ON site_content.id = document_groups.document |
|
22
|
|
|
WHERE site_content.deleted=1"; |
|
23
|
|
|
$modx->getDatabase()->query($sql); |
|
24
|
|
|
|
|
25
|
|
|
// remove the TV content values. |
|
26
|
|
|
$sql = "DELETE site_tmplvar_contentvalues |
|
27
|
|
|
FROM ".$modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues')." AS site_tmplvar_contentvalues |
|
28
|
|
|
INNER JOIN ".$modx->getDatabase()->getFullTableName('site_content')." AS site_content ON site_content.id = site_tmplvar_contentvalues.contentid |
|
29
|
|
|
WHERE site_content.deleted=1"; |
|
30
|
|
|
$modx->getDatabase()->query($sql); |
|
31
|
|
|
|
|
32
|
|
|
//'undelete' the document. |
|
33
|
|
|
$modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_content'), "deleted=1"); |
|
34
|
|
|
|
|
35
|
|
|
// invoke OnEmptyTrash event |
|
36
|
|
|
$modx->invokeEvent("OnEmptyTrash", |
|
37
|
|
|
array( |
|
38
|
|
|
"ids"=>$ids |
|
39
|
|
|
)); |
|
40
|
|
|
|
|
41
|
|
|
// empty cache |
|
42
|
|
|
$modx->clearCache('full'); |
|
43
|
|
|
|
|
44
|
|
|
// finished emptying cache - redirect |
|
45
|
|
|
$header="Location: index.php?a=2&r=1"; |
|
|
|
|
|
|
46
|
|
|
header($header); |
|
47
|
|
|
|
This check looks for improperly formatted assignments.
Every assignment must have exactly one space before and one space after the equals operator.
To illustrate:
will have no issues, while
will report issues in lines 1 and 2.