@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(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."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('export_static')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // figure out the base of the server, so we know where to get the documents in order to export them |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | |
36 | 36 | <div class="container container-body"> |
37 | 37 | <?php |
38 | - if(isset($_POST['export'])) { |
|
39 | - $rs = include_once(MODX_MANAGER_PATH . 'processors/export_site.processor.php'); |
|
40 | - echo $rs; |
|
41 | - } else { |
|
42 | - ?> |
|
38 | + if(isset($_POST['export'])) { |
|
39 | + $rs = include_once(MODX_MANAGER_PATH . 'processors/export_site.processor.php'); |
|
40 | + echo $rs; |
|
41 | + } else { |
|
42 | + ?> |
|
43 | 43 | <form action="index.php" method="post" name="exportFrm"> |
44 | 44 | <input type="hidden" name="export" value="export" /> |
45 | 45 | <input type="hidden" name="a" value="83" /> |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | </script> |
82 | 82 | </form> |
83 | 83 | <?php |
84 | - } |
|
85 | - ?> |
|
84 | + } |
|
85 | + ?> |
|
86 | 86 | </div> |
87 | 87 | </div> |
88 | 88 |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(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."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('edit_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | ?> |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | <div class="form-group"><?= $_lang['role_management_msg'] ?> <a class="btn btn-secondary btn-sm" href="index.php?a=38"><i class="<?= $_style["actions_new"] ?> hide4desktop"></i> <?= $_lang['new_role'] ?></a></div> |
19 | 19 | <div class="form-group"> |
20 | 20 | <?php |
21 | - $rs = $modx->db->select('name, id, description', $modx->getFullTableName('user_roles'), '', 'name'); |
|
22 | - $limit = $modx->db->getRecordCount($rs); |
|
23 | - if($limit < 1) { |
|
24 | - ?> |
|
21 | + $rs = $modx->db->select('name, id, description', $modx->getFullTableName('user_roles'), '', 'name'); |
|
22 | + $limit = $modx->db->getRecordCount($rs); |
|
23 | + if($limit < 1) { |
|
24 | + ?> |
|
25 | 25 | <p><?= $_lang["no_records_found"] ?></p> |
26 | 26 | <?php |
27 | - } else { |
|
28 | - ?> |
|
27 | + } else { |
|
28 | + ?> |
|
29 | 29 | <div class="row"> |
30 | 30 | <div class="table-responsive"> |
31 | 31 | <table class="table data"> |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | </thead> |
38 | 38 | <tbody> |
39 | 39 | <?php |
40 | - while($row = $modx->db->getRow($rs)) { |
|
41 | - if($row['id'] == 1) { |
|
42 | - ?> |
|
40 | + while($row = $modx->db->getRow($rs)) { |
|
41 | + if($row['id'] == 1) { |
|
42 | + ?> |
|
43 | 43 | <tr class="text-muted disabled"> |
44 | 44 | <td><b><?= $row['name'] ?></b></td> |
45 | 45 | <td><span><?= $_lang['administrator_role_message'] ?></span></td> |
46 | 46 | </tr> |
47 | 47 | <?php |
48 | - } else { |
|
49 | - ?> |
|
48 | + } else { |
|
49 | + ?> |
|
50 | 50 | <tr> |
51 | 51 | <td><a class="text-primary" href="index.php?id=<?= $row['id'] ?>&a=35"><?= $row['name'] ?></a></td> |
52 | 52 | <td><?= $row['description'] ?></td> |
53 | 53 | </tr> |
54 | 54 | <?php |
55 | - } |
|
56 | - } |
|
57 | - ?> |
|
55 | + } |
|
56 | + } |
|
57 | + ?> |
|
58 | 58 | </tbody> |
59 | 59 | </table> |
60 | 60 | </div> |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(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."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('view_eventlog')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // get id |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | <div class="tab-page"> |
42 | 42 | <div class="container container-body"> |
43 | 43 | <?php |
44 | - $date = $modx->toDateFormat($content["createdon"]); |
|
45 | - if($content["type"] == 1) { |
|
46 | - $icon = $_style['actions_info'] . ' text-info'; |
|
47 | - $msgtype = $_lang["information"]; |
|
48 | - } else if($content["type"] == 2) { |
|
49 | - $icon = $_style['actions_triangle'] . ' text-warning'; |
|
50 | - $msgtype = $_lang["warning"]; |
|
51 | - } else if($content["type"] == 3) { |
|
52 | - $icon = $_style['actions_error'] . ' text-danger'; |
|
53 | - $msgtype = $_lang["error"]; |
|
54 | - } |
|
55 | - ?> |
|
44 | + $date = $modx->toDateFormat($content["createdon"]); |
|
45 | + if($content["type"] == 1) { |
|
46 | + $icon = $_style['actions_info'] . ' text-info'; |
|
47 | + $msgtype = $_lang["information"]; |
|
48 | + } else if($content["type"] == 2) { |
|
49 | + $icon = $_style['actions_triangle'] . ' text-warning'; |
|
50 | + $msgtype = $_lang["warning"]; |
|
51 | + } else if($content["type"] == 3) { |
|
52 | + $icon = $_style['actions_error'] . ' text-danger'; |
|
53 | + $msgtype = $_lang["error"]; |
|
54 | + } |
|
55 | + ?> |
|
56 | 56 | <p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p> |
57 | 57 | <p> |
58 | 58 | <i class="<?= $icon ?>"></i> <?= $msgtype ?> |
@@ -2,8 +2,8 @@ |
||
2 | 2 | if(!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE != 'true') exit(); |
3 | 3 | |
4 | 4 | if(!$modx->hasPermission('delete_plugin')) { |
5 | - $e->setError(3); |
|
6 | - $e->dumpError(); |
|
5 | + $e->setError(3); |
|
6 | + $e->dumpError(); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $tbl_site_plugins = $modx->getFullTablename('site_plugins'); |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | |
8 | 8 | // invoke OnBeforeManagerLogout event |
9 | 9 | $modx->invokeEvent("OnBeforeManagerLogout", |
10 | - array( |
|
11 | - "userid" => $internalKey, |
|
12 | - "username" => $username |
|
13 | - )); |
|
10 | + array( |
|
11 | + "userid" => $internalKey, |
|
12 | + "username" => $username |
|
13 | + )); |
|
14 | 14 | |
15 | 15 | //// Unset all of the session variables. |
16 | 16 | //$_SESSION = array(); |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | |
34 | 34 | // invoke OnManagerLogout event |
35 | 35 | $modx->invokeEvent("OnManagerLogout", |
36 | - array( |
|
37 | - "userid" => $internalKey, |
|
38 | - "username" => $username |
|
39 | - )); |
|
36 | + array( |
|
37 | + "userid" => $internalKey, |
|
38 | + "username" => $username |
|
39 | + )); |
|
40 | 40 | |
41 | 41 | // show login screen |
42 | 42 | header('Location: ' . MODX_MANAGER_URL); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_document')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "deleted=1"); |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | // invoke OnBeforeEmptyTrash event |
11 | 11 | $modx->invokeEvent("OnBeforeEmptyTrash", |
12 | - array( |
|
13 | - "ids"=>$ids |
|
14 | - )); |
|
12 | + array( |
|
13 | + "ids"=>$ids |
|
14 | + )); |
|
15 | 15 | |
16 | 16 | // remove the document groups link. |
17 | 17 | $sql = "DELETE document_groups |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | //'undelete' the document. |
31 | 31 | $modx->db->delete($modx->getFullTableName('site_content'), "deleted=1"); |
32 | 32 | |
33 | - // invoke OnEmptyTrash event |
|
34 | - $modx->invokeEvent("OnEmptyTrash", |
|
35 | - array( |
|
36 | - "ids"=>$ids |
|
37 | - )); |
|
33 | + // invoke OnEmptyTrash event |
|
34 | + $modx->invokeEvent("OnEmptyTrash", |
|
35 | + array( |
|
36 | + "ids"=>$ids |
|
37 | + )); |
|
38 | 38 | |
39 | - // empty cache |
|
40 | - $modx->clearCache('full'); |
|
39 | + // empty cache |
|
40 | + $modx->clearCache('full'); |
|
41 | 41 | |
42 | - // finished emptying cache - redirect |
|
43 | - $header="Location: index.php?a=2&r=1"; |
|
44 | - header($header); |
|
42 | + // finished emptying cache - redirect |
|
43 | + $header="Location: index.php?a=2&r=1"; |
|
44 | + header($header); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_web_user')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // Set the item name for logger |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | |
16 | 16 | // invoke OnBeforeWUsrFormDelete event |
17 | 17 | $modx->invokeEvent("OnBeforeWUsrFormDelete", |
18 | - array( |
|
19 | - "id" => $id |
|
20 | - )); |
|
18 | + array( |
|
19 | + "id" => $id |
|
20 | + )); |
|
21 | 21 | |
22 | 22 | // delete the user. |
23 | 23 | $modx->db->delete($modx->getFullTableName('web_users'), "id='{$id}'"); |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | |
31 | 31 | // invoke OnWebDeleteUser event |
32 | 32 | $modx->invokeEvent("OnWebDeleteUser", |
33 | - array( |
|
34 | - "userid" => $id, |
|
35 | - "username" => $username |
|
36 | - )); |
|
33 | + array( |
|
34 | + "userid" => $id, |
|
35 | + "username" => $username |
|
36 | + )); |
|
37 | 37 | |
38 | 38 | // invoke OnWUsrFormDelete event |
39 | 39 | $modx->invokeEvent("OnWUsrFormDelete", |
40 | - array( |
|
41 | - "id" => $id |
|
42 | - )); |
|
40 | + array( |
|
41 | + "id" => $id |
|
42 | + )); |
|
43 | 43 | |
44 | 44 | $header="Location: index.php?a=99"; |
45 | 45 | header($header); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_plugin')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // Set the item name for logger |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | |
16 | 16 | // invoke OnBeforePluginFormDelete event |
17 | 17 | $modx->invokeEvent("OnBeforePluginFormDelete", |
18 | - array( |
|
19 | - "id" => $id |
|
20 | - )); |
|
18 | + array( |
|
19 | + "id" => $id |
|
20 | + )); |
|
21 | 21 | |
22 | 22 | // delete the plugin. |
23 | 23 | $modx->db->delete($modx->getFullTableName('site_plugins'), "id='{$id}'"); |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | |
28 | 28 | // invoke OnPluginFormDelete event |
29 | 29 | $modx->invokeEvent("OnPluginFormDelete", |
30 | - array( |
|
31 | - "id" => $id |
|
32 | - )); |
|
30 | + array( |
|
31 | + "id" => $id |
|
32 | + )); |
|
33 | 33 | |
34 | 34 | // empty cache |
35 | 35 | $modx->clearCache('full'); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | $children = array(); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $udperms->duplicateDoc = true; |
21 | 21 | |
22 | 22 | if(!$udperms->checkPermissions()) { |
23 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
23 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | // Run the duplicator |
@@ -35,125 +35,125 @@ discard block |
||
35 | 35 | header($header); |
36 | 36 | |
37 | 37 | function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
38 | - global $modx, $_lang; |
|
39 | - |
|
40 | - // invoke OnBeforeDocDuplicate event |
|
41 | - $evtOut = $modx->invokeEvent('OnBeforeDocDuplicate', array( |
|
42 | - 'id' => $docid |
|
43 | - )); |
|
44 | - |
|
45 | - // if( !in_array( 'false', array_values( $evtOut ) ) ){} |
|
46 | - // TODO: Determine necessary handling for duplicateDocument "return $newparent" if OnBeforeDocDuplicate were able to conditially control duplication |
|
47 | - // [DISABLED]: Proceed with duplicateDocument if OnBeforeDocDuplicate did not return false via: $event->output('false'); |
|
48 | - |
|
49 | - $userID = $modx->getLoginUserID(); |
|
50 | - |
|
51 | - $tblsc = $modx->getFullTableName('site_content'); |
|
52 | - |
|
53 | - // Grab the original document |
|
54 | - $rs = $modx->db->select('*', $tblsc, "id='{$docid}'"); |
|
55 | - $content = $modx->db->getRow($rs); |
|
56 | - |
|
57 | - // Handle incremental ID |
|
58 | - switch($modx->config['docid_incrmnt_method']) |
|
59 | - { |
|
60 | - case '1': |
|
61 | - $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
|
62 | - $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
63 | - $content['id'] = $modx->db->getValue($rs); |
|
64 | - break; |
|
65 | - case '2': |
|
66 | - $rs = $modx->db->select('MAX(id)+1',$tblsc); |
|
67 | - $content['id'] = $modx->db->getValue($rs); |
|
68 | - break; |
|
69 | - |
|
70 | - default: |
|
71 | - unset($content['id']); // remove the current id. |
|
72 | - } |
|
73 | - |
|
74 | - // Once we've grabbed the document object, start doing some modifications |
|
75 | - if ($_toplevel == 0) { |
|
76 | - // count duplicates |
|
77 | - $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
|
78 | - $pagetitle = $modx->db->escape($pagetitle); |
|
79 | - $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
|
80 | - if($count>=1) $count = ' '.($count+1); |
|
81 | - else $count = ''; |
|
38 | + global $modx, $_lang; |
|
39 | + |
|
40 | + // invoke OnBeforeDocDuplicate event |
|
41 | + $evtOut = $modx->invokeEvent('OnBeforeDocDuplicate', array( |
|
42 | + 'id' => $docid |
|
43 | + )); |
|
44 | + |
|
45 | + // if( !in_array( 'false', array_values( $evtOut ) ) ){} |
|
46 | + // TODO: Determine necessary handling for duplicateDocument "return $newparent" if OnBeforeDocDuplicate were able to conditially control duplication |
|
47 | + // [DISABLED]: Proceed with duplicateDocument if OnBeforeDocDuplicate did not return false via: $event->output('false'); |
|
48 | + |
|
49 | + $userID = $modx->getLoginUserID(); |
|
50 | + |
|
51 | + $tblsc = $modx->getFullTableName('site_content'); |
|
52 | + |
|
53 | + // Grab the original document |
|
54 | + $rs = $modx->db->select('*', $tblsc, "id='{$docid}'"); |
|
55 | + $content = $modx->db->getRow($rs); |
|
56 | + |
|
57 | + // Handle incremental ID |
|
58 | + switch($modx->config['docid_incrmnt_method']) |
|
59 | + { |
|
60 | + case '1': |
|
61 | + $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
|
62 | + $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
63 | + $content['id'] = $modx->db->getValue($rs); |
|
64 | + break; |
|
65 | + case '2': |
|
66 | + $rs = $modx->db->select('MAX(id)+1',$tblsc); |
|
67 | + $content['id'] = $modx->db->getValue($rs); |
|
68 | + break; |
|
69 | + |
|
70 | + default: |
|
71 | + unset($content['id']); // remove the current id. |
|
72 | + } |
|
73 | + |
|
74 | + // Once we've grabbed the document object, start doing some modifications |
|
75 | + if ($_toplevel == 0) { |
|
76 | + // count duplicates |
|
77 | + $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
|
78 | + $pagetitle = $modx->db->escape($pagetitle); |
|
79 | + $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
|
80 | + if($count>=1) $count = ' '.($count+1); |
|
81 | + else $count = ''; |
|
82 | 82 | |
83 | - $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
|
84 | - $content['alias'] = null; |
|
85 | - } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
86 | - $content['alias'] = null; |
|
87 | - } |
|
88 | - |
|
89 | - // change the parent accordingly |
|
90 | - if ($parent !== null) $content['parent'] = $parent; |
|
91 | - |
|
92 | - // Change the author |
|
93 | - $content['createdby'] = $userID; |
|
94 | - $content['createdon'] = time(); |
|
95 | - // Remove other modification times |
|
96 | - $content['editedby'] = $content['editedon'] = $content['deleted'] = $content['deletedby'] = $content['deletedon'] = 0; |
|
97 | - |
|
98 | - // [FS#922] Should the published status be honored? - sirlancelot |
|
83 | + $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
|
84 | + $content['alias'] = null; |
|
85 | + } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
86 | + $content['alias'] = null; |
|
87 | + } |
|
88 | + |
|
89 | + // change the parent accordingly |
|
90 | + if ($parent !== null) $content['parent'] = $parent; |
|
91 | + |
|
92 | + // Change the author |
|
93 | + $content['createdby'] = $userID; |
|
94 | + $content['createdon'] = time(); |
|
95 | + // Remove other modification times |
|
96 | + $content['editedby'] = $content['editedon'] = $content['deleted'] = $content['deletedby'] = $content['deletedon'] = 0; |
|
97 | + |
|
98 | + // [FS#922] Should the published status be honored? - sirlancelot |
|
99 | 99 | // if ($modx->hasPermission('publish_document')) { |
100 | 100 | // if ($modx->config['publish_default']) |
101 | 101 | // $content['pub_date'] = $content['pub_date']; // should this be changed to 1? |
102 | 102 | // else $content['pub_date'] = 0; |
103 | 103 | // } else { |
104 | - // User can't publish documents |
|
104 | + // User can't publish documents |
|
105 | 105 | // $content['published'] = $content['pub_date'] = 0; |
106 | 106 | // } |
107 | 107 | |
108 | 108 | // Set the published status to unpublished by default (see above ... commit #3388) |
109 | 109 | $content['published'] = $content['pub_date'] = 0; |
110 | 110 | |
111 | - // Escape the proper strings |
|
112 | - $content = $modx->db->escape($content); |
|
111 | + // Escape the proper strings |
|
112 | + $content = $modx->db->escape($content); |
|
113 | 113 | |
114 | - // Duplicate the Document |
|
115 | - $newparent = $modx->db->insert($content, $tblsc); |
|
114 | + // Duplicate the Document |
|
115 | + $newparent = $modx->db->insert($content, $tblsc); |
|
116 | 116 | |
117 | - // duplicate document's TVs |
|
118 | - duplicateTVs($docid, $newparent); |
|
119 | - duplicateAccess($docid, $newparent); |
|
117 | + // duplicate document's TVs |
|
118 | + duplicateTVs($docid, $newparent); |
|
119 | + duplicateAccess($docid, $newparent); |
|
120 | 120 | |
121 | - // invoke OnDocDuplicate event |
|
122 | - $evtOut = $modx->invokeEvent('OnDocDuplicate', array( |
|
123 | - 'id' => $docid, |
|
124 | - 'new_id' => $newparent |
|
125 | - )); |
|
126 | - |
|
127 | - // Start duplicating all the child documents that aren't deleted. |
|
128 | - $_toplevel++; |
|
129 | - $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
|
130 | - while ($row = $modx->db->getRow($rs)) |
|
131 | - duplicateDocument($row['id'], $newparent, $_toplevel); |
|
132 | - |
|
133 | - // return the new doc id |
|
134 | - return $newparent; |
|
121 | + // invoke OnDocDuplicate event |
|
122 | + $evtOut = $modx->invokeEvent('OnDocDuplicate', array( |
|
123 | + 'id' => $docid, |
|
124 | + 'new_id' => $newparent |
|
125 | + )); |
|
126 | + |
|
127 | + // Start duplicating all the child documents that aren't deleted. |
|
128 | + $_toplevel++; |
|
129 | + $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
|
130 | + while ($row = $modx->db->getRow($rs)) |
|
131 | + duplicateDocument($row['id'], $newparent, $_toplevel); |
|
132 | + |
|
133 | + // return the new doc id |
|
134 | + return $newparent; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // Duplicate Document TVs |
138 | 138 | function duplicateTVs($oldid,$newid){ |
139 | - global $modx; |
|
139 | + global $modx; |
|
140 | 140 | |
141 | - $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
141 | + $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
142 | 142 | |
143 | - $modx->db->insert( |
|
144 | - array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into |
|
145 | - "{$newid}, tmplvarid, value", $tbltvc, "contentid='{$oldid}'" // Copy from |
|
146 | - ); |
|
143 | + $modx->db->insert( |
|
144 | + array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into |
|
145 | + "{$newid}, tmplvarid, value", $tbltvc, "contentid='{$oldid}'" // Copy from |
|
146 | + ); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // Duplicate Document Access Permissions |
150 | 150 | function duplicateAccess($oldid,$newid){ |
151 | - global $modx; |
|
151 | + global $modx; |
|
152 | 152 | |
153 | - $tbldg = $modx->getFullTableName('document_groups'); |
|
153 | + $tbldg = $modx->getFullTableName('document_groups'); |
|
154 | 154 | |
155 | - $modx->db->insert( |
|
156 | - array('document'=>'', 'document_group'=>''), $tbldg, // Insert into |
|
157 | - "{$newid}, document_group", $tbldg, "document='{$oldid}'" // Copy from |
|
158 | - ); |
|
155 | + $modx->db->insert( |
|
156 | + array('document'=>'', 'document_group'=>''), $tbldg, // Insert into |
|
157 | + "{$newid}, document_group", $tbldg, "document='{$oldid}'" // Copy from |
|
158 | + ); |
|
159 | 159 | } |