@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 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."); |
|
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 | |
6 | 6 | /********************/ |
@@ -12,29 +12,29 @@ discard block |
||
12 | 12 | |
13 | 13 | // check permissions |
14 | 14 | switch($modx->getManagerApi()->action) { |
15 | - case 27: |
|
16 | - if(!$modx->hasPermission('edit_document')) { |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | - } |
|
19 | - break; |
|
20 | - case 85: |
|
21 | - case 72: |
|
22 | - case 4: |
|
23 | - if(!$modx->hasPermission('new_document')) { |
|
24 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | - // check user has permissions for parent |
|
27 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
28 | - $udperms->user = $modx->getLoginUserID(); |
|
29 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
30 | - $udperms->role = $_SESSION['mgrRole']; |
|
31 | - if(!$udperms->checkPermissions()) { |
|
32 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
33 | - } |
|
34 | - } |
|
35 | - break; |
|
36 | - default: |
|
37 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + case 27: |
|
16 | + if(!$modx->hasPermission('edit_document')) { |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | + } |
|
19 | + break; |
|
20 | + case 85: |
|
21 | + case 72: |
|
22 | + case 4: |
|
23 | + if(!$modx->hasPermission('new_document')) { |
|
24 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | + } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | + // check user has permissions for parent |
|
27 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
28 | + $udperms->user = $modx->getLoginUserID(); |
|
29 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
30 | + $udperms->role = $_SESSION['mgrRole']; |
|
31 | + if(!$udperms->checkPermissions()) { |
|
32 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
33 | + } |
|
34 | + } |
|
35 | + break; |
|
36 | + default: |
|
37 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
54 | 54 | |
55 | 55 | if($modx->getManagerApi()->action == 27) { |
56 | - //editing an existing document |
|
57 | - // check permissions on the document |
|
58 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
59 | - $udperms->user = $modx->getLoginUserID(); |
|
60 | - $udperms->document = $id; |
|
61 | - $udperms->role = $_SESSION['mgrRole']; |
|
62 | - |
|
63 | - if(!$udperms->checkPermissions()) { |
|
64 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
65 | - } |
|
56 | + //editing an existing document |
|
57 | + // check permissions on the document |
|
58 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
59 | + $udperms->user = $modx->getLoginUserID(); |
|
60 | + $udperms->document = $id; |
|
61 | + $udperms->role = $_SESSION['mgrRole']; |
|
62 | + |
|
63 | + if(!$udperms->checkPermissions()) { |
|
64 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // check to see if resource isn't locked |
69 | 69 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
70 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
70 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
71 | 71 | } |
72 | 72 | // end check for lock |
73 | 73 | |
@@ -76,74 +76,74 @@ discard block |
||
76 | 76 | |
77 | 77 | // get document groups for current user |
78 | 78 | if($_SESSION['mgrDocgroups']) { |
79 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
79 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | if(!empty ($id)) { |
83 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
84 | - if($docgrp) { |
|
85 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
86 | - } |
|
87 | - $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
88 | - $content = array(); |
|
89 | - $content = $modx->getDatabase()->getRow($rs); |
|
90 | - $modx->documentObject = &$content; |
|
91 | - if(!$content) { |
|
92 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
93 | - } |
|
94 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
83 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
84 | + if($docgrp) { |
|
85 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
86 | + } |
|
87 | + $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
88 | + $content = array(); |
|
89 | + $content = $modx->getDatabase()->getRow($rs); |
|
90 | + $modx->documentObject = &$content; |
|
91 | + if(!$content) { |
|
92 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
93 | + } |
|
94 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
95 | 95 | } else { |
96 | - $content = array(); |
|
96 | + $content = array(); |
|
97 | 97 | |
98 | - if(isset($_REQUEST['newtemplate'])) { |
|
99 | - $content['template'] = $_REQUEST['newtemplate']; |
|
100 | - } else { |
|
101 | - $content['template'] = getDefaultTemplate(); |
|
102 | - } |
|
98 | + if(isset($_REQUEST['newtemplate'])) { |
|
99 | + $content['template'] = $_REQUEST['newtemplate']; |
|
100 | + } else { |
|
101 | + $content['template'] = getDefaultTemplate(); |
|
102 | + } |
|
103 | 103 | |
104 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
104 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // restore saved form |
108 | 108 | $formRestored = $modx->getManagerApi()->loadFormValues(); |
109 | 109 | if(isset($_REQUEST['newtemplate'])) { |
110 | - $formRestored = true; |
|
110 | + $formRestored = true; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // retain form values if template was changed |
114 | 114 | // edited to convert pub_date and unpub_date |
115 | 115 | // sottwell 02-09-2006 |
116 | 116 | if($formRestored == true) { |
117 | - $content = array_merge($content, $_POST); |
|
118 | - $content['content'] = $_POST['ta']; |
|
119 | - if(empty ($content['pub_date'])) { |
|
120 | - unset ($content['pub_date']); |
|
121 | - } else { |
|
122 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
123 | - } |
|
124 | - if(empty ($content['unpub_date'])) { |
|
125 | - unset ($content['unpub_date']); |
|
126 | - } else { |
|
127 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
128 | - } |
|
117 | + $content = array_merge($content, $_POST); |
|
118 | + $content['content'] = $_POST['ta']; |
|
119 | + if(empty ($content['pub_date'])) { |
|
120 | + unset ($content['pub_date']); |
|
121 | + } else { |
|
122 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
123 | + } |
|
124 | + if(empty ($content['unpub_date'])) { |
|
125 | + unset ($content['unpub_date']); |
|
126 | + } else { |
|
127 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
128 | + } |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // increase menu index if this is a new document |
132 | 132 | if(!isset ($_REQUEST['id'])) { |
133 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | - $modx->config['auto_menuindex'] = 1; |
|
135 | - } |
|
136 | - if($modx->config['auto_menuindex']) { |
|
137 | - $pid = (int)$_REQUEST['pid']; |
|
138 | - $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
139 | - $content['menuindex'] = $modx->getDatabase()->getValue($rs); |
|
140 | - } else { |
|
141 | - $content['menuindex'] = 0; |
|
142 | - } |
|
133 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | + $modx->config['auto_menuindex'] = 1; |
|
135 | + } |
|
136 | + if($modx->config['auto_menuindex']) { |
|
137 | + $pid = (int)$_REQUEST['pid']; |
|
138 | + $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
139 | + $content['menuindex'] = $modx->getDatabase()->getValue($rs); |
|
140 | + } else { |
|
141 | + $content['menuindex'] = 0; |
|
142 | + } |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if(isset ($_POST['which_editor'])) { |
146 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
146 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // Add lock-element JS-Script |
@@ -543,23 +543,23 @@ discard block |
||
543 | 543 | |
544 | 544 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
545 | 545 | <?php |
546 | - // invoke OnDocFormPrerender event |
|
547 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
548 | - 'id' => $id, |
|
549 | - 'template' => $content['template'] |
|
550 | - )); |
|
551 | - |
|
552 | - if(is_array($evtOut)) { |
|
553 | - echo implode('', $evtOut); |
|
554 | - } |
|
555 | - |
|
556 | - /*************************/ |
|
557 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
558 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
559 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
560 | - /*************************/ |
|
561 | - |
|
562 | - ?> |
|
546 | + // invoke OnDocFormPrerender event |
|
547 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
548 | + 'id' => $id, |
|
549 | + 'template' => $content['template'] |
|
550 | + )); |
|
551 | + |
|
552 | + if(is_array($evtOut)) { |
|
553 | + echo implode('', $evtOut); |
|
554 | + } |
|
555 | + |
|
556 | + /*************************/ |
|
557 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
558 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
559 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
560 | + /*************************/ |
|
561 | + |
|
562 | + ?> |
|
563 | 563 | <input type="hidden" name="a" value="5" /> |
564 | 564 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
565 | 565 | <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>" /> |
@@ -574,54 +574,54 @@ discard block |
||
574 | 574 | |
575 | 575 | <h1> |
576 | 576 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
577 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
578 | - } else { |
|
579 | - if ($modx->getManagerApi()->action == '4') { |
|
577 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
578 | + } else { |
|
579 | + if ($modx->getManagerApi()->action == '4') { |
|
580 | 580 | echo $_lang['add_resource']; |
581 | 581 | } else if ($modx->getManagerApi()->action == '72') { |
582 | 582 | echo $_lang['add_weblink']; |
583 | 583 | } else { |
584 | 584 | echo $_lang['create_resource_title']; |
585 | 585 | } |
586 | - } ?> |
|
586 | + } ?> |
|
587 | 587 | </h1> |
588 | 588 | |
589 | 589 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
590 | 590 | |
591 | 591 | <?php |
592 | - // breadcrumbs |
|
593 | - if($modx->config['use_breadcrumbs']) { |
|
594 | - $temp = array(); |
|
595 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
596 | - |
|
597 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
598 | - $bID = (int) $_REQUEST['id']; |
|
599 | - $temp = $modx->getParentIds($bID); |
|
600 | - } else if(isset($_REQUEST['pid'])) { |
|
601 | - $bID = (int) $_REQUEST['pid']; |
|
602 | - $temp = $modx->getParentIds($bID); |
|
603 | - array_unshift($temp, $bID); |
|
604 | - } |
|
605 | - |
|
606 | - if($temp) { |
|
607 | - $parents = implode(',', $temp); |
|
608 | - |
|
609 | - if(!empty($parents)) { |
|
610 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
611 | - $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
612 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
613 | - $out .= '<li class="breadcrumbs__li"> |
|
592 | + // breadcrumbs |
|
593 | + if($modx->config['use_breadcrumbs']) { |
|
594 | + $temp = array(); |
|
595 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
596 | + |
|
597 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
598 | + $bID = (int) $_REQUEST['id']; |
|
599 | + $temp = $modx->getParentIds($bID); |
|
600 | + } else if(isset($_REQUEST['pid'])) { |
|
601 | + $bID = (int) $_REQUEST['pid']; |
|
602 | + $temp = $modx->getParentIds($bID); |
|
603 | + array_unshift($temp, $bID); |
|
604 | + } |
|
605 | + |
|
606 | + if($temp) { |
|
607 | + $parents = implode(',', $temp); |
|
608 | + |
|
609 | + if(!empty($parents)) { |
|
610 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
611 | + $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
612 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
613 | + $out .= '<li class="breadcrumbs__li"> |
|
614 | 614 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
615 | 615 | <span class="breadcrumbs__sep">></span> |
616 | 616 | </li>'; |
617 | - } |
|
618 | - } |
|
619 | - } |
|
617 | + } |
|
618 | + } |
|
619 | + } |
|
620 | 620 | |
621 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
622 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | - } |
|
624 | - ?> |
|
621 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
622 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | + } |
|
624 | + ?> |
|
625 | 625 | |
626 | 626 | <!-- start main wrapper --> |
627 | 627 | <div class="sectionBody"> |
@@ -633,13 +633,13 @@ discard block |
||
633 | 633 | |
634 | 634 | <!-- General --> |
635 | 635 | <?php |
636 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
637 | - 'id' => $id |
|
638 | - )); |
|
639 | - if(is_array($evtOut)) { |
|
640 | - echo implode('', $evtOut); |
|
641 | - } else { |
|
642 | - ?> |
|
636 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
637 | + 'id' => $id |
|
638 | + )); |
|
639 | + if(is_array($evtOut)) { |
|
640 | + echo implode('', $evtOut); |
|
641 | + } else { |
|
642 | + ?> |
|
643 | 643 | <div class="tab-page" id="tabGeneral"> |
644 | 644 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
645 | 645 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -724,36 +724,36 @@ discard block |
||
724 | 724 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
725 | 725 | <option value="0">(blank)</option> |
726 | 726 | <?php |
727 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
728 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
729 | - $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
730 | - $currentCategory = ''; |
|
731 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
732 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | - continue; |
|
734 | - }; |
|
735 | - // Skip if not selectable but show if selected! |
|
736 | - $thisCategory = $row['category']; |
|
737 | - if($thisCategory == null) { |
|
738 | - $thisCategory = $_lang["no_category"]; |
|
739 | - } |
|
740 | - if($thisCategory != $currentCategory) { |
|
741 | - if($closeOptGroup) { |
|
742 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
743 | - } |
|
744 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
745 | - $closeOptGroup = true; |
|
746 | - } |
|
727 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
728 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
729 | + $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
730 | + $currentCategory = ''; |
|
731 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
732 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | + continue; |
|
734 | + }; |
|
735 | + // Skip if not selectable but show if selected! |
|
736 | + $thisCategory = $row['category']; |
|
737 | + if($thisCategory == null) { |
|
738 | + $thisCategory = $_lang["no_category"]; |
|
739 | + } |
|
740 | + if($thisCategory != $currentCategory) { |
|
741 | + if($closeOptGroup) { |
|
742 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
743 | + } |
|
744 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
745 | + $closeOptGroup = true; |
|
746 | + } |
|
747 | 747 | |
748 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
748 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
749 | 749 | |
750 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
751 | - $currentCategory = $thisCategory; |
|
752 | - } |
|
753 | - if($thisCategory != '') { |
|
754 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
755 | - } |
|
756 | - ?> |
|
750 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
751 | + $currentCategory = $thisCategory; |
|
752 | + } |
|
753 | + if($thisCategory != '') { |
|
754 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
755 | + } |
|
756 | + ?> |
|
757 | 757 | </select> |
758 | 758 | </td> |
759 | 759 | </tr> |
@@ -793,37 +793,37 @@ discard block |
||
793 | 793 | </td> |
794 | 794 | <td valign="top"> |
795 | 795 | <?php |
796 | - $parentlookup = false; |
|
797 | - if(isset ($_REQUEST['id'])) { |
|
798 | - if($content['parent'] == 0) { |
|
799 | - $parentname = $site_name; |
|
800 | - } else { |
|
801 | - $parentlookup = $content['parent']; |
|
802 | - } |
|
803 | - } elseif(isset ($_REQUEST['pid'])) { |
|
804 | - if($_REQUEST['pid'] == 0) { |
|
805 | - $parentname = $site_name; |
|
806 | - } else { |
|
807 | - $parentlookup = $_REQUEST['pid']; |
|
808 | - } |
|
809 | - } elseif(isset($_POST['parent'])) { |
|
810 | - if($_POST['parent'] == 0) { |
|
811 | - $parentname = $site_name; |
|
812 | - } else { |
|
813 | - $parentlookup = $_POST['parent']; |
|
814 | - } |
|
815 | - } else { |
|
816 | - $parentname = $site_name; |
|
817 | - $content['parent'] = 0; |
|
818 | - } |
|
819 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
820 | - $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
821 | - $parentname = $modx->getDatabase()->getValue($rs); |
|
822 | - if(!$parentname) { |
|
823 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
824 | - } |
|
825 | - } |
|
826 | - ?> |
|
796 | + $parentlookup = false; |
|
797 | + if(isset ($_REQUEST['id'])) { |
|
798 | + if($content['parent'] == 0) { |
|
799 | + $parentname = $site_name; |
|
800 | + } else { |
|
801 | + $parentlookup = $content['parent']; |
|
802 | + } |
|
803 | + } elseif(isset ($_REQUEST['pid'])) { |
|
804 | + if($_REQUEST['pid'] == 0) { |
|
805 | + $parentname = $site_name; |
|
806 | + } else { |
|
807 | + $parentlookup = $_REQUEST['pid']; |
|
808 | + } |
|
809 | + } elseif(isset($_POST['parent'])) { |
|
810 | + if($_POST['parent'] == 0) { |
|
811 | + $parentname = $site_name; |
|
812 | + } else { |
|
813 | + $parentlookup = $_POST['parent']; |
|
814 | + } |
|
815 | + } else { |
|
816 | + $parentname = $site_name; |
|
817 | + $content['parent'] = 0; |
|
818 | + } |
|
819 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
820 | + $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
821 | + $parentname = $modx->getDatabase()->getValue($rs); |
|
822 | + if(!$parentname) { |
|
823 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
824 | + } |
|
825 | + } |
|
826 | + ?> |
|
827 | 827 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
828 | 828 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $modx->getPhpCompat()->entities($parentname) ?>)</span></b> |
829 | 829 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | </tr> |
832 | 832 | <tr></tr> |
833 | 833 | <?php |
834 | - /* |
|
834 | + /* |
|
835 | 835 | if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { |
836 | 836 | ?> |
837 | 837 | <tr> |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | </tr> |
860 | 860 | <?php |
861 | 861 | }*/ |
862 | - ?> |
|
862 | + ?> |
|
863 | 863 | |
864 | 864 | <?php if($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?> |
865 | 865 | <tr> |
@@ -872,36 +872,36 @@ discard block |
||
872 | 872 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
873 | 873 | <option value="none"><?= $_lang['none'] ?></option> |
874 | 874 | <?php |
875 | - // invoke OnRichTextEditorRegister event |
|
876 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
877 | - if(is_array($evtOut)) { |
|
878 | - for($i = 0; $i < count($evtOut); $i++) { |
|
879 | - $editor = $evtOut[$i]; |
|
880 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
881 | - } |
|
882 | - } |
|
883 | - ?> |
|
875 | + // invoke OnRichTextEditorRegister event |
|
876 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
877 | + if(is_array($evtOut)) { |
|
878 | + for($i = 0; $i < count($evtOut); $i++) { |
|
879 | + $editor = $evtOut[$i]; |
|
880 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
881 | + } |
|
882 | + } |
|
883 | + ?> |
|
884 | 884 | </select> |
885 | 885 | </label> |
886 | 886 | </div> |
887 | 887 | <div id="content_body"> |
888 | 888 | <?php |
889 | - if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) { |
|
890 | - $htmlContent = $content['content']; |
|
891 | - ?> |
|
889 | + if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) { |
|
890 | + $htmlContent = $content['content']; |
|
891 | + ?> |
|
892 | 892 | <div class="section-editor clearfix"> |
893 | 893 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->getPhpCompat()->htmlspecialchars($htmlContent) ?></textarea> |
894 | 894 | </div> |
895 | 895 | <?php |
896 | - // Richtext-[*content*] |
|
897 | - $richtexteditorIds = array(); |
|
898 | - $richtexteditorOptions = array(); |
|
899 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
900 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
901 | - } else { |
|
902 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
903 | - } |
|
904 | - ?> |
|
896 | + // Richtext-[*content*] |
|
897 | + $richtexteditorIds = array(); |
|
898 | + $richtexteditorOptions = array(); |
|
899 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
900 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
901 | + } else { |
|
902 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
903 | + } |
|
904 | + ?> |
|
905 | 905 | </div> |
906 | 906 | </td> |
907 | 907 | </tr> |
@@ -1208,8 +1208,8 @@ discard block |
||
1208 | 1208 | |
1209 | 1209 | <?php |
1210 | 1210 | |
1211 | - if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1212 | - ?> |
|
1211 | + if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1212 | + ?> |
|
1213 | 1213 | <tr> |
1214 | 1214 | <td> |
1215 | 1215 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1231,15 +1231,15 @@ discard block |
||
1231 | 1231 | <td> |
1232 | 1232 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1233 | 1233 | <?php |
1234 | - if(!$content['contentType']) { |
|
1235 | - $content['contentType'] = 'text/html'; |
|
1236 | - } |
|
1237 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1238 | - $ct = explode(",", $custom_contenttype); |
|
1239 | - for($i = 0; $i < count($ct); $i++) { |
|
1240 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1241 | - } |
|
1242 | - ?> |
|
1234 | + if(!$content['contentType']) { |
|
1235 | + $content['contentType'] = 'text/html'; |
|
1236 | + } |
|
1237 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1238 | + $ct = explode(",", $custom_contenttype); |
|
1239 | + for($i = 0; $i < count($ct); $i++) { |
|
1240 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1241 | + } |
|
1242 | + ?> |
|
1243 | 1243 | </select> |
1244 | 1244 | </td> |
1245 | 1245 | </tr> |
@@ -1262,23 +1262,23 @@ discard block |
||
1262 | 1262 | </td> |
1263 | 1263 | </tr> |
1264 | 1264 | <?php |
1265 | - } else { |
|
1266 | - if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') { |
|
1267 | - // non-admin managers creating or editing a document resource |
|
1268 | - ?> |
|
1265 | + } else { |
|
1266 | + if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') { |
|
1267 | + // non-admin managers creating or editing a document resource |
|
1268 | + ?> |
|
1269 | 1269 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
1270 | 1270 | <input type="hidden" name="type" value="document" /> |
1271 | 1271 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
1272 | 1272 | <?php |
1273 | - } else { |
|
1274 | - // non-admin managers creating or editing a reference (weblink) resource |
|
1275 | - ?> |
|
1273 | + } else { |
|
1274 | + // non-admin managers creating or editing a reference (weblink) resource |
|
1275 | + ?> |
|
1276 | 1276 | <input type="hidden" name="type" value="reference" /> |
1277 | 1277 | <input type="hidden" name="contentType" value="text/html" /> |
1278 | 1278 | <?php |
1279 | - } |
|
1280 | - }//if mgrRole |
|
1281 | - ?> |
|
1279 | + } |
|
1280 | + }//if mgrRole |
|
1281 | + ?> |
|
1282 | 1282 | |
1283 | 1283 | <tr> |
1284 | 1284 | <td> |
@@ -1361,112 +1361,112 @@ discard block |
||
1361 | 1361 | ?> |
1362 | 1362 | |
1363 | 1363 | <?php |
1364 | - /******************************* |
|
1364 | + /******************************* |
|
1365 | 1365 | * Document Access Permissions */ |
1366 | - if($use_udperms == 1) { |
|
1367 | - $groupsarray = array(); |
|
1368 | - $sql = ''; |
|
1369 | - |
|
1370 | - $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1371 | - if($documentId > 0) { |
|
1372 | - // Load up, the permissions from the parent (if new document) or existing document |
|
1373 | - $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1374 | - while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1375 | - |
|
1376 | - // Load up the current permissions and names |
|
1377 | - $vs = array( |
|
1378 | - $tbl_document_group_names, |
|
1379 | - $tbl_document_groups, |
|
1380 | - $documentId |
|
1381 | - ); |
|
1382 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1383 | - $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1384 | - } else { |
|
1385 | - // Just load up the names, we're starting clean |
|
1386 | - $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1387 | - } |
|
1388 | - |
|
1389 | - // retain selected doc groups between post |
|
1390 | - if(isset($_POST['docgroups'])) { |
|
1391 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1392 | - } |
|
1366 | + if($use_udperms == 1) { |
|
1367 | + $groupsarray = array(); |
|
1368 | + $sql = ''; |
|
1369 | + |
|
1370 | + $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1371 | + if($documentId > 0) { |
|
1372 | + // Load up, the permissions from the parent (if new document) or existing document |
|
1373 | + $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1374 | + while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1375 | + |
|
1376 | + // Load up the current permissions and names |
|
1377 | + $vs = array( |
|
1378 | + $tbl_document_group_names, |
|
1379 | + $tbl_document_groups, |
|
1380 | + $documentId |
|
1381 | + ); |
|
1382 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1383 | + $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1384 | + } else { |
|
1385 | + // Just load up the names, we're starting clean |
|
1386 | + $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1387 | + } |
|
1388 | + |
|
1389 | + // retain selected doc groups between post |
|
1390 | + if(isset($_POST['docgroups'])) { |
|
1391 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1392 | + } |
|
1393 | + |
|
1394 | + $isManager = $modx->hasPermission('access_permissions'); |
|
1395 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1396 | + |
|
1397 | + // Setup Basic attributes for each Input box |
|
1398 | + $inputAttributes = array( |
|
1399 | + 'type' => 'checkbox', |
|
1400 | + 'class' => 'checkbox', |
|
1401 | + 'name' => 'docgroups[]', |
|
1402 | + 'onclick' => 'makePublic(false);', |
|
1403 | + ); |
|
1404 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1405 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
1406 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1407 | + |
|
1408 | + // Loop through the permissions list |
|
1409 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
1410 | + |
|
1411 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
1412 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1413 | + $inputId = 'group-' . $row['id']; |
|
1414 | + |
|
1415 | + $checked = in_array($inputValue, $groupsarray); |
|
1416 | + if($checked) { |
|
1417 | + $notPublic = true; |
|
1418 | + } // Mark as private access (either web or manager) |
|
1419 | + |
|
1420 | + // Skip the access permission if the user doesn't have access... |
|
1421 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1422 | + continue; |
|
1423 | + } |
|
1393 | 1424 | |
1394 | - $isManager = $modx->hasPermission('access_permissions'); |
|
1395 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1396 | - |
|
1397 | - // Setup Basic attributes for each Input box |
|
1398 | - $inputAttributes = array( |
|
1399 | - 'type' => 'checkbox', |
|
1400 | - 'class' => 'checkbox', |
|
1401 | - 'name' => 'docgroups[]', |
|
1402 | - 'onclick' => 'makePublic(false);', |
|
1403 | - ); |
|
1404 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1405 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
1406 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1407 | - |
|
1408 | - // Loop through the permissions list |
|
1409 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
1410 | - |
|
1411 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
1412 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1413 | - $inputId = 'group-' . $row['id']; |
|
1414 | - |
|
1415 | - $checked = in_array($inputValue, $groupsarray); |
|
1416 | - if($checked) { |
|
1417 | - $notPublic = true; |
|
1418 | - } // Mark as private access (either web or manager) |
|
1419 | - |
|
1420 | - // Skip the access permission if the user doesn't have access... |
|
1421 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1422 | - continue; |
|
1423 | - } |
|
1424 | - |
|
1425 | - // Setup attributes for this Input box |
|
1426 | - $inputAttributes['id'] = $inputId; |
|
1427 | - $inputAttributes['value'] = $inputValue; |
|
1428 | - if($checked) { |
|
1429 | - $inputAttributes['checked'] = 'checked'; |
|
1430 | - } else { |
|
1431 | - unset($inputAttributes['checked']); |
|
1432 | - } |
|
1433 | - |
|
1434 | - // Create attribute string list |
|
1435 | - $inputString = array(); |
|
1436 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1437 | - |
|
1438 | - // Make the <input> HTML |
|
1439 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1440 | - |
|
1441 | - // does user have this permission? |
|
1442 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1443 | - $vs = array( |
|
1444 | - $row['id'], |
|
1445 | - $_SESSION['mgrInternalKey'] |
|
1446 | - ); |
|
1447 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1448 | - $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where); |
|
1449 | - $count = $modx->getDatabase()->getValue($rsp); |
|
1450 | - if($count > 0) { |
|
1451 | - ++$permissions_yes; |
|
1452 | - } else { |
|
1453 | - ++$permissions_no; |
|
1454 | - } |
|
1455 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1456 | - } |
|
1457 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1458 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1459 | - $permissions = array(); |
|
1460 | - } |
|
1425 | + // Setup attributes for this Input box |
|
1426 | + $inputAttributes['id'] = $inputId; |
|
1427 | + $inputAttributes['value'] = $inputValue; |
|
1428 | + if($checked) { |
|
1429 | + $inputAttributes['checked'] = 'checked'; |
|
1430 | + } else { |
|
1431 | + unset($inputAttributes['checked']); |
|
1432 | + } |
|
1461 | 1433 | |
1462 | - // See if the Access Permissions section is worth displaying... |
|
1463 | - if(!empty($permissions)) { |
|
1464 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
1465 | - if($isManager && $isWeb) { |
|
1466 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1467 | - } |
|
1468 | - // Output the permissions list... |
|
1469 | - ?> |
|
1434 | + // Create attribute string list |
|
1435 | + $inputString = array(); |
|
1436 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1437 | + |
|
1438 | + // Make the <input> HTML |
|
1439 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1440 | + |
|
1441 | + // does user have this permission? |
|
1442 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1443 | + $vs = array( |
|
1444 | + $row['id'], |
|
1445 | + $_SESSION['mgrInternalKey'] |
|
1446 | + ); |
|
1447 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1448 | + $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where); |
|
1449 | + $count = $modx->getDatabase()->getValue($rsp); |
|
1450 | + if($count > 0) { |
|
1451 | + ++$permissions_yes; |
|
1452 | + } else { |
|
1453 | + ++$permissions_no; |
|
1454 | + } |
|
1455 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1456 | + } |
|
1457 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1458 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1459 | + $permissions = array(); |
|
1460 | + } |
|
1461 | + |
|
1462 | + // See if the Access Permissions section is worth displaying... |
|
1463 | + if(!empty($permissions)) { |
|
1464 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
1465 | + if($isManager && $isWeb) { |
|
1466 | + array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1467 | + } |
|
1468 | + // Output the permissions list... |
|
1469 | + ?> |
|
1470 | 1470 | <!-- Access Permissions --> |
1471 | 1471 | <div class="tab-page" id="tabAccess"> |
1472 | 1472 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1500,31 +1500,31 @@ discard block |
||
1500 | 1500 | </ul> |
1501 | 1501 | </div><!--div class="tab-page" id="tabAccess"--> |
1502 | 1502 | <?php |
1503 | - } // !empty($permissions) |
|
1504 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1505 | - ?> |
|
1503 | + } // !empty($permissions) |
|
1504 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1505 | + ?> |
|
1506 | 1506 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1507 | 1507 | <?php |
1508 | 1508 | |
1509 | - } |
|
1510 | - } |
|
1511 | - /* End Document Access Permissions * |
|
1509 | + } |
|
1510 | + } |
|
1511 | + /* End Document Access Permissions * |
|
1512 | 1512 | ***********************************/ |
1513 | - ?> |
|
1513 | + ?> |
|
1514 | 1514 | |
1515 | 1515 | <input type="submit" name="save" style="display:none" /> |
1516 | 1516 | <?php |
1517 | 1517 | |
1518 | - // invoke OnDocFormRender event |
|
1519 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1520 | - 'id' => $id, |
|
1521 | - 'template' => $content['template'] |
|
1522 | - )); |
|
1518 | + // invoke OnDocFormRender event |
|
1519 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1520 | + 'id' => $id, |
|
1521 | + 'template' => $content['template'] |
|
1522 | + )); |
|
1523 | 1523 | |
1524 | - if(is_array($evtOut)) { |
|
1525 | - echo implode('', $evtOut); |
|
1526 | - } |
|
1527 | - ?> |
|
1524 | + if(is_array($evtOut)) { |
|
1525 | + echo implode('', $evtOut); |
|
1526 | + } |
|
1527 | + ?> |
|
1528 | 1528 | </div><!--div class="tab-pane" id="documentPane"--> |
1529 | 1529 | </div><!--div class="sectionBody"--> |
1530 | 1530 | </fieldset> |
@@ -1535,17 +1535,17 @@ discard block |
||
1535 | 1535 | </script> |
1536 | 1536 | <?php |
1537 | 1537 | if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) { |
1538 | - if(is_array($richtexteditorIds)) { |
|
1539 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1540 | - // invoke OnRichTextEditorInit event |
|
1541 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1542 | - 'editor' => $editor, |
|
1543 | - 'elements' => $elements, |
|
1544 | - 'options' => $richtexteditorOptions[$editor] |
|
1545 | - )); |
|
1546 | - if(is_array($evtOut)) { |
|
1547 | - echo implode('', $evtOut); |
|
1548 | - } |
|
1549 | - } |
|
1550 | - } |
|
1538 | + if(is_array($richtexteditorIds)) { |
|
1539 | + foreach($richtexteditorIds as $editor => $elements) { |
|
1540 | + // invoke OnRichTextEditorInit event |
|
1541 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1542 | + 'editor' => $editor, |
|
1543 | + 'elements' => $elements, |
|
1544 | + 'options' => $richtexteditorOptions[$editor] |
|
1545 | + )); |
|
1546 | + if(is_array($evtOut)) { |
|
1547 | + echo implode('', $evtOut); |
|
1548 | + } |
|
1549 | + } |
|
1550 | + } |
|
1551 | 1551 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 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('settings')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | $data = $_POST; |
9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
@@ -11,41 +11,41 @@ discard block |
||
11 | 11 | |
12 | 12 | if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
13 | 13 | { |
14 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
17 | - if(is_file($htaccess)) |
|
18 | - { |
|
19 | - $_ = file_get_contents($htaccess); |
|
20 | - if(strpos($_,'RewriteBase')===false) |
|
21 | - { |
|
22 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
23 | - } |
|
24 | - elseif(is_writable($htaccess)) |
|
25 | - { |
|
26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | - if(!@file_put_contents($htaccess,$_)) |
|
28 | - { |
|
29 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
30 | - } |
|
31 | - } |
|
32 | - } |
|
33 | - elseif(is_file($sample_htaccess)) |
|
34 | - { |
|
35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
14 | + $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
15 | + $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | + $dir = '/' . trim($modx->config['base_url'],'/'); |
|
17 | + if(is_file($htaccess)) |
|
18 | + { |
|
19 | + $_ = file_get_contents($htaccess); |
|
20 | + if(strpos($_,'RewriteBase')===false) |
|
36 | 21 | { |
37 | - $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
38 | - } |
|
39 | - elseif($modx->config['base_url']!=='/') |
|
40 | - { |
|
41 | - $_ = file_get_contents($htaccess); |
|
42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | - if(!@file_put_contents($htaccess,$_)) |
|
44 | - { |
|
45 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
46 | - } |
|
47 | - } |
|
48 | - } |
|
22 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
23 | + } |
|
24 | + elseif(is_writable($htaccess)) |
|
25 | + { |
|
26 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | + if(!@file_put_contents($htaccess,$_)) |
|
28 | + { |
|
29 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
30 | + } |
|
31 | + } |
|
32 | + } |
|
33 | + elseif(is_file($sample_htaccess)) |
|
34 | + { |
|
35 | + if(!@rename($sample_htaccess,$htaccess)) |
|
36 | + { |
|
37 | + $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
38 | + } |
|
39 | + elseif($modx->config['base_url']!=='/') |
|
40 | + { |
|
41 | + $_ = file_get_contents($htaccess); |
|
42 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | + if(!@file_put_contents($htaccess,$_)) |
|
44 | + { |
|
45 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
46 | + } |
|
47 | + } |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
@@ -56,19 +56,19 @@ discard block |
||
56 | 56 | $data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
57 | 57 | |
58 | 58 | if (isset($data) && count($data) > 0) { |
59 | - if(isset($data['manager_language'])) { |
|
60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | - if(is_file($lang_path)) { |
|
62 | - include($lang_path); |
|
59 | + if(isset($data['manager_language'])) { |
|
60 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | + if(is_file($lang_path)) { |
|
62 | + include($lang_path); |
|
63 | 63 | global $modx_lang_attribute; |
64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
65 | - } |
|
66 | - } |
|
67 | - $savethese = array(); |
|
68 | - $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
|
69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | - foreach ($data as $k => $v) { |
|
71 | - switch ($k) { |
|
65 | + } |
|
66 | + } |
|
67 | + $savethese = array(); |
|
68 | + $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
|
69 | + $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | + foreach ($data as $k => $v) { |
|
71 | + switch ($k) { |
|
72 | 72 | case 'settings_version':{ |
73 | 73 | if($modx->getVersionData('version')!=$data['settings_version']){ |
74 | 74 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -76,24 +76,24 @@ discard block |
||
76 | 76 | } |
77 | 77 | break; |
78 | 78 | } |
79 | - case 'error_page': |
|
80 | - case 'unauthorized_page': |
|
81 | - if (trim($v) == '' || !is_numeric($v)) { |
|
82 | - $v = $data['site_start']; |
|
83 | - } |
|
84 | - break; |
|
79 | + case 'error_page': |
|
80 | + case 'unauthorized_page': |
|
81 | + if (trim($v) == '' || !is_numeric($v)) { |
|
82 | + $v = $data['site_start']; |
|
83 | + } |
|
84 | + break; |
|
85 | 85 | |
86 | - case 'lst_custom_contenttype': |
|
87 | - case 'txt_custom_contenttype': |
|
88 | - // Skip these |
|
89 | - $k = ''; |
|
90 | - break; |
|
91 | - case 'rb_base_dir': |
|
92 | - case 'rb_base_url': |
|
93 | - case 'filemanager_path': |
|
94 | - $v = trim($v); |
|
95 | - $v = rtrim($v,'/') . '/'; |
|
96 | - break; |
|
86 | + case 'lst_custom_contenttype': |
|
87 | + case 'txt_custom_contenttype': |
|
88 | + // Skip these |
|
89 | + $k = ''; |
|
90 | + break; |
|
91 | + case 'rb_base_dir': |
|
92 | + case 'rb_base_url': |
|
93 | + case 'filemanager_path': |
|
94 | + $v = trim($v); |
|
95 | + $v = rtrim($v,'/') . '/'; |
|
96 | + break; |
|
97 | 97 | case 'manager_language': |
98 | 98 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
99 | 99 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -101,56 +101,56 @@ discard block |
||
101 | 101 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
102 | 102 | $v = 'english'; |
103 | 103 | } |
104 | - break; |
|
105 | - case 'smtppw': |
|
106 | - if ($v !== '********************' && $v !== '') { |
|
107 | - $v = trim($v); |
|
108 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
109 | - $v = str_replace('=','%',$v); |
|
110 | - } elseif ($v === '********************') { |
|
111 | - $k = ''; |
|
112 | - } |
|
113 | - break; |
|
104 | + break; |
|
105 | + case 'smtppw': |
|
106 | + if ($v !== '********************' && $v !== '') { |
|
107 | + $v = trim($v); |
|
108 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
109 | + $v = str_replace('=','%',$v); |
|
110 | + } elseif ($v === '********************') { |
|
111 | + $k = ''; |
|
112 | + } |
|
113 | + break; |
|
114 | 114 | case 'valid_hostnames': |
115 | - $v = str_replace(array(' ,', ', '), ',', $v); |
|
116 | - if ($v !== ',') { |
|
117 | - $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
118 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
119 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
120 | - } |
|
121 | - $k = ''; |
|
122 | - break; |
|
123 | - case 'session_timeout': |
|
124 | - $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
125 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
126 | - break; |
|
127 | - default: |
|
128 | - break; |
|
129 | - } |
|
130 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
115 | + $v = str_replace(array(' ,', ', '), ',', $v); |
|
116 | + if ($v !== ',') { |
|
117 | + $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
118 | + $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
119 | + @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
120 | + } |
|
121 | + $k = ''; |
|
122 | + break; |
|
123 | + case 'session_timeout': |
|
124 | + $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
125 | + $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
126 | + break; |
|
127 | + default: |
|
128 | + break; |
|
129 | + } |
|
130 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
131 | 131 | |
132 | - $modx->config[$k] = $v; |
|
132 | + $modx->config[$k] = $v; |
|
133 | 133 | |
134 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
135 | - } |
|
134 | + if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
135 | + } |
|
136 | 136 | |
137 | - // Run a single query to save all the values |
|
138 | - $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
137 | + // Run a single query to save all the values |
|
138 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
139 | 139 | VALUES ".implode(', ', $savethese); |
140 | - $modx->getDatabase()->query($sql); |
|
140 | + $modx->getDatabase()->query($sql); |
|
141 | 141 | |
142 | - // Reset Template Pages |
|
143 | - if (isset($data['reset_template'])) { |
|
144 | - $newtemplate = (int)$data['default_template']; |
|
145 | - $oldtemplate = (int)$data['old_template']; |
|
146 | - $tbl = $modx->getFullTableName('site_content'); |
|
147 | - $reset = $data['reset_template']; |
|
148 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
149 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
150 | - } |
|
142 | + // Reset Template Pages |
|
143 | + if (isset($data['reset_template'])) { |
|
144 | + $newtemplate = (int)$data['default_template']; |
|
145 | + $oldtemplate = (int)$data['old_template']; |
|
146 | + $tbl = $modx->getFullTableName('site_content'); |
|
147 | + $reset = $data['reset_template']; |
|
148 | + if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
149 | + else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
150 | + } |
|
151 | 151 | |
152 | - // empty cache |
|
153 | - $modx->clearCache('full'); |
|
152 | + // empty cache |
|
153 | + $modx->clearCache('full'); |
|
154 | 154 | } |
155 | 155 | $header="Location: index.php?a=7&r=10"; |
156 | 156 | header($header); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 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."); |
|
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 | |
6 | 6 | // invoke OnManagerTreeInit event |
7 | 7 | $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST); |
8 | 8 | if(is_array($evtOut)) { |
9 | - echo implode("\n", $evtOut); |
|
9 | + echo implode("\n", $evtOut); |
|
10 | 10 | } |
11 | 11 | ?> |
12 | 12 | |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | |
53 | 53 | <div id="treeHolder"> |
54 | 54 | <?php |
55 | - // invoke OnManagerTreePrerender event |
|
56 | - $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST)); |
|
57 | - if(is_array($evtOut)) { |
|
58 | - echo implode("\n", $evtOut); |
|
59 | - } |
|
60 | - ?> |
|
55 | + // invoke OnManagerTreePrerender event |
|
56 | + $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST)); |
|
57 | + if(is_array($evtOut)) { |
|
58 | + echo implode("\n", $evtOut); |
|
59 | + } |
|
60 | + ?> |
|
61 | 61 | <div id="node0" class="rootNode"><a class="node" onclick="modx.tree.treeAction(event, 0)" data-id="0" data-title-esc="<?php $site_name = $modx->getPhpCompat()->entities($site_name); |
62 | - echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a> |
|
62 | + echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a> |
|
63 | 63 | <div id="treeloader"><i class="fa fa-cog fa-spin fa-3x fa-fw"></i></div> |
64 | 64 | </div> |
65 | 65 | <div id="treeRoot"></div> |
66 | 66 | <?php |
67 | - // invoke OnManagerTreeRender event |
|
68 | - $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST)); |
|
69 | - if(is_array($evtOut)) { |
|
70 | - echo implode("\n", $evtOut); |
|
71 | - } |
|
72 | - ?> |
|
67 | + // invoke OnManagerTreeRender event |
|
68 | + $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST)); |
|
69 | + if(is_array($evtOut)) { |
|
70 | + echo implode("\n", $evtOut); |
|
71 | + } |
|
72 | + ?> |
|
73 | 73 | </div> |
74 | 74 | </div> |