@@ -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,30 +12,30 @@ discard block |
||
12 | 12 | |
13 | 13 | // check permissions |
14 | 14 | switch($modx->manager->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 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
28 | - $udperms = new udperms(); |
|
29 | - $udperms->user = $modx->getLoginUserID(); |
|
30 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
31 | - $udperms->role = $_SESSION['mgrRole']; |
|
32 | - if(!$udperms->checkPermissions()) { |
|
33 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | - } |
|
35 | - } |
|
36 | - break; |
|
37 | - default: |
|
38 | - $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 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
28 | + $udperms = new udperms(); |
|
29 | + $udperms->user = $modx->getLoginUserID(); |
|
30 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
31 | + $udperms->role = $_SESSION['mgrRole']; |
|
32 | + if(!$udperms->checkPermissions()) { |
|
33 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | + } |
|
35 | + } |
|
36 | + break; |
|
37 | + default: |
|
38 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -54,22 +54,22 @@ discard block |
||
54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
55 | 55 | |
56 | 56 | if($modx->manager->action == 27) { |
57 | - //editing an existing document |
|
58 | - // check permissions on the document |
|
59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
60 | - $udperms = new udperms(); |
|
61 | - $udperms->user = $modx->getLoginUserID(); |
|
62 | - $udperms->document = $id; |
|
63 | - $udperms->role = $_SESSION['mgrRole']; |
|
64 | - |
|
65 | - if(!$udperms->checkPermissions()) { |
|
66 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
67 | - } |
|
57 | + //editing an existing document |
|
58 | + // check permissions on the document |
|
59 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
60 | + $udperms = new udperms(); |
|
61 | + $udperms->user = $modx->getLoginUserID(); |
|
62 | + $udperms->document = $id; |
|
63 | + $udperms->role = $_SESSION['mgrRole']; |
|
64 | + |
|
65 | + if(!$udperms->checkPermissions()) { |
|
66 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // check to see if resource isn't locked |
71 | 71 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
72 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
72 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
73 | 73 | } |
74 | 74 | // end check for lock |
75 | 75 | |
@@ -78,74 +78,74 @@ discard block |
||
78 | 78 | |
79 | 79 | // get document groups for current user |
80 | 80 | if($_SESSION['mgrDocgroups']) { |
81 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
81 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if(!empty ($id)) { |
85 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
86 | - if($docgrp) { |
|
87 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
88 | - } |
|
89 | - $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
90 | - $content = array(); |
|
91 | - $content = $modx->db->getRow($rs); |
|
92 | - $modx->documentObject = &$content; |
|
93 | - if(!$content) { |
|
94 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
95 | - } |
|
96 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
85 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
86 | + if($docgrp) { |
|
87 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
88 | + } |
|
89 | + $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
90 | + $content = array(); |
|
91 | + $content = $modx->db->getRow($rs); |
|
92 | + $modx->documentObject = &$content; |
|
93 | + if(!$content) { |
|
94 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
95 | + } |
|
96 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
97 | 97 | } else { |
98 | - $content = array(); |
|
98 | + $content = array(); |
|
99 | 99 | |
100 | - if(isset($_REQUEST['newtemplate'])) { |
|
101 | - $content['template'] = $_REQUEST['newtemplate']; |
|
102 | - } else { |
|
103 | - $content['template'] = getDefaultTemplate(); |
|
104 | - } |
|
100 | + if(isset($_REQUEST['newtemplate'])) { |
|
101 | + $content['template'] = $_REQUEST['newtemplate']; |
|
102 | + } else { |
|
103 | + $content['template'] = getDefaultTemplate(); |
|
104 | + } |
|
105 | 105 | |
106 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
106 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // restore saved form |
110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
111 | 111 | if(isset($_REQUEST['newtemplate'])) { |
112 | - $formRestored = true; |
|
112 | + $formRestored = true; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // retain form values if template was changed |
116 | 116 | // edited to convert pub_date and unpub_date |
117 | 117 | // sottwell 02-09-2006 |
118 | 118 | if($formRestored == true) { |
119 | - $content = array_merge($content, $_POST); |
|
120 | - $content['content'] = $_POST['ta']; |
|
121 | - if(empty ($content['pub_date'])) { |
|
122 | - unset ($content['pub_date']); |
|
123 | - } else { |
|
124 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
125 | - } |
|
126 | - if(empty ($content['unpub_date'])) { |
|
127 | - unset ($content['unpub_date']); |
|
128 | - } else { |
|
129 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
130 | - } |
|
119 | + $content = array_merge($content, $_POST); |
|
120 | + $content['content'] = $_POST['ta']; |
|
121 | + if(empty ($content['pub_date'])) { |
|
122 | + unset ($content['pub_date']); |
|
123 | + } else { |
|
124 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
125 | + } |
|
126 | + if(empty ($content['unpub_date'])) { |
|
127 | + unset ($content['unpub_date']); |
|
128 | + } else { |
|
129 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
130 | + } |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | // increase menu index if this is a new document |
134 | 134 | if(!isset ($_REQUEST['id'])) { |
135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
136 | - $modx->config['auto_menuindex'] = 1; |
|
137 | - } |
|
138 | - if($modx->config['auto_menuindex']) { |
|
139 | - $pid = (int)$_REQUEST['pid']; |
|
140 | - $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
141 | - $content['menuindex'] = $modx->db->getValue($rs); |
|
142 | - } else { |
|
143 | - $content['menuindex'] = 0; |
|
144 | - } |
|
135 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
136 | + $modx->config['auto_menuindex'] = 1; |
|
137 | + } |
|
138 | + if($modx->config['auto_menuindex']) { |
|
139 | + $pid = (int)$_REQUEST['pid']; |
|
140 | + $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
141 | + $content['menuindex'] = $modx->db->getValue($rs); |
|
142 | + } else { |
|
143 | + $content['menuindex'] = 0; |
|
144 | + } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | if(isset ($_POST['which_editor'])) { |
148 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
148 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Add lock-element JS-Script |
@@ -545,23 +545,23 @@ discard block |
||
545 | 545 | |
546 | 546 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
547 | 547 | <?php |
548 | - // invoke OnDocFormPrerender event |
|
549 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
550 | - 'id' => $id, |
|
551 | - 'template' => $content['template'] |
|
552 | - )); |
|
553 | - |
|
554 | - if(is_array($evtOut)) { |
|
555 | - echo implode('', $evtOut); |
|
556 | - } |
|
557 | - |
|
558 | - /*************************/ |
|
559 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
560 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
561 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
562 | - /*************************/ |
|
563 | - |
|
564 | - ?> |
|
548 | + // invoke OnDocFormPrerender event |
|
549 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
550 | + 'id' => $id, |
|
551 | + 'template' => $content['template'] |
|
552 | + )); |
|
553 | + |
|
554 | + if(is_array($evtOut)) { |
|
555 | + echo implode('', $evtOut); |
|
556 | + } |
|
557 | + |
|
558 | + /*************************/ |
|
559 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
560 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
561 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
562 | + /*************************/ |
|
563 | + |
|
564 | + ?> |
|
565 | 565 | <input type="hidden" name="a" value="5" /> |
566 | 566 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
567 | 567 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>" /> |
@@ -576,54 +576,54 @@ discard block |
||
576 | 576 | |
577 | 577 | <h1> |
578 | 578 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
580 | - } else { |
|
581 | - if ($modx->manager->action == '4') { |
|
579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
580 | + } else { |
|
581 | + if ($modx->manager->action == '4') { |
|
582 | 582 | echo $_lang['add_resource']; |
583 | 583 | } else if ($modx->manager->action == '72') { |
584 | 584 | echo $_lang['add_weblink']; |
585 | 585 | } else { |
586 | 586 | echo $_lang['create_resource_title']; |
587 | 587 | } |
588 | - } ?> |
|
588 | + } ?> |
|
589 | 589 | </h1> |
590 | 590 | |
591 | 591 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
592 | 592 | |
593 | 593 | <?php |
594 | - // breadcrumbs |
|
595 | - if($modx->config['use_breadcrumbs']) { |
|
596 | - $temp = array(); |
|
597 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
598 | - |
|
599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | - $bID = (int) $_REQUEST['id']; |
|
601 | - $temp = $modx->getParentIds($bID); |
|
602 | - } else if(isset($_REQUEST['pid'])) { |
|
603 | - $bID = (int) $_REQUEST['pid']; |
|
604 | - $temp = $modx->getParentIds($bID); |
|
605 | - array_unshift($temp, $bID); |
|
606 | - } |
|
607 | - |
|
608 | - if($temp) { |
|
609 | - $parents = implode(',', $temp); |
|
610 | - |
|
611 | - if(!empty($parents)) { |
|
612 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
613 | - $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
614 | - while($row = $modx->db->getRow($rs)) { |
|
615 | - $out .= '<li class="breadcrumbs__li"> |
|
594 | + // breadcrumbs |
|
595 | + if($modx->config['use_breadcrumbs']) { |
|
596 | + $temp = array(); |
|
597 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
598 | + |
|
599 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | + $bID = (int) $_REQUEST['id']; |
|
601 | + $temp = $modx->getParentIds($bID); |
|
602 | + } else if(isset($_REQUEST['pid'])) { |
|
603 | + $bID = (int) $_REQUEST['pid']; |
|
604 | + $temp = $modx->getParentIds($bID); |
|
605 | + array_unshift($temp, $bID); |
|
606 | + } |
|
607 | + |
|
608 | + if($temp) { |
|
609 | + $parents = implode(',', $temp); |
|
610 | + |
|
611 | + if(!empty($parents)) { |
|
612 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
613 | + $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
614 | + while($row = $modx->db->getRow($rs)) { |
|
615 | + $out .= '<li class="breadcrumbs__li"> |
|
616 | 616 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
617 | 617 | <span class="breadcrumbs__sep">></span> |
618 | 618 | </li>'; |
619 | - } |
|
620 | - } |
|
621 | - } |
|
619 | + } |
|
620 | + } |
|
621 | + } |
|
622 | 622 | |
623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
625 | - } |
|
626 | - ?> |
|
623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
625 | + } |
|
626 | + ?> |
|
627 | 627 | |
628 | 628 | <!-- start main wrapper --> |
629 | 629 | <div class="sectionBody"> |
@@ -635,13 +635,13 @@ discard block |
||
635 | 635 | |
636 | 636 | <!-- General --> |
637 | 637 | <?php |
638 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
639 | - 'id' => $id |
|
640 | - )); |
|
641 | - if(is_array($evtOut)) { |
|
642 | - echo implode('', $evtOut); |
|
643 | - } else { |
|
644 | - ?> |
|
638 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
639 | + 'id' => $id |
|
640 | + )); |
|
641 | + if(is_array($evtOut)) { |
|
642 | + echo implode('', $evtOut); |
|
643 | + } else { |
|
644 | + ?> |
|
645 | 645 | <div class="tab-page" id="tabGeneral"> |
646 | 646 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
647 | 647 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -726,36 +726,36 @@ discard block |
||
726 | 726 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
727 | 727 | <option value="0">(blank)</option> |
728 | 728 | <?php |
729 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
730 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
731 | - $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
732 | - $currentCategory = ''; |
|
733 | - while($row = $modx->db->getRow($rs)) { |
|
734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | - continue; |
|
736 | - }; |
|
737 | - // Skip if not selectable but show if selected! |
|
738 | - $thisCategory = $row['category']; |
|
739 | - if($thisCategory == null) { |
|
740 | - $thisCategory = $_lang["no_category"]; |
|
741 | - } |
|
742 | - if($thisCategory != $currentCategory) { |
|
743 | - if($closeOptGroup) { |
|
744 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
745 | - } |
|
746 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
747 | - $closeOptGroup = true; |
|
748 | - } |
|
729 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
730 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
731 | + $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
732 | + $currentCategory = ''; |
|
733 | + while($row = $modx->db->getRow($rs)) { |
|
734 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | + continue; |
|
736 | + }; |
|
737 | + // Skip if not selectable but show if selected! |
|
738 | + $thisCategory = $row['category']; |
|
739 | + if($thisCategory == null) { |
|
740 | + $thisCategory = $_lang["no_category"]; |
|
741 | + } |
|
742 | + if($thisCategory != $currentCategory) { |
|
743 | + if($closeOptGroup) { |
|
744 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
745 | + } |
|
746 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
747 | + $closeOptGroup = true; |
|
748 | + } |
|
749 | 749 | |
750 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
750 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
751 | 751 | |
752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
753 | - $currentCategory = $thisCategory; |
|
754 | - } |
|
755 | - if($thisCategory != '') { |
|
756 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
757 | - } |
|
758 | - ?> |
|
752 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
753 | + $currentCategory = $thisCategory; |
|
754 | + } |
|
755 | + if($thisCategory != '') { |
|
756 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
757 | + } |
|
758 | + ?> |
|
759 | 759 | </select> |
760 | 760 | </td> |
761 | 761 | </tr> |
@@ -795,37 +795,37 @@ discard block |
||
795 | 795 | </td> |
796 | 796 | <td valign="top"> |
797 | 797 | <?php |
798 | - $parentlookup = false; |
|
799 | - if(isset ($_REQUEST['id'])) { |
|
800 | - if($content['parent'] == 0) { |
|
801 | - $parentname = $site_name; |
|
802 | - } else { |
|
803 | - $parentlookup = $content['parent']; |
|
804 | - } |
|
805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
806 | - if($_REQUEST['pid'] == 0) { |
|
807 | - $parentname = $site_name; |
|
808 | - } else { |
|
809 | - $parentlookup = $_REQUEST['pid']; |
|
810 | - } |
|
811 | - } elseif(isset($_POST['parent'])) { |
|
812 | - if($_POST['parent'] == 0) { |
|
813 | - $parentname = $site_name; |
|
814 | - } else { |
|
815 | - $parentlookup = $_POST['parent']; |
|
816 | - } |
|
817 | - } else { |
|
818 | - $parentname = $site_name; |
|
819 | - $content['parent'] = 0; |
|
820 | - } |
|
821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | - $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
823 | - $parentname = $modx->db->getValue($rs); |
|
824 | - if(!$parentname) { |
|
825 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
826 | - } |
|
827 | - } |
|
828 | - ?> |
|
798 | + $parentlookup = false; |
|
799 | + if(isset ($_REQUEST['id'])) { |
|
800 | + if($content['parent'] == 0) { |
|
801 | + $parentname = $site_name; |
|
802 | + } else { |
|
803 | + $parentlookup = $content['parent']; |
|
804 | + } |
|
805 | + } elseif(isset ($_REQUEST['pid'])) { |
|
806 | + if($_REQUEST['pid'] == 0) { |
|
807 | + $parentname = $site_name; |
|
808 | + } else { |
|
809 | + $parentlookup = $_REQUEST['pid']; |
|
810 | + } |
|
811 | + } elseif(isset($_POST['parent'])) { |
|
812 | + if($_POST['parent'] == 0) { |
|
813 | + $parentname = $site_name; |
|
814 | + } else { |
|
815 | + $parentlookup = $_POST['parent']; |
|
816 | + } |
|
817 | + } else { |
|
818 | + $parentname = $site_name; |
|
819 | + $content['parent'] = 0; |
|
820 | + } |
|
821 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | + $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
823 | + $parentname = $modx->db->getValue($rs); |
|
824 | + if(!$parentname) { |
|
825 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
826 | + } |
|
827 | + } |
|
828 | + ?> |
|
829 | 829 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
830 | 830 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b> |
831 | 831 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | </tr> |
834 | 834 | <tr></tr> |
835 | 835 | <?php |
836 | - /* |
|
836 | + /* |
|
837 | 837 | if($content['type'] == 'reference' || $modx->manager->action == '72') { |
838 | 838 | ?> |
839 | 839 | <tr> |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | </tr> |
862 | 862 | <?php |
863 | 863 | }*/ |
864 | - ?> |
|
864 | + ?> |
|
865 | 865 | |
866 | 866 | <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
867 | 867 | <tr> |
@@ -874,36 +874,36 @@ discard block |
||
874 | 874 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
875 | 875 | <option value="none"><?= $_lang['none'] ?></option> |
876 | 876 | <?php |
877 | - // invoke OnRichTextEditorRegister event |
|
878 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
879 | - if(is_array($evtOut)) { |
|
880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
881 | - $editor = $evtOut[$i]; |
|
882 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
883 | - } |
|
884 | - } |
|
885 | - ?> |
|
877 | + // invoke OnRichTextEditorRegister event |
|
878 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
879 | + if(is_array($evtOut)) { |
|
880 | + for($i = 0; $i < count($evtOut); $i++) { |
|
881 | + $editor = $evtOut[$i]; |
|
882 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
883 | + } |
|
884 | + } |
|
885 | + ?> |
|
886 | 886 | </select> |
887 | 887 | </label> |
888 | 888 | </div> |
889 | 889 | <div id="content_body"> |
890 | 890 | <?php |
891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | - $htmlContent = $content['content']; |
|
893 | - ?> |
|
891 | + if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | + $htmlContent = $content['content']; |
|
893 | + ?> |
|
894 | 894 | <div class="section-editor clearfix"> |
895 | 895 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->htmlspecialchars($htmlContent) ?></textarea> |
896 | 896 | </div> |
897 | 897 | <?php |
898 | - // Richtext-[*content*] |
|
899 | - $richtexteditorIds = array(); |
|
900 | - $richtexteditorOptions = array(); |
|
901 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
902 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
903 | - } else { |
|
904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
905 | - } |
|
906 | - ?> |
|
898 | + // Richtext-[*content*] |
|
899 | + $richtexteditorIds = array(); |
|
900 | + $richtexteditorOptions = array(); |
|
901 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
902 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
903 | + } else { |
|
904 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
905 | + } |
|
906 | + ?> |
|
907 | 907 | </div> |
908 | 908 | </td> |
909 | 909 | </tr> |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | $sort = 'cat.rank,cat.id,' . $sort; |
952 | 952 | } |
953 | 953 | $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs); |
954 | - $evtOut = $modx->invokeEvent('OnDocTVPrerender', array('id' => $id, 'template' => $template)); |
|
954 | + $evtOut = $modx->invokeEvent('OnDocTVPrerender', array('id' => $id, 'template' => $template)); |
|
955 | 955 | if ($evtOut && is_array($evtOut)) { |
956 | 956 | $where .= implode(' ', $evtOut); |
957 | 957 | } |
@@ -1194,8 +1194,8 @@ discard block |
||
1194 | 1194 | |
1195 | 1195 | <?php |
1196 | 1196 | |
1197 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1198 | - ?> |
|
1197 | + if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1198 | + ?> |
|
1199 | 1199 | <tr> |
1200 | 1200 | <td> |
1201 | 1201 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1217,15 +1217,15 @@ discard block |
||
1217 | 1217 | <td> |
1218 | 1218 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1219 | 1219 | <?php |
1220 | - if(!$content['contentType']) { |
|
1221 | - $content['contentType'] = 'text/html'; |
|
1222 | - } |
|
1223 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1224 | - $ct = explode(",", $custom_contenttype); |
|
1225 | - for($i = 0; $i < count($ct); $i++) { |
|
1226 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1227 | - } |
|
1228 | - ?> |
|
1220 | + if(!$content['contentType']) { |
|
1221 | + $content['contentType'] = 'text/html'; |
|
1222 | + } |
|
1223 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1224 | + $ct = explode(",", $custom_contenttype); |
|
1225 | + for($i = 0; $i < count($ct); $i++) { |
|
1226 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1227 | + } |
|
1228 | + ?> |
|
1229 | 1229 | </select> |
1230 | 1230 | </td> |
1231 | 1231 | </tr> |
@@ -1248,23 +1248,23 @@ discard block |
||
1248 | 1248 | </td> |
1249 | 1249 | </tr> |
1250 | 1250 | <?php |
1251 | - } else { |
|
1252 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1253 | - // non-admin managers creating or editing a document resource |
|
1254 | - ?> |
|
1251 | + } else { |
|
1252 | + if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1253 | + // non-admin managers creating or editing a document resource |
|
1254 | + ?> |
|
1255 | 1255 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
1256 | 1256 | <input type="hidden" name="type" value="document" /> |
1257 | 1257 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
1258 | 1258 | <?php |
1259 | - } else { |
|
1260 | - // non-admin managers creating or editing a reference (weblink) resource |
|
1261 | - ?> |
|
1259 | + } else { |
|
1260 | + // non-admin managers creating or editing a reference (weblink) resource |
|
1261 | + ?> |
|
1262 | 1262 | <input type="hidden" name="type" value="reference" /> |
1263 | 1263 | <input type="hidden" name="contentType" value="text/html" /> |
1264 | 1264 | <?php |
1265 | - } |
|
1266 | - }//if mgrRole |
|
1267 | - ?> |
|
1265 | + } |
|
1266 | + }//if mgrRole |
|
1267 | + ?> |
|
1268 | 1268 | |
1269 | 1269 | <tr> |
1270 | 1270 | <td> |
@@ -1347,112 +1347,112 @@ discard block |
||
1347 | 1347 | ?> |
1348 | 1348 | |
1349 | 1349 | <?php |
1350 | - /******************************* |
|
1350 | + /******************************* |
|
1351 | 1351 | * Document Access Permissions */ |
1352 | - if($use_udperms == 1) { |
|
1353 | - $groupsarray = array(); |
|
1354 | - $sql = ''; |
|
1355 | - |
|
1356 | - $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1357 | - if($documentId > 0) { |
|
1358 | - // Load up, the permissions from the parent (if new document) or existing document |
|
1359 | - $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1360 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1361 | - |
|
1362 | - // Load up the current permissions and names |
|
1363 | - $vs = array( |
|
1364 | - $tbl_document_group_names, |
|
1365 | - $tbl_document_groups, |
|
1366 | - $documentId |
|
1367 | - ); |
|
1368 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1369 | - $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1370 | - } else { |
|
1371 | - // Just load up the names, we're starting clean |
|
1372 | - $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1373 | - } |
|
1374 | - |
|
1375 | - // retain selected doc groups between post |
|
1376 | - if(isset($_POST['docgroups'])) { |
|
1377 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1378 | - } |
|
1352 | + if($use_udperms == 1) { |
|
1353 | + $groupsarray = array(); |
|
1354 | + $sql = ''; |
|
1355 | + |
|
1356 | + $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1357 | + if($documentId > 0) { |
|
1358 | + // Load up, the permissions from the parent (if new document) or existing document |
|
1359 | + $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1360 | + while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1361 | + |
|
1362 | + // Load up the current permissions and names |
|
1363 | + $vs = array( |
|
1364 | + $tbl_document_group_names, |
|
1365 | + $tbl_document_groups, |
|
1366 | + $documentId |
|
1367 | + ); |
|
1368 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1369 | + $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1370 | + } else { |
|
1371 | + // Just load up the names, we're starting clean |
|
1372 | + $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1373 | + } |
|
1374 | + |
|
1375 | + // retain selected doc groups between post |
|
1376 | + if(isset($_POST['docgroups'])) { |
|
1377 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1378 | + } |
|
1379 | + |
|
1380 | + $isManager = $modx->hasPermission('access_permissions'); |
|
1381 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1382 | + |
|
1383 | + // Setup Basic attributes for each Input box |
|
1384 | + $inputAttributes = array( |
|
1385 | + 'type' => 'checkbox', |
|
1386 | + 'class' => 'checkbox', |
|
1387 | + 'name' => 'docgroups[]', |
|
1388 | + 'onclick' => 'makePublic(false);', |
|
1389 | + ); |
|
1390 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1391 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
1392 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1393 | + |
|
1394 | + // Loop through the permissions list |
|
1395 | + while($row = $modx->db->getRow($rs)) { |
|
1396 | + |
|
1397 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
1398 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1399 | + $inputId = 'group-' . $row['id']; |
|
1400 | + |
|
1401 | + $checked = in_array($inputValue, $groupsarray); |
|
1402 | + if($checked) { |
|
1403 | + $notPublic = true; |
|
1404 | + } // Mark as private access (either web or manager) |
|
1405 | + |
|
1406 | + // Skip the access permission if the user doesn't have access... |
|
1407 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1408 | + continue; |
|
1409 | + } |
|
1379 | 1410 | |
1380 | - $isManager = $modx->hasPermission('access_permissions'); |
|
1381 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1382 | - |
|
1383 | - // Setup Basic attributes for each Input box |
|
1384 | - $inputAttributes = array( |
|
1385 | - 'type' => 'checkbox', |
|
1386 | - 'class' => 'checkbox', |
|
1387 | - 'name' => 'docgroups[]', |
|
1388 | - 'onclick' => 'makePublic(false);', |
|
1389 | - ); |
|
1390 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1391 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
1392 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1393 | - |
|
1394 | - // Loop through the permissions list |
|
1395 | - while($row = $modx->db->getRow($rs)) { |
|
1396 | - |
|
1397 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
1398 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1399 | - $inputId = 'group-' . $row['id']; |
|
1400 | - |
|
1401 | - $checked = in_array($inputValue, $groupsarray); |
|
1402 | - if($checked) { |
|
1403 | - $notPublic = true; |
|
1404 | - } // Mark as private access (either web or manager) |
|
1405 | - |
|
1406 | - // Skip the access permission if the user doesn't have access... |
|
1407 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1408 | - continue; |
|
1409 | - } |
|
1410 | - |
|
1411 | - // Setup attributes for this Input box |
|
1412 | - $inputAttributes['id'] = $inputId; |
|
1413 | - $inputAttributes['value'] = $inputValue; |
|
1414 | - if($checked) { |
|
1415 | - $inputAttributes['checked'] = 'checked'; |
|
1416 | - } else { |
|
1417 | - unset($inputAttributes['checked']); |
|
1418 | - } |
|
1419 | - |
|
1420 | - // Create attribute string list |
|
1421 | - $inputString = array(); |
|
1422 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1423 | - |
|
1424 | - // Make the <input> HTML |
|
1425 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1426 | - |
|
1427 | - // does user have this permission? |
|
1428 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1429 | - $vs = array( |
|
1430 | - $row['id'], |
|
1431 | - $_SESSION['mgrInternalKey'] |
|
1432 | - ); |
|
1433 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1434 | - $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
1435 | - $count = $modx->db->getValue($rsp); |
|
1436 | - if($count > 0) { |
|
1437 | - ++$permissions_yes; |
|
1438 | - } else { |
|
1439 | - ++$permissions_no; |
|
1440 | - } |
|
1441 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1442 | - } |
|
1443 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1444 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1445 | - $permissions = array(); |
|
1446 | - } |
|
1411 | + // Setup attributes for this Input box |
|
1412 | + $inputAttributes['id'] = $inputId; |
|
1413 | + $inputAttributes['value'] = $inputValue; |
|
1414 | + if($checked) { |
|
1415 | + $inputAttributes['checked'] = 'checked'; |
|
1416 | + } else { |
|
1417 | + unset($inputAttributes['checked']); |
|
1418 | + } |
|
1447 | 1419 | |
1448 | - // See if the Access Permissions section is worth displaying... |
|
1449 | - if(!empty($permissions)) { |
|
1450 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
1451 | - if($isManager && $isWeb) { |
|
1452 | - 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>'); |
|
1453 | - } |
|
1454 | - // Output the permissions list... |
|
1455 | - ?> |
|
1420 | + // Create attribute string list |
|
1421 | + $inputString = array(); |
|
1422 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1423 | + |
|
1424 | + // Make the <input> HTML |
|
1425 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1426 | + |
|
1427 | + // does user have this permission? |
|
1428 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1429 | + $vs = array( |
|
1430 | + $row['id'], |
|
1431 | + $_SESSION['mgrInternalKey'] |
|
1432 | + ); |
|
1433 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1434 | + $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
1435 | + $count = $modx->db->getValue($rsp); |
|
1436 | + if($count > 0) { |
|
1437 | + ++$permissions_yes; |
|
1438 | + } else { |
|
1439 | + ++$permissions_no; |
|
1440 | + } |
|
1441 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1442 | + } |
|
1443 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1444 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1445 | + $permissions = array(); |
|
1446 | + } |
|
1447 | + |
|
1448 | + // See if the Access Permissions section is worth displaying... |
|
1449 | + if(!empty($permissions)) { |
|
1450 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
1451 | + if($isManager && $isWeb) { |
|
1452 | + 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>'); |
|
1453 | + } |
|
1454 | + // Output the permissions list... |
|
1455 | + ?> |
|
1456 | 1456 | <!-- Access Permissions --> |
1457 | 1457 | <div class="tab-page" id="tabAccess"> |
1458 | 1458 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1486,31 +1486,31 @@ discard block |
||
1486 | 1486 | </ul> |
1487 | 1487 | </div><!--div class="tab-page" id="tabAccess"--> |
1488 | 1488 | <?php |
1489 | - } // !empty($permissions) |
|
1490 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1491 | - ?> |
|
1489 | + } // !empty($permissions) |
|
1490 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1491 | + ?> |
|
1492 | 1492 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1493 | 1493 | <?php |
1494 | 1494 | |
1495 | - } |
|
1496 | - } |
|
1497 | - /* End Document Access Permissions * |
|
1495 | + } |
|
1496 | + } |
|
1497 | + /* End Document Access Permissions * |
|
1498 | 1498 | ***********************************/ |
1499 | - ?> |
|
1499 | + ?> |
|
1500 | 1500 | |
1501 | 1501 | <input type="submit" name="save" style="display:none" /> |
1502 | 1502 | <?php |
1503 | 1503 | |
1504 | - // invoke OnDocFormRender event |
|
1505 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1506 | - 'id' => $id, |
|
1507 | - 'template' => $content['template'] |
|
1508 | - )); |
|
1504 | + // invoke OnDocFormRender event |
|
1505 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1506 | + 'id' => $id, |
|
1507 | + 'template' => $content['template'] |
|
1508 | + )); |
|
1509 | 1509 | |
1510 | - if(is_array($evtOut)) { |
|
1511 | - echo implode('', $evtOut); |
|
1512 | - } |
|
1513 | - ?> |
|
1510 | + if(is_array($evtOut)) { |
|
1511 | + echo implode('', $evtOut); |
|
1512 | + } |
|
1513 | + ?> |
|
1514 | 1514 | </div><!--div class="tab-pane" id="documentPane"--> |
1515 | 1515 | </div><!--div class="sectionBody"--> |
1516 | 1516 | </fieldset> |
@@ -1521,63 +1521,63 @@ discard block |
||
1521 | 1521 | </script> |
1522 | 1522 | <?php |
1523 | 1523 | if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
1524 | - if(is_array($richtexteditorIds)) { |
|
1525 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1526 | - // invoke OnRichTextEditorInit event |
|
1527 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1528 | - 'editor' => $editor, |
|
1529 | - 'elements' => $elements, |
|
1530 | - 'options' => $richtexteditorOptions[$editor] |
|
1531 | - )); |
|
1532 | - if(is_array($evtOut)) { |
|
1533 | - echo implode('', $evtOut); |
|
1534 | - } |
|
1535 | - } |
|
1536 | - } |
|
1524 | + if(is_array($richtexteditorIds)) { |
|
1525 | + foreach($richtexteditorIds as $editor => $elements) { |
|
1526 | + // invoke OnRichTextEditorInit event |
|
1527 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1528 | + 'editor' => $editor, |
|
1529 | + 'elements' => $elements, |
|
1530 | + 'options' => $richtexteditorOptions[$editor] |
|
1531 | + )); |
|
1532 | + if(is_array($evtOut)) { |
|
1533 | + echo implode('', $evtOut); |
|
1534 | + } |
|
1535 | + } |
|
1536 | + } |
|
1537 | 1537 | } |
1538 | 1538 | |
1539 | 1539 | /** |
1540 | 1540 | * @return string |
1541 | 1541 | */ |
1542 | 1542 | function getDefaultTemplate() { |
1543 | - $modx = evolutionCMS(); |
|
1543 | + $modx = evolutionCMS(); |
|
1544 | 1544 | |
1545 | 1545 | $default_template = ''; |
1546 | - switch($modx->config['auto_template_logic']) { |
|
1547 | - case 'sibling': |
|
1548 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1549 | - $site_start = $modx->config['site_start']; |
|
1550 | - $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
1551 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
1552 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1553 | - $default_template = $sibl[0]['template']; |
|
1554 | - } |
|
1555 | - } else { |
|
1556 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1557 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1558 | - $default_template = $sibl[0]['template']; |
|
1559 | - } else { |
|
1560 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1561 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1562 | - $default_template = $sibl[0]['template']; |
|
1563 | - } |
|
1564 | - } |
|
1565 | - } |
|
1566 | - if(isset($default_template)) { |
|
1567 | - break; |
|
1568 | - } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
1569 | - case 'parent': |
|
1570 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1571 | - $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
1572 | - if(isset($parent['template'])) { |
|
1573 | - $default_template = $parent['template']; |
|
1574 | - } |
|
1575 | - } |
|
1576 | - break; |
|
1577 | - case 'system': |
|
1578 | - default: // default_template is already set |
|
1579 | - $default_template = $modx->config['default_template']; |
|
1580 | - } |
|
1581 | - |
|
1582 | - return empty($default_template) ? $modx->config['default_template'] : $default_template; |
|
1546 | + switch($modx->config['auto_template_logic']) { |
|
1547 | + case 'sibling': |
|
1548 | + if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1549 | + $site_start = $modx->config['site_start']; |
|
1550 | + $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
1551 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
1552 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1553 | + $default_template = $sibl[0]['template']; |
|
1554 | + } |
|
1555 | + } else { |
|
1556 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1557 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1558 | + $default_template = $sibl[0]['template']; |
|
1559 | + } else { |
|
1560 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1561 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1562 | + $default_template = $sibl[0]['template']; |
|
1563 | + } |
|
1564 | + } |
|
1565 | + } |
|
1566 | + if(isset($default_template)) { |
|
1567 | + break; |
|
1568 | + } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
1569 | + case 'parent': |
|
1570 | + if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1571 | + $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
1572 | + if(isset($parent['template'])) { |
|
1573 | + $default_template = $parent['template']; |
|
1574 | + } |
|
1575 | + } |
|
1576 | + break; |
|
1577 | + case 'system': |
|
1578 | + default: // default_template is already set |
|
1579 | + $default_template = $modx->config['default_template']; |
|
1580 | + } |
|
1581 | + |
|
1582 | + return empty($default_template) ? $modx->config['default_template'] : $default_template; |
|
1583 | 1583 | } |
@@ -1,35 +1,35 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | |
6 | 6 | /********************/ |
7 | -$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
8 | -$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
9 | -$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
10 | -$add_path = $sd . $sb . $pg; |
|
7 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
8 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
9 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
10 | +$add_path = $sd.$sb.$pg; |
|
11 | 11 | /*******************/ |
12 | 12 | |
13 | 13 | // check permissions |
14 | -switch($modx->manager->action) { |
|
14 | +switch ($modx->manager->action) { |
|
15 | 15 | case 27: |
16 | - if(!$modx->hasPermission('edit_document')) { |
|
16 | + if (!$modx->hasPermission('edit_document')) { |
|
17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
18 | 18 | } |
19 | 19 | break; |
20 | 20 | case 85: |
21 | 21 | case 72: |
22 | 22 | case 4: |
23 | - if(!$modx->hasPermission('new_document')) { |
|
23 | + if (!$modx->hasPermission('new_document')) { |
|
24 | 24 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
25 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | 26 | // check user has permissions for parent |
27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
27 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
28 | 28 | $udperms = new udperms(); |
29 | 29 | $udperms->user = $modx->getLoginUserID(); |
30 | 30 | $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
32 | - if(!$udperms->checkPermissions()) { |
|
32 | + if (!$udperms->checkPermissions()) { |
|
33 | 33 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
34 | 34 | } |
35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
39 | 39 | } |
40 | 40 | |
41 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
41 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
42 | 42 | |
43 | 43 | // Get table names (alphabetical) |
44 | 44 | $tbl_categories = $modx->getFullTableName('categories'); |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates'); |
54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
55 | 55 | |
56 | -if($modx->manager->action == 27) { |
|
56 | +if ($modx->manager->action == 27) { |
|
57 | 57 | //editing an existing document |
58 | 58 | // check permissions on the document |
59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
59 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
60 | 60 | $udperms = new udperms(); |
61 | 61 | $udperms->user = $modx->getLoginUserID(); |
62 | 62 | $udperms->document = $id; |
63 | 63 | $udperms->role = $_SESSION['mgrRole']; |
64 | 64 | |
65 | - if(!$udperms->checkPermissions()) { |
|
65 | + if (!$udperms->checkPermissions()) { |
|
66 | 66 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | // check to see if resource isn't locked |
71 | -if($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
71 | +if ($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
72 | 72 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
73 | 73 | } |
74 | 74 | // end check for lock |
@@ -77,27 +77,27 @@ discard block |
||
77 | 77 | $modx->lockElement(7, $id); |
78 | 78 | |
79 | 79 | // get document groups for current user |
80 | -if($_SESSION['mgrDocgroups']) { |
|
80 | +if ($_SESSION['mgrDocgroups']) { |
|
81 | 81 | $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
82 | 82 | } |
83 | 83 | |
84 | -if(!empty ($id)) { |
|
84 | +if (!empty ($id)) { |
|
85 | 85 | $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
86 | - if($docgrp) { |
|
86 | + if ($docgrp) { |
|
87 | 87 | $access .= " OR dg.document_group IN ({$docgrp})"; |
88 | 88 | } |
89 | 89 | $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
90 | 90 | $content = array(); |
91 | 91 | $content = $modx->db->getRow($rs); |
92 | 92 | $modx->documentObject = &$content; |
93 | - if(!$content) { |
|
93 | + if (!$content) { |
|
94 | 94 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
95 | 95 | } |
96 | 96 | $_SESSION['itemname'] = $content['pagetitle']; |
97 | 97 | } else { |
98 | 98 | $content = array(); |
99 | 99 | |
100 | - if(isset($_REQUEST['newtemplate'])) { |
|
100 | + if (isset($_REQUEST['newtemplate'])) { |
|
101 | 101 | $content['template'] = $_REQUEST['newtemplate']; |
102 | 102 | } else { |
103 | 103 | $content['template'] = getDefaultTemplate(); |
@@ -108,22 +108,22 @@ discard block |
||
108 | 108 | |
109 | 109 | // restore saved form |
110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
111 | -if(isset($_REQUEST['newtemplate'])) { |
|
111 | +if (isset($_REQUEST['newtemplate'])) { |
|
112 | 112 | $formRestored = true; |
113 | 113 | } |
114 | 114 | |
115 | 115 | // retain form values if template was changed |
116 | 116 | // edited to convert pub_date and unpub_date |
117 | 117 | // sottwell 02-09-2006 |
118 | -if($formRestored == true) { |
|
118 | +if ($formRestored == true) { |
|
119 | 119 | $content = array_merge($content, $_POST); |
120 | 120 | $content['content'] = $_POST['ta']; |
121 | - if(empty ($content['pub_date'])) { |
|
121 | + if (empty ($content['pub_date'])) { |
|
122 | 122 | unset ($content['pub_date']); |
123 | 123 | } else { |
124 | 124 | $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
125 | 125 | } |
126 | - if(empty ($content['unpub_date'])) { |
|
126 | + if (empty ($content['unpub_date'])) { |
|
127 | 127 | unset ($content['unpub_date']); |
128 | 128 | } else { |
129 | 129 | $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | // increase menu index if this is a new document |
134 | -if(!isset ($_REQUEST['id'])) { |
|
135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | +if (!isset ($_REQUEST['id'])) { |
|
135 | + if (!isset ($modx->config['auto_menuindex'])) { |
|
136 | 136 | $modx->config['auto_menuindex'] = 1; |
137 | 137 | } |
138 | - if($modx->config['auto_menuindex']) { |
|
139 | - $pid = (int)$_REQUEST['pid']; |
|
138 | + if ($modx->config['auto_menuindex']) { |
|
139 | + $pid = (int) $_REQUEST['pid']; |
|
140 | 140 | $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
141 | 141 | $content['menuindex'] = $modx->db->getValue($rs); |
142 | 142 | } else { |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | -if(isset ($_POST['which_editor'])) { |
|
147 | +if (isset ($_POST['which_editor'])) { |
|
148 | 148 | $modx->config['which_editor'] = $_POST['which_editor']; |
149 | 149 | } |
150 | 150 | |
151 | 151 | // Add lock-element JS-Script |
152 | 152 | $lockElementId = $id; |
153 | 153 | $lockElementType = 7; |
154 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
154 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
155 | 155 | ?> |
156 | 156 | <script type="text/javascript"> |
157 | 157 | /* <![CDATA[ */ |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | }, |
182 | 182 | cancel: function() { |
183 | 183 | documentDirty = false; |
184 | - document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>'; |
|
184 | + document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>'; |
|
185 | 185 | }, |
186 | 186 | duplicate: function() { |
187 | 187 | if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | }, |
191 | 191 | view: function() { |
192 | - window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin'); |
|
192 | + window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin'); |
|
193 | 193 | } |
194 | 194 | }; |
195 | 195 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | 'template' => $content['template'] |
552 | 552 | )); |
553 | 553 | |
554 | - if(is_array($evtOut)) { |
|
554 | + if (is_array($evtOut)) { |
|
555 | 555 | echo implode('', $evtOut); |
556 | 556 | } |
557 | 557 | |
@@ -575,8 +575,8 @@ discard block |
||
575 | 575 | <fieldset id="create_edit"> |
576 | 576 | |
577 | 577 | <h1> |
578 | - <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
|
579 | - 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 | + <i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) { |
|
579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>'; |
|
580 | 580 | } else { |
581 | 581 | if ($modx->manager->action == '4') { |
582 | 582 | echo $_lang['add_resource']; |
@@ -592,36 +592,36 @@ discard block |
||
592 | 592 | |
593 | 593 | <?php |
594 | 594 | // breadcrumbs |
595 | - if($modx->config['use_breadcrumbs']) { |
|
595 | + if ($modx->config['use_breadcrumbs']) { |
|
596 | 596 | $temp = array(); |
597 | 597 | $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
598 | 598 | |
599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
599 | + if (isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | 600 | $bID = (int) $_REQUEST['id']; |
601 | 601 | $temp = $modx->getParentIds($bID); |
602 | - } else if(isset($_REQUEST['pid'])) { |
|
602 | + } else if (isset($_REQUEST['pid'])) { |
|
603 | 603 | $bID = (int) $_REQUEST['pid']; |
604 | 604 | $temp = $modx->getParentIds($bID); |
605 | 605 | array_unshift($temp, $bID); |
606 | 606 | } |
607 | 607 | |
608 | - if($temp) { |
|
608 | + if ($temp) { |
|
609 | 609 | $parents = implode(',', $temp); |
610 | 610 | |
611 | - if(!empty($parents)) { |
|
611 | + if (!empty($parents)) { |
|
612 | 612 | $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
613 | 613 | $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
614 | - while($row = $modx->db->getRow($rs)) { |
|
614 | + while ($row = $modx->db->getRow($rs)) { |
|
615 | 615 | $out .= '<li class="breadcrumbs__li"> |
616 | - <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
|
616 | + <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a> |
|
617 | 617 | <span class="breadcrumbs__sep">></span> |
618 | 618 | </li>'; |
619 | 619 | } |
620 | 620 | } |
621 | 621 | } |
622 | 622 | |
623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>'; |
|
624 | + echo '<ul class="breadcrumbs">'.$out.'</ul>'; |
|
625 | 625 | } |
626 | 626 | ?> |
627 | 627 | |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
639 | 639 | 'id' => $id |
640 | 640 | )); |
641 | - if(is_array($evtOut)) { |
|
641 | + if (is_array($evtOut)) { |
|
642 | 642 | echo implode('', $evtOut); |
643 | 643 | } else { |
644 | 644 | ?> |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | </td> |
695 | 695 | </tr> |
696 | 696 | |
697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
697 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
698 | 698 | |
699 | 699 | <tr> |
700 | 700 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -730,17 +730,17 @@ discard block |
||
730 | 730 | $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
731 | 731 | $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
732 | 732 | $currentCategory = ''; |
733 | - while($row = $modx->db->getRow($rs)) { |
|
734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | + while ($row = $modx->db->getRow($rs)) { |
|
734 | + if ($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | 735 | continue; |
736 | 736 | }; |
737 | 737 | // Skip if not selectable but show if selected! |
738 | 738 | $thisCategory = $row['category']; |
739 | - if($thisCategory == null) { |
|
739 | + if ($thisCategory == null) { |
|
740 | 740 | $thisCategory = $_lang["no_category"]; |
741 | 741 | } |
742 | - if($thisCategory != $currentCategory) { |
|
743 | - if($closeOptGroup) { |
|
742 | + if ($thisCategory != $currentCategory) { |
|
743 | + if ($closeOptGroup) { |
|
744 | 744 | echo "\t\t\t\t\t</optgroup>\n"; |
745 | 745 | } |
746 | 746 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
@@ -749,10 +749,10 @@ discard block |
||
749 | 749 | |
750 | 750 | $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
751 | 751 | |
752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
752 | + echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
|
753 | 753 | $currentCategory = $thisCategory; |
754 | 754 | } |
755 | - if($thisCategory != '') { |
|
755 | + if ($thisCategory != '') { |
|
756 | 756 | echo "\t\t\t\t\t</optgroup>\n"; |
757 | 757 | } |
758 | 758 | ?> |
@@ -796,20 +796,20 @@ discard block |
||
796 | 796 | <td valign="top"> |
797 | 797 | <?php |
798 | 798 | $parentlookup = false; |
799 | - if(isset ($_REQUEST['id'])) { |
|
800 | - if($content['parent'] == 0) { |
|
799 | + if (isset ($_REQUEST['id'])) { |
|
800 | + if ($content['parent'] == 0) { |
|
801 | 801 | $parentname = $site_name; |
802 | 802 | } else { |
803 | 803 | $parentlookup = $content['parent']; |
804 | 804 | } |
805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
806 | - if($_REQUEST['pid'] == 0) { |
|
805 | + } elseif (isset ($_REQUEST['pid'])) { |
|
806 | + if ($_REQUEST['pid'] == 0) { |
|
807 | 807 | $parentname = $site_name; |
808 | 808 | } else { |
809 | 809 | $parentlookup = $_REQUEST['pid']; |
810 | 810 | } |
811 | - } elseif(isset($_POST['parent'])) { |
|
812 | - if($_POST['parent'] == 0) { |
|
811 | + } elseif (isset($_POST['parent'])) { |
|
812 | + if ($_POST['parent'] == 0) { |
|
813 | 813 | $parentname = $site_name; |
814 | 814 | } else { |
815 | 815 | $parentlookup = $_POST['parent']; |
@@ -818,10 +818,10 @@ discard block |
||
818 | 818 | $parentname = $site_name; |
819 | 819 | $content['parent'] = 0; |
820 | 820 | } |
821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
821 | + if ($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | 822 | $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
823 | 823 | $parentname = $modx->db->getValue($rs); |
824 | - if(!$parentname) { |
|
824 | + if (!$parentname) { |
|
825 | 825 | $modx->webAlertAndQuit($_lang["error_no_parent"]); |
826 | 826 | } |
827 | 827 | } |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | }*/ |
864 | 864 | ?> |
865 | 865 | |
866 | - <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
866 | + <?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
867 | 867 | <tr> |
868 | 868 | <td colspan="2"> |
869 | 869 | <hr> |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | <?php |
877 | 877 | // invoke OnRichTextEditorRegister event |
878 | 878 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
879 | - if(is_array($evtOut)) { |
|
880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
879 | + if (is_array($evtOut)) { |
|
880 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
881 | 881 | $editor = $evtOut[$i]; |
882 | 882 | echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
883 | 883 | } |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | </div> |
889 | 889 | <div id="content_body"> |
890 | 890 | <?php |
891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
891 | + if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | 892 | $htmlContent = $content['content']; |
893 | 893 | ?> |
894 | 894 | <div class="section-editor clearfix"> |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
902 | 902 | $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
903 | 903 | } else { |
904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
904 | + echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n"; |
|
905 | 905 | } |
906 | 906 | ?> |
907 | 907 | </div> |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | |
918 | 918 | if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) { |
919 | 919 | $template = $default_template; |
920 | - $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs']; |
|
920 | + $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs']; |
|
921 | 921 | if (isset ($_REQUEST['newtemplate'])) { |
922 | 922 | $template = $_REQUEST['newtemplate']; |
923 | 923 | } else { |
@@ -945,10 +945,10 @@ discard block |
||
945 | 945 | ); |
946 | 946 | $sort = 'tvtpl.rank,tv.rank, tv.id'; |
947 | 947 | if ($group_tvs) { |
948 | - $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
948 | + $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
949 | 949 | $from .= ' |
950 | - LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category'; |
|
951 | - $sort = 'cat.rank,cat.id,' . $sort; |
|
950 | + LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category'; |
|
951 | + $sort = 'cat.rank,cat.id,'.$sort; |
|
952 | 952 | } |
953 | 953 | $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs); |
954 | 954 | $evtOut = $modx->invokeEvent('OnDocTVPrerender', array('id' => $id, 'template' => $template)); |
@@ -961,37 +961,37 @@ discard block |
||
961 | 961 | <!-- Template Variables -->' . "\n"; |
962 | 962 | if (!$group_tvs) { |
963 | 963 | $templateVariables .= ' |
964 | - <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
964 | + <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
965 | 965 | <div class="sectionBody tmplvars"> |
966 | 966 | <table>'; |
967 | 967 | } else if ($group_tvs == 2) { |
968 | 968 | $templateVariables .= ' |
969 | 969 | <div class="tab-section"> |
970 | - <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
970 | + <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
971 | 971 | <div class="tab-pane" id="paneTemplateVariables"> |
972 | 972 | <script type="text/javascript"> |
973 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
973 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
974 | 974 | </script>'; |
975 | 975 | } else if ($group_tvs == 3) { |
976 | 976 | $templateVariables .= ' |
977 | 977 | <div id="templateVariables" class="tab-page tmplvars"> |
978 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
978 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
979 | 979 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>'; |
980 | 980 | } else if ($group_tvs == 4) { |
981 | 981 | $templateVariables .= ' |
982 | 982 | <div id="templateVariables" class="tab-page tmplvars"> |
983 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
983 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
984 | 984 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script> |
985 | 985 | |
986 | 986 | <div class="tab-pane" id="paneTemplateVariables"> |
987 | 987 | <script type="text/javascript"> |
988 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
988 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
989 | 989 | </script>'; |
990 | 990 | } |
991 | 991 | |
992 | 992 | $tvsArray = $modx->db->makeArray($rs, 'name'); |
993 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php'); |
|
994 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
993 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php'); |
|
994 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
995 | 995 | $i = 0; |
996 | 996 | $tab = ''; |
997 | 997 | foreach ($tvsArray as $row) { |
@@ -999,8 +999,8 @@ discard block |
||
999 | 999 | if ($group_tvs == 1 || $group_tvs == 3) { |
1000 | 1000 | if ($i === 0) { |
1001 | 1001 | $templateVariables .= ' |
1002 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
1003 | - <div class="tab-header">' . $row['category'] . '</div> |
|
1002 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
1003 | + <div class="tab-header">' . $row['category'].'</div> |
|
1004 | 1004 | <div class="tab-body tmplvars"> |
1005 | 1005 | <table>' . "\n"; |
1006 | 1006 | } else { |
@@ -1009,17 +1009,17 @@ discard block |
||
1009 | 1009 | </div> |
1010 | 1010 | </div> |
1011 | 1011 | |
1012 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
1013 | - <div class="tab-header">' . $row['category'] . '</div> |
|
1012 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
1013 | + <div class="tab-header">' . $row['category'].'</div> |
|
1014 | 1014 | <div class="tab-body tmplvars"> |
1015 | 1015 | <table>'; |
1016 | 1016 | } |
1017 | 1017 | } else if ($group_tvs == 2 || $group_tvs == 4) { |
1018 | 1018 | if ($i === 0) { |
1019 | 1019 | $templateVariables .= ' |
1020 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1021 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1022 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1020 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1021 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1022 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1023 | 1023 | |
1024 | 1024 | <div class="tab-body tmplvars"> |
1025 | 1025 | <table>'; |
@@ -1029,9 +1029,9 @@ discard block |
||
1029 | 1029 | </div> |
1030 | 1030 | </div> |
1031 | 1031 | |
1032 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1033 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1034 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1032 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1033 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1034 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1035 | 1035 | |
1036 | 1036 | <div class="tab-body tmplvars"> |
1037 | 1037 | <table>'; |
@@ -1039,18 +1039,18 @@ discard block |
||
1039 | 1039 | } else if ($group_tvs == 5) { |
1040 | 1040 | if ($i === 0) { |
1041 | 1041 | $templateVariables .= ' |
1042 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1043 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1044 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1042 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1043 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1044 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1045 | 1045 | <table>'; |
1046 | 1046 | } else { |
1047 | 1047 | $templateVariables .= ' |
1048 | 1048 | </table> |
1049 | 1049 | </div> |
1050 | 1050 | |
1051 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1052 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1053 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1051 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1052 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1053 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1054 | 1054 | |
1055 | 1055 | <table>'; |
1056 | 1056 | } |
@@ -1068,8 +1068,8 @@ discard block |
||
1068 | 1068 | $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor']; |
1069 | 1069 | }; |
1070 | 1070 | // Add richtext editor to the list |
1071 | - $richtexteditorIds[$editor][] = "tv" . $row['id']; |
|
1072 | - $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions; |
|
1071 | + $richtexteditorIds[$editor][] = "tv".$row['id']; |
|
1072 | + $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions; |
|
1073 | 1073 | } |
1074 | 1074 | // splitter |
1075 | 1075 | if ($group_tvs) { |
@@ -1083,24 +1083,24 @@ discard block |
||
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | // post back value |
1086 | - if (array_key_exists('tv' . $row['id'], $_POST)) { |
|
1087 | - if (is_array($_POST['tv' . $row['id']])) { |
|
1088 | - $tvPBV = implode('||', $_POST['tv' . $row['id']]); |
|
1086 | + if (array_key_exists('tv'.$row['id'], $_POST)) { |
|
1087 | + if (is_array($_POST['tv'.$row['id']])) { |
|
1088 | + $tvPBV = implode('||', $_POST['tv'.$row['id']]); |
|
1089 | 1089 | } else { |
1090 | - $tvPBV = $_POST['tv' . $row['id']]; |
|
1090 | + $tvPBV = $_POST['tv'.$row['id']]; |
|
1091 | 1091 | } |
1092 | 1092 | } else { |
1093 | 1093 | $tvPBV = $row['value']; |
1094 | 1094 | } |
1095 | 1095 | |
1096 | - $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : ''; |
|
1097 | - $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : ''; |
|
1098 | - $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : ''; |
|
1096 | + $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : ''; |
|
1097 | + $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : ''; |
|
1098 | + $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : ''; |
|
1099 | 1099 | |
1100 | 1100 | $templateVariables .= ' |
1101 | 1101 | <tr> |
1102 | - <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td> |
|
1103 | - <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td> |
|
1102 | + <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td> |
|
1103 | + <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td> |
|
1104 | 1104 | </tr>'; |
1105 | 1105 | |
1106 | 1106 | $tab = $row['category_id']; |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | |
1195 | 1195 | <?php |
1196 | 1196 | |
1197 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1197 | + if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1198 | 1198 | ?> |
1199 | 1199 | <tr> |
1200 | 1200 | <td> |
@@ -1217,13 +1217,13 @@ discard block |
||
1217 | 1217 | <td> |
1218 | 1218 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1219 | 1219 | <?php |
1220 | - if(!$content['contentType']) { |
|
1220 | + if (!$content['contentType']) { |
|
1221 | 1221 | $content['contentType'] = 'text/html'; |
1222 | 1222 | } |
1223 | 1223 | $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
1224 | 1224 | $ct = explode(",", $custom_contenttype); |
1225 | - for($i = 0; $i < count($ct); $i++) { |
|
1226 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1225 | + for ($i = 0; $i < count($ct); $i++) { |
|
1226 | + echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n"; |
|
1227 | 1227 | } |
1228 | 1228 | ?> |
1229 | 1229 | </select> |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | </tr> |
1250 | 1250 | <?php |
1251 | 1251 | } else { |
1252 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1252 | + if ($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1253 | 1253 | // non-admin managers creating or editing a document resource |
1254 | 1254 | ?> |
1255 | 1255 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
@@ -1349,15 +1349,15 @@ discard block |
||
1349 | 1349 | <?php |
1350 | 1350 | /******************************* |
1351 | 1351 | * Document Access Permissions */ |
1352 | - if($use_udperms == 1) { |
|
1352 | + if ($use_udperms == 1) { |
|
1353 | 1353 | $groupsarray = array(); |
1354 | 1354 | $sql = ''; |
1355 | 1355 | |
1356 | 1356 | $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
1357 | - if($documentId > 0) { |
|
1357 | + if ($documentId > 0) { |
|
1358 | 1358 | // Load up, the permissions from the parent (if new document) or existing document |
1359 | 1359 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1360 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1360 | + while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id']; |
|
1361 | 1361 | |
1362 | 1362 | // Load up the current permissions and names |
1363 | 1363 | $vs = array( |
@@ -1373,7 +1373,7 @@ discard block |
||
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | // retain selected doc groups between post |
1376 | - if(isset($_POST['docgroups'])) { |
|
1376 | + if (isset($_POST['docgroups'])) { |
|
1377 | 1377 | $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
1378 | 1378 | } |
1379 | 1379 | |
@@ -1392,26 +1392,26 @@ discard block |
||
1392 | 1392 | $permissions_no = 0; // count permissions the current mgr user doesn't have |
1393 | 1393 | |
1394 | 1394 | // Loop through the permissions list |
1395 | - while($row = $modx->db->getRow($rs)) { |
|
1395 | + while ($row = $modx->db->getRow($rs)) { |
|
1396 | 1396 | |
1397 | 1397 | // Create an inputValue pair (group ID and group link (if it exists)) |
1398 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1399 | - $inputId = 'group-' . $row['id']; |
|
1398 | + $inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new'); |
|
1399 | + $inputId = 'group-'.$row['id']; |
|
1400 | 1400 | |
1401 | 1401 | $checked = in_array($inputValue, $groupsarray); |
1402 | - if($checked) { |
|
1402 | + if ($checked) { |
|
1403 | 1403 | $notPublic = true; |
1404 | 1404 | } // Mark as private access (either web or manager) |
1405 | 1405 | |
1406 | 1406 | // Skip the access permission if the user doesn't have access... |
1407 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1407 | + if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1408 | 1408 | continue; |
1409 | 1409 | } |
1410 | 1410 | |
1411 | 1411 | // Setup attributes for this Input box |
1412 | 1412 | $inputAttributes['id'] = $inputId; |
1413 | 1413 | $inputAttributes['value'] = $inputValue; |
1414 | - if($checked) { |
|
1414 | + if ($checked) { |
|
1415 | 1415 | $inputAttributes['checked'] = 'checked'; |
1416 | 1416 | } else { |
1417 | 1417 | unset($inputAttributes['checked']); |
@@ -1419,10 +1419,10 @@ discard block |
||
1419 | 1419 | |
1420 | 1420 | // Create attribute string list |
1421 | 1421 | $inputString = array(); |
1422 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1422 | + foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"'; |
|
1423 | 1423 | |
1424 | 1424 | // Make the <input> HTML |
1425 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1425 | + $inputHTML = '<input '.implode(' ', $inputString).' />'; |
|
1426 | 1426 | |
1427 | 1427 | // does user have this permission? |
1428 | 1428 | $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
@@ -1433,23 +1433,23 @@ discard block |
||
1433 | 1433 | $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
1434 | 1434 | $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
1435 | 1435 | $count = $modx->db->getValue($rsp); |
1436 | - if($count > 0) { |
|
1436 | + if ($count > 0) { |
|
1437 | 1437 | ++$permissions_yes; |
1438 | 1438 | } else { |
1439 | 1439 | ++$permissions_no; |
1440 | 1440 | } |
1441 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1441 | + $permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>'; |
|
1442 | 1442 | } |
1443 | 1443 | // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
1444 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1444 | + if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1445 | 1445 | $permissions = array(); |
1446 | 1446 | } |
1447 | 1447 | |
1448 | 1448 | // See if the Access Permissions section is worth displaying... |
1449 | - if(!empty($permissions)) { |
|
1449 | + if (!empty($permissions)) { |
|
1450 | 1450 | // Add the "All Document Groups" item if we have rights in both contexts |
1451 | - if($isManager && $isWeb) { |
|
1452 | - 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>'); |
|
1451 | + if ($isManager && $isWeb) { |
|
1452 | + 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>'); |
|
1453 | 1453 | } |
1454 | 1454 | // Output the permissions list... |
1455 | 1455 | ?> |
@@ -1482,12 +1482,12 @@ discard block |
||
1482 | 1482 | </script> |
1483 | 1483 | <p><?= $_lang['access_permissions_docs_message'] ?></p> |
1484 | 1484 | <ul> |
1485 | - <?= implode("\n", $permissions) . "\n" ?> |
|
1485 | + <?= implode("\n", $permissions)."\n" ?> |
|
1486 | 1486 | </ul> |
1487 | 1487 | </div><!--div class="tab-page" id="tabAccess"--> |
1488 | 1488 | <?php |
1489 | 1489 | } // !empty($permissions) |
1490 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1490 | + elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1491 | 1491 | ?> |
1492 | 1492 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1493 | 1493 | <?php |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | 'template' => $content['template'] |
1508 | 1508 | )); |
1509 | 1509 | |
1510 | - if(is_array($evtOut)) { |
|
1510 | + if (is_array($evtOut)) { |
|
1511 | 1511 | echo implode('', $evtOut); |
1512 | 1512 | } |
1513 | 1513 | ?> |
@@ -1520,16 +1520,16 @@ discard block |
||
1520 | 1520 | storeCurTemplate(); |
1521 | 1521 | </script> |
1522 | 1522 | <?php |
1523 | -if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1524 | - if(is_array($richtexteditorIds)) { |
|
1525 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1523 | +if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1524 | + if (is_array($richtexteditorIds)) { |
|
1525 | + foreach ($richtexteditorIds as $editor => $elements) { |
|
1526 | 1526 | // invoke OnRichTextEditorInit event |
1527 | 1527 | $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
1528 | 1528 | 'editor' => $editor, |
1529 | 1529 | 'elements' => $elements, |
1530 | 1530 | 'options' => $richtexteditorOptions[$editor] |
1531 | 1531 | )); |
1532 | - if(is_array($evtOut)) { |
|
1532 | + if (is_array($evtOut)) { |
|
1533 | 1533 | echo implode('', $evtOut); |
1534 | 1534 | } |
1535 | 1535 | } |
@@ -1539,37 +1539,37 @@ discard block |
||
1539 | 1539 | /** |
1540 | 1540 | * @return string |
1541 | 1541 | */ |
1542 | -function getDefaultTemplate() { |
|
1542 | +function getDefaultTemplate(){ |
|
1543 | 1543 | $modx = evolutionCMS(); |
1544 | 1544 | |
1545 | 1545 | $default_template = ''; |
1546 | - switch($modx->config['auto_template_logic']) { |
|
1546 | + switch ($modx->config['auto_template_logic']) { |
|
1547 | 1547 | case 'sibling': |
1548 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1548 | + if (!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1549 | 1549 | $site_start = $modx->config['site_start']; |
1550 | 1550 | $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
1551 | 1551 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
1552 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1552 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1553 | 1553 | $default_template = $sibl[0]['template']; |
1554 | 1554 | } |
1555 | 1555 | } else { |
1556 | 1556 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1557 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1557 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1558 | 1558 | $default_template = $sibl[0]['template']; |
1559 | 1559 | } else { |
1560 | 1560 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1561 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1561 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1562 | 1562 | $default_template = $sibl[0]['template']; |
1563 | 1563 | } |
1564 | 1564 | } |
1565 | 1565 | } |
1566 | - if(isset($default_template)) { |
|
1566 | + if (isset($default_template)) { |
|
1567 | 1567 | break; |
1568 | 1568 | } // If $default_template could not be determined, fall back / through to "parent"-mode |
1569 | 1569 | case 'parent': |
1570 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1570 | + if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1571 | 1571 | $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
1572 | - if(isset($parent['template'])) { |
|
1572 | + if (isset($parent['template'])) { |
|
1573 | 1573 | $default_template = $parent['template']; |
1574 | 1574 | } |
1575 | 1575 | } |