@@ -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,17 +945,17 @@ 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 | $rs = $modx->db->select($field, $from, $where, $sort); |
955 | 955 | if ($modx->db->getRecordCount($rs)) { |
956 | 956 | $tvsArray = $modx->db->makeArray($rs, 'name'); |
957 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php'); |
|
958 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
957 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php'); |
|
958 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
959 | 959 | |
960 | 960 | $templateVariablesOutput = ''; |
961 | 961 | $templateVariablesGeneral = ''; |
@@ -969,8 +969,8 @@ discard block |
||
969 | 969 | if ($group_tvs == 1 || $group_tvs == 3) { |
970 | 970 | if ($i === 0) { |
971 | 971 | $templateVariablesOutput .= ' |
972 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
973 | - <div class="tab-header">' . $row['category'] . '</div> |
|
972 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
973 | + <div class="tab-header">' . $row['category'].'</div> |
|
974 | 974 | <div class="tab-body tmplvars"> |
975 | 975 | <table>' . "\n"; |
976 | 976 | } else { |
@@ -979,17 +979,17 @@ discard block |
||
979 | 979 | </div> |
980 | 980 | </div> |
981 | 981 | |
982 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
983 | - <div class="tab-header">' . $row['category'] . '</div> |
|
982 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
983 | + <div class="tab-header">' . $row['category'].'</div> |
|
984 | 984 | <div class="tab-body tmplvars"> |
985 | 985 | <table>'; |
986 | 986 | } |
987 | 987 | } else if ($group_tvs == 2 || $group_tvs == 4) { |
988 | 988 | if ($i === 0) { |
989 | 989 | $templateVariablesOutput .= ' |
990 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
991 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
992 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
990 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
991 | + <h2 class="tab">' . $row['category'].'</h2> |
|
992 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
993 | 993 | |
994 | 994 | <div class="tab-body tmplvars"> |
995 | 995 | <table>'; |
@@ -999,9 +999,9 @@ discard block |
||
999 | 999 | </div> |
1000 | 1000 | </div> |
1001 | 1001 | |
1002 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1003 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1004 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1002 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1003 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1004 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1005 | 1005 | |
1006 | 1006 | <div class="tab-body tmplvars"> |
1007 | 1007 | <table>'; |
@@ -1009,18 +1009,18 @@ discard block |
||
1009 | 1009 | } else if ($group_tvs == 5) { |
1010 | 1010 | if ($i === 0) { |
1011 | 1011 | $templateVariablesOutput .= ' |
1012 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1013 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1014 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1012 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1013 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1014 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1015 | 1015 | <table>'; |
1016 | 1016 | } else { |
1017 | 1017 | $templateVariablesOutput .= ' |
1018 | 1018 | </table> |
1019 | 1019 | </div> |
1020 | 1020 | |
1021 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1022 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1023 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1021 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1022 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1023 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1024 | 1024 | |
1025 | 1025 | <table>'; |
1026 | 1026 | } |
@@ -1040,8 +1040,8 @@ discard block |
||
1040 | 1040 | $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor']; |
1041 | 1041 | }; |
1042 | 1042 | // Add richtext editor to the list |
1043 | - $richtexteditorIds[$editor][] = "tv" . $row['id']; |
|
1044 | - $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions; |
|
1043 | + $richtexteditorIds[$editor][] = "tv".$row['id']; |
|
1044 | + $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions; |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | $templateVariablesTmp = ''; |
@@ -1058,24 +1058,24 @@ discard block |
||
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | // post back value |
1061 | - if (array_key_exists('tv' . $row['id'], $_POST)) { |
|
1062 | - if (is_array($_POST['tv' . $row['id']])) { |
|
1063 | - $tvPBV = implode('||', $_POST['tv' . $row['id']]); |
|
1061 | + if (array_key_exists('tv'.$row['id'], $_POST)) { |
|
1062 | + if (is_array($_POST['tv'.$row['id']])) { |
|
1063 | + $tvPBV = implode('||', $_POST['tv'.$row['id']]); |
|
1064 | 1064 | } else { |
1065 | - $tvPBV = $_POST['tv' . $row['id']]; |
|
1065 | + $tvPBV = $_POST['tv'.$row['id']]; |
|
1066 | 1066 | } |
1067 | 1067 | } else { |
1068 | 1068 | $tvPBV = $row['value']; |
1069 | 1069 | } |
1070 | 1070 | |
1071 | - $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : ''; |
|
1072 | - $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : ''; |
|
1073 | - $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : ''; |
|
1071 | + $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : ''; |
|
1072 | + $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : ''; |
|
1073 | + $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : ''; |
|
1074 | 1074 | |
1075 | 1075 | $templateVariablesTmp .= ' |
1076 | 1076 | <tr> |
1077 | - <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td> |
|
1078 | - <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td> |
|
1077 | + <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td> |
|
1078 | + <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td> |
|
1079 | 1079 | </tr>'; |
1080 | 1080 | |
1081 | 1081 | if ($group_tvs && $row['category_id'] == 0) { |
@@ -1089,38 +1089,38 @@ discard block |
||
1089 | 1089 | } |
1090 | 1090 | |
1091 | 1091 | if ($templateVariablesGeneral) { |
1092 | - echo '<table id="tabTV_0" class="tmplvars"><tbody>' . $templateVariablesGeneral . '</tbody></table>'; |
|
1092 | + echo '<table id="tabTV_0" class="tmplvars"><tbody>'.$templateVariablesGeneral.'</tbody></table>'; |
|
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | $templateVariables .= ' |
1096 | 1096 | <!-- Template Variables -->' . "\n"; |
1097 | 1097 | if (!$group_tvs) { |
1098 | 1098 | $templateVariables .= ' |
1099 | - <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
1099 | + <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
1100 | 1100 | <div class="sectionBody tmplvars"> |
1101 | 1101 | <table>'; |
1102 | 1102 | } else if ($group_tvs == 2) { |
1103 | 1103 | $templateVariables .= ' |
1104 | 1104 | <div class="tab-section"> |
1105 | - <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
1105 | + <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
1106 | 1106 | <div class="tab-pane" id="paneTemplateVariables"> |
1107 | 1107 | <script type="text/javascript"> |
1108 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
1108 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
1109 | 1109 | </script>'; |
1110 | 1110 | } else if ($group_tvs == 3) { |
1111 | 1111 | $templateVariables .= ' |
1112 | 1112 | <div id="templateVariables" class="tab-page tmplvars"> |
1113 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
1113 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
1114 | 1114 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>'; |
1115 | 1115 | } else if ($group_tvs == 4) { |
1116 | 1116 | $templateVariables .= ' |
1117 | 1117 | <div id="templateVariables" class="tab-page tmplvars"> |
1118 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
1118 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
1119 | 1119 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script> |
1120 | 1120 | |
1121 | 1121 | <div class="tab-pane" id="paneTemplateVariables"> |
1122 | 1122 | <script type="text/javascript"> |
1123 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
1123 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
1124 | 1124 | </script>'; |
1125 | 1125 | } |
1126 | 1126 | $templateVariables .= $templateVariablesOutput; |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | |
1213 | 1213 | <?php |
1214 | 1214 | |
1215 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1215 | + if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1216 | 1216 | ?> |
1217 | 1217 | <tr> |
1218 | 1218 | <td> |
@@ -1235,13 +1235,13 @@ discard block |
||
1235 | 1235 | <td> |
1236 | 1236 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1237 | 1237 | <?php |
1238 | - if(!$content['contentType']) { |
|
1238 | + if (!$content['contentType']) { |
|
1239 | 1239 | $content['contentType'] = 'text/html'; |
1240 | 1240 | } |
1241 | 1241 | $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
1242 | 1242 | $ct = explode(",", $custom_contenttype); |
1243 | - for($i = 0; $i < count($ct); $i++) { |
|
1244 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1243 | + for ($i = 0; $i < count($ct); $i++) { |
|
1244 | + echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n"; |
|
1245 | 1245 | } |
1246 | 1246 | ?> |
1247 | 1247 | </select> |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | </tr> |
1268 | 1268 | <?php |
1269 | 1269 | } else { |
1270 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1270 | + if ($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1271 | 1271 | // non-admin managers creating or editing a document resource |
1272 | 1272 | ?> |
1273 | 1273 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
@@ -1367,15 +1367,15 @@ discard block |
||
1367 | 1367 | <?php |
1368 | 1368 | /******************************* |
1369 | 1369 | * Document Access Permissions */ |
1370 | - if($use_udperms == 1) { |
|
1370 | + if ($use_udperms == 1) { |
|
1371 | 1371 | $groupsarray = array(); |
1372 | 1372 | $sql = ''; |
1373 | 1373 | |
1374 | 1374 | $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
1375 | - if($documentId > 0) { |
|
1375 | + if ($documentId > 0) { |
|
1376 | 1376 | // Load up, the permissions from the parent (if new document) or existing document |
1377 | 1377 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1378 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1378 | + while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id']; |
|
1379 | 1379 | |
1380 | 1380 | // Load up the current permissions and names |
1381 | 1381 | $vs = array( |
@@ -1391,7 +1391,7 @@ discard block |
||
1391 | 1391 | } |
1392 | 1392 | |
1393 | 1393 | // retain selected doc groups between post |
1394 | - if(isset($_POST['docgroups'])) { |
|
1394 | + if (isset($_POST['docgroups'])) { |
|
1395 | 1395 | $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
1396 | 1396 | } |
1397 | 1397 | |
@@ -1410,26 +1410,26 @@ discard block |
||
1410 | 1410 | $permissions_no = 0; // count permissions the current mgr user doesn't have |
1411 | 1411 | |
1412 | 1412 | // Loop through the permissions list |
1413 | - while($row = $modx->db->getRow($rs)) { |
|
1413 | + while ($row = $modx->db->getRow($rs)) { |
|
1414 | 1414 | |
1415 | 1415 | // Create an inputValue pair (group ID and group link (if it exists)) |
1416 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1417 | - $inputId = 'group-' . $row['id']; |
|
1416 | + $inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new'); |
|
1417 | + $inputId = 'group-'.$row['id']; |
|
1418 | 1418 | |
1419 | 1419 | $checked = in_array($inputValue, $groupsarray); |
1420 | - if($checked) { |
|
1420 | + if ($checked) { |
|
1421 | 1421 | $notPublic = true; |
1422 | 1422 | } // Mark as private access (either web or manager) |
1423 | 1423 | |
1424 | 1424 | // Skip the access permission if the user doesn't have access... |
1425 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1425 | + if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1426 | 1426 | continue; |
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | // Setup attributes for this Input box |
1430 | 1430 | $inputAttributes['id'] = $inputId; |
1431 | 1431 | $inputAttributes['value'] = $inputValue; |
1432 | - if($checked) { |
|
1432 | + if ($checked) { |
|
1433 | 1433 | $inputAttributes['checked'] = 'checked'; |
1434 | 1434 | } else { |
1435 | 1435 | unset($inputAttributes['checked']); |
@@ -1437,10 +1437,10 @@ discard block |
||
1437 | 1437 | |
1438 | 1438 | // Create attribute string list |
1439 | 1439 | $inputString = array(); |
1440 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1440 | + foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"'; |
|
1441 | 1441 | |
1442 | 1442 | // Make the <input> HTML |
1443 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1443 | + $inputHTML = '<input '.implode(' ', $inputString).' />'; |
|
1444 | 1444 | |
1445 | 1445 | // does user have this permission? |
1446 | 1446 | $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
@@ -1451,23 +1451,23 @@ discard block |
||
1451 | 1451 | $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
1452 | 1452 | $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
1453 | 1453 | $count = $modx->db->getValue($rsp); |
1454 | - if($count > 0) { |
|
1454 | + if ($count > 0) { |
|
1455 | 1455 | ++$permissions_yes; |
1456 | 1456 | } else { |
1457 | 1457 | ++$permissions_no; |
1458 | 1458 | } |
1459 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1459 | + $permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>'; |
|
1460 | 1460 | } |
1461 | 1461 | // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
1462 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1462 | + if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1463 | 1463 | $permissions = array(); |
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | // See if the Access Permissions section is worth displaying... |
1467 | - if(!empty($permissions)) { |
|
1467 | + if (!empty($permissions)) { |
|
1468 | 1468 | // Add the "All Document Groups" item if we have rights in both contexts |
1469 | - if($isManager && $isWeb) { |
|
1470 | - 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>'); |
|
1469 | + if ($isManager && $isWeb) { |
|
1470 | + 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>'); |
|
1471 | 1471 | } |
1472 | 1472 | // Output the permissions list... |
1473 | 1473 | ?> |
@@ -1500,12 +1500,12 @@ discard block |
||
1500 | 1500 | </script> |
1501 | 1501 | <p><?= $_lang['access_permissions_docs_message'] ?></p> |
1502 | 1502 | <ul> |
1503 | - <?= implode("\n", $permissions) . "\n" ?> |
|
1503 | + <?= implode("\n", $permissions)."\n" ?> |
|
1504 | 1504 | </ul> |
1505 | 1505 | </div><!--div class="tab-page" id="tabAccess"--> |
1506 | 1506 | <?php |
1507 | 1507 | } // !empty($permissions) |
1508 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1508 | + elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1509 | 1509 | ?> |
1510 | 1510 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1511 | 1511 | <?php |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | 'template' => $content['template'] |
1526 | 1526 | )); |
1527 | 1527 | |
1528 | - if(is_array($evtOut)) { |
|
1528 | + if (is_array($evtOut)) { |
|
1529 | 1529 | echo implode('', $evtOut); |
1530 | 1530 | } |
1531 | 1531 | ?> |
@@ -1538,16 +1538,16 @@ discard block |
||
1538 | 1538 | storeCurTemplate(); |
1539 | 1539 | </script> |
1540 | 1540 | <?php |
1541 | -if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1542 | - if(is_array($richtexteditorIds)) { |
|
1543 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1541 | +if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1542 | + if (is_array($richtexteditorIds)) { |
|
1543 | + foreach ($richtexteditorIds as $editor => $elements) { |
|
1544 | 1544 | // invoke OnRichTextEditorInit event |
1545 | 1545 | $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
1546 | 1546 | 'editor' => $editor, |
1547 | 1547 | 'elements' => $elements, |
1548 | 1548 | 'options' => $richtexteditorOptions[$editor] |
1549 | 1549 | )); |
1550 | - if(is_array($evtOut)) { |
|
1550 | + if (is_array($evtOut)) { |
|
1551 | 1551 | echo implode('', $evtOut); |
1552 | 1552 | } |
1553 | 1553 | } |
@@ -1557,37 +1557,37 @@ discard block |
||
1557 | 1557 | /** |
1558 | 1558 | * @return string |
1559 | 1559 | */ |
1560 | -function getDefaultTemplate() { |
|
1560 | +function getDefaultTemplate(){ |
|
1561 | 1561 | $modx = evolutionCMS(); |
1562 | 1562 | |
1563 | 1563 | $default_template = ''; |
1564 | - switch($modx->config['auto_template_logic']) { |
|
1564 | + switch ($modx->config['auto_template_logic']) { |
|
1565 | 1565 | case 'sibling': |
1566 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1566 | + if (!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1567 | 1567 | $site_start = $modx->config['site_start']; |
1568 | 1568 | $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
1569 | 1569 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
1570 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1570 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1571 | 1571 | $default_template = $sibl[0]['template']; |
1572 | 1572 | } |
1573 | 1573 | } else { |
1574 | 1574 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1575 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1575 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1576 | 1576 | $default_template = $sibl[0]['template']; |
1577 | 1577 | } else { |
1578 | 1578 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1579 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1579 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1580 | 1580 | $default_template = $sibl[0]['template']; |
1581 | 1581 | } |
1582 | 1582 | } |
1583 | 1583 | } |
1584 | - if(isset($default_template)) { |
|
1584 | + if (isset($default_template)) { |
|
1585 | 1585 | break; |
1586 | 1586 | } // If $default_template could not be determined, fall back / through to "parent"-mode |
1587 | 1587 | case 'parent': |
1588 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1588 | + if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1589 | 1589 | $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
1590 | - if(isset($parent['template'])) { |
|
1590 | + if (isset($parent['template'])) { |
|
1591 | 1591 | $default_template = $parent['template']; |
1592 | 1592 | } |
1593 | 1593 | } |