@@ -1,9 +1,9 @@ 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 | if(!$modx->hasPermission('access_permissions')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // Get table names (alphabetical) |
@@ -18,24 +18,24 @@ discard block |
||
18 | 18 | // find all document groups, for the select :) |
19 | 19 | $rs = $modx->db->select('*', $tbl_documentgroup_names, '', 'name'); |
20 | 20 | if($modx->db->getRecordCount($rs) < 1) { |
21 | - $docgroupselector = '[no groups to add]'; |
|
21 | + $docgroupselector = '[no groups to add]'; |
|
22 | 22 | } else { |
23 | - $docgroupselector = '<select name="docgroup">' . "\n"; |
|
24 | - while($row = $modx->db->getRow($rs)) { |
|
25 | - $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
26 | - } |
|
27 | - $docgroupselector .= "</select>\n"; |
|
23 | + $docgroupselector = '<select name="docgroup">' . "\n"; |
|
24 | + while($row = $modx->db->getRow($rs)) { |
|
25 | + $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
26 | + } |
|
27 | + $docgroupselector .= "</select>\n"; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $rs = $modx->db->select('*', $tbl_membergroup_names, '', 'name'); |
31 | 31 | if($modx->db->getRecordCount($rs) < 1) { |
32 | - $usrgroupselector = '[no user groups]'; |
|
32 | + $usrgroupselector = '[no user groups]'; |
|
33 | 33 | } else { |
34 | - $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
35 | - while($row = $modx->db->getRow($rs)) { |
|
36 | - $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
37 | - } |
|
38 | - $usrgroupselector .= "</select>\n"; |
|
34 | + $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
35 | + while($row = $modx->db->getRow($rs)) { |
|
36 | + $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
37 | + } |
|
38 | + $usrgroupselector .= "</select>\n"; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | ?> |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | </form> |
97 | 97 | </div> |
98 | 98 | <?php |
99 | - $rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names . ' AS groupnames |
|
99 | + $rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names . ' AS groupnames |
|
100 | 100 | LEFT JOIN ' . $tbl_member_groups . ' AS groups ON groups.user_group = groupnames.id |
101 | 101 | LEFT JOIN ' . $tbl_manager_users . ' AS users ON users.id = groups.member', '', 'groupnames.name, user_name'); |
102 | - if($modx->db->getRecordCount($rs) < 1) { |
|
103 | - ?> |
|
102 | + if($modx->db->getRecordCount($rs) < 1) { |
|
103 | + ?> |
|
104 | 104 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
105 | 105 | <?php |
106 | - } else { |
|
107 | - ?> |
|
106 | + } else { |
|
107 | + ?> |
|
108 | 108 | <div class="form-group"> |
109 | 109 | <?php |
110 | - $pid = ''; |
|
111 | - while($row = $modx->db->getRow($rs)) { |
|
112 | - if($pid != $row['id']) { |
|
113 | - if($pid != '') { |
|
114 | - echo '</div><div class="form-group">'; |
|
115 | - } |
|
116 | - ?> |
|
110 | + $pid = ''; |
|
111 | + while($row = $modx->db->getRow($rs)) { |
|
112 | + if($pid != $row['id']) { |
|
113 | + if($pid != '') { |
|
114 | + echo '</div><div class="form-group">'; |
|
115 | + } |
|
116 | + ?> |
|
117 | 117 | <form method="post" action="index.php" name="accesspermissions"> |
118 | 118 | <input type="hidden" name="a" value="41" /> |
119 | 119 | <input type="hidden" name="groupid" value="<?= $row['id'] ?>" /> |
@@ -128,21 +128,21 @@ discard block |
||
128 | 128 | </form> |
129 | 129 | <?= $_lang['access_permissions_users_in_group'] ?> |
130 | 130 | <?php |
131 | - } |
|
132 | - if(!$row['user_id']) { |
|
133 | - ?> |
|
131 | + } |
|
132 | + if(!$row['user_id']) { |
|
133 | + ?> |
|
134 | 134 | <i><?= $_lang['access_permissions_no_users_in_group'] ?></i> |
135 | 135 | <?php |
136 | - $pid = $row['id']; |
|
137 | - continue; |
|
138 | - } |
|
139 | - ?> |
|
136 | + $pid = $row['id']; |
|
137 | + continue; |
|
138 | + } |
|
139 | + ?> |
|
140 | 140 | <?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=12&id=<?= $row['user_id'] ?>"><?= $row['user_name'] ?></a> |
141 | 141 | <?php |
142 | - $pid = $row['id']; |
|
143 | - } |
|
144 | - } |
|
145 | - ?> |
|
142 | + $pid = $row['id']; |
|
143 | + } |
|
144 | + } |
|
145 | + ?> |
|
146 | 146 | </div> |
147 | 147 | </div> |
148 | 148 | </div> |
@@ -167,24 +167,24 @@ discard block |
||
167 | 167 | </form> |
168 | 168 | </div> |
169 | 169 | <?php |
170 | - $rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names . ' AS dgnames |
|
170 | + $rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names . ' AS dgnames |
|
171 | 171 | LEFT JOIN ' . $tbl_document_groups . ' AS dg ON dg.document_group = dgnames.id |
172 | 172 | LEFT JOIN ' . $tbl_site_content . ' AS sc ON sc.id = dg.document', '', 'dgnames.name, sc.id'); |
173 | - if($modx->db->getRecordCount($rs) < 1) { |
|
174 | - ?> |
|
173 | + if($modx->db->getRecordCount($rs) < 1) { |
|
174 | + ?> |
|
175 | 175 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
176 | 176 | <?php |
177 | - } else { |
|
178 | - ?> |
|
177 | + } else { |
|
178 | + ?> |
|
179 | 179 | <div class="form-group"> |
180 | 180 | <?php |
181 | - $pid = ''; |
|
182 | - while($row = $modx->db->getRow($rs)) { |
|
183 | - if($pid != $row['id']) { |
|
184 | - if($pid != '') { |
|
185 | - echo '</div><div class="form-group">'; |
|
186 | - } |
|
187 | - ?> |
|
181 | + $pid = ''; |
|
182 | + while($row = $modx->db->getRow($rs)) { |
|
183 | + if($pid != $row['id']) { |
|
184 | + if($pid != '') { |
|
185 | + echo '</div><div class="form-group">'; |
|
186 | + } |
|
187 | + ?> |
|
188 | 188 | <form method="post" action="index.php" name="accesspermissions"> |
189 | 189 | <input type="hidden" name="a" value="41" /> |
190 | 190 | <input type="hidden" name="groupid" value="<?= $row['id'] ?>" /> |
@@ -199,21 +199,21 @@ discard block |
||
199 | 199 | </form> |
200 | 200 | <?= $_lang['access_permissions_resources_in_group'] ?> |
201 | 201 | <?php |
202 | - } |
|
203 | - if(!$row['doc_id']) { |
|
204 | - ?> |
|
202 | + } |
|
203 | + if(!$row['doc_id']) { |
|
204 | + ?> |
|
205 | 205 | <i><?= $_lang['access_permissions_no_resources_in_group'] ?></i> |
206 | 206 | <?php |
207 | - $pid = $row['id']; |
|
208 | - continue; |
|
209 | - } |
|
210 | - ?> |
|
207 | + $pid = $row['id']; |
|
208 | + continue; |
|
209 | + } |
|
210 | + ?> |
|
211 | 211 | <?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=3&id=<?= $row['doc_id'] ?>" title="<?= $modx->htmlspecialchars($row['doc_title']) ?>"><?= $row['doc_id'] ?></a> |
212 | 212 | <?php |
213 | - $pid = $row['id']; |
|
214 | - } |
|
215 | - } |
|
216 | - ?> |
|
213 | + $pid = $row['id']; |
|
214 | + } |
|
215 | + } |
|
216 | + ?> |
|
217 | 217 | </div> |
218 | 218 | </div> |
219 | 219 | </div> |
@@ -225,16 +225,16 @@ discard block |
||
225 | 225 | <div class="container container-body"> |
226 | 226 | <p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p> |
227 | 227 | <?php |
228 | - // User/Document Group Links |
|
229 | - $rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names . ' AS groupnames |
|
228 | + // User/Document Group Links |
|
229 | + $rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names . ' AS groupnames |
|
230 | 230 | LEFT JOIN ' . $tbl_membergroup_access . ' AS groupacc ON groupacc.membergroup = groupnames.id |
231 | 231 | LEFT JOIN ' . $tbl_documentgroup_names . ' AS dgnames ON dgnames.id = groupacc.documentgroup', '', 'name, dg_name'); |
232 | - if($modx->db->getRecordCount($rs) < 1) { |
|
233 | - ?> |
|
232 | + if($modx->db->getRecordCount($rs) < 1) { |
|
233 | + ?> |
|
234 | 234 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
235 | 235 | <?php |
236 | - } else { |
|
237 | - ?> |
|
236 | + } else { |
|
237 | + ?> |
|
238 | 238 | <div class="form-group"> |
239 | 239 | <b><?= $_lang["access_permissions_group_link"] ?></b> |
240 | 240 | <form method="post" action="index.php" name="accesspermissions"> |
@@ -250,38 +250,38 @@ discard block |
||
250 | 250 | <hr> |
251 | 251 | <ul> |
252 | 252 | <?php |
253 | - $pid = ''; |
|
254 | - while($row = $modx->db->getRow($rs)) { |
|
255 | - if($row['id'] != $pid) { |
|
256 | - if($pid != '') { |
|
257 | - echo '</ul></li>'; |
|
258 | - } // close previous one |
|
259 | - ?> |
|
253 | + $pid = ''; |
|
254 | + while($row = $modx->db->getRow($rs)) { |
|
255 | + if($row['id'] != $pid) { |
|
256 | + if($pid != '') { |
|
257 | + echo '</ul></li>'; |
|
258 | + } // close previous one |
|
259 | + ?> |
|
260 | 260 | <li><b><?= $row['name'] ?></b></li> |
261 | 261 | <?php |
262 | - if(!$row['dg_id']) { |
|
263 | - echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
264 | - $pid = ''; |
|
265 | - continue; |
|
266 | - } else { |
|
267 | - echo '<ul>'; |
|
268 | - } |
|
269 | - } |
|
270 | - if(!$row['dg_id']) { |
|
271 | - continue; |
|
272 | - } |
|
273 | - ?> |
|
262 | + if(!$row['dg_id']) { |
|
263 | + echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
264 | + $pid = ''; |
|
265 | + continue; |
|
266 | + } else { |
|
267 | + echo '<ul>'; |
|
268 | + } |
|
269 | + } |
|
270 | + if(!$row['dg_id']) { |
|
271 | + continue; |
|
272 | + } |
|
273 | + ?> |
|
274 | 274 | <li><?= $row['dg_name'] ?> |
275 | 275 | <small><i>(<a class="text-danger" href="index.php?a=41&coupling=<?= $row['link_id'] ?>&operation=remove_document_group_from_user_group"><?= $_lang['remove'] ?></a>)</i></small> |
276 | 276 | </li> |
277 | 277 | <?php |
278 | - $pid = $row['id']; |
|
279 | - } |
|
280 | - ?> |
|
278 | + $pid = $row['id']; |
|
279 | + } |
|
280 | + ?> |
|
281 | 281 | </ul> |
282 | 282 | <?php |
283 | - } |
|
284 | - ?> |
|
283 | + } |
|
284 | + ?> |
|
285 | 285 | </div> |
286 | 286 | </div> |
287 | 287 |
@@ -1,8 +1,8 @@ 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 | -if(!$modx->hasPermission('access_permissions')) { |
|
5 | +if (!$modx->hasPermission('access_permissions')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -17,23 +17,23 @@ discard block |
||
17 | 17 | |
18 | 18 | // find all document groups, for the select :) |
19 | 19 | $rs = $modx->db->select('*', $tbl_documentgroup_names, '', 'name'); |
20 | -if($modx->db->getRecordCount($rs) < 1) { |
|
20 | +if ($modx->db->getRecordCount($rs) < 1) { |
|
21 | 21 | $docgroupselector = '[no groups to add]'; |
22 | 22 | } else { |
23 | - $docgroupselector = '<select name="docgroup">' . "\n"; |
|
24 | - while($row = $modx->db->getRow($rs)) { |
|
25 | - $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
23 | + $docgroupselector = '<select name="docgroup">'."\n"; |
|
24 | + while ($row = $modx->db->getRow($rs)) { |
|
25 | + $docgroupselector .= "\t".'<option value="'.$row['id'].'">'.$row['name']."</option>\n"; |
|
26 | 26 | } |
27 | 27 | $docgroupselector .= "</select>\n"; |
28 | 28 | } |
29 | 29 | |
30 | 30 | $rs = $modx->db->select('*', $tbl_membergroup_names, '', 'name'); |
31 | -if($modx->db->getRecordCount($rs) < 1) { |
|
31 | +if ($modx->db->getRecordCount($rs) < 1) { |
|
32 | 32 | $usrgroupselector = '[no user groups]'; |
33 | 33 | } else { |
34 | - $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
35 | - while($row = $modx->db->getRow($rs)) { |
|
36 | - $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
34 | + $usrgroupselector = '<select name="usergroup">'."\n"; |
|
35 | + while ($row = $modx->db->getRow($rs)) { |
|
36 | + $usrgroupselector .= "\t".'<option value="'.$row['id'].'">'.$row['name']."</option>\n"; |
|
37 | 37 | } |
38 | 38 | $usrgroupselector .= "</select>\n"; |
39 | 39 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | <div class="alert alert-info"><?= $_lang['access_permissions_introtext'] ?></div> |
70 | 70 | </div> |
71 | 71 | |
72 | -<div class="container"><?= ($use_udperms != 1 ? '<div class="alert alert-danger">' . $_lang['access_permissions_off'] . '</div>' : '') ?></div> |
|
72 | +<div class="container"><?= ($use_udperms != 1 ? '<div class="alert alert-danger">'.$_lang['access_permissions_off'].'</div>' : '') ?></div> |
|
73 | 73 | |
74 | 74 | <div class="tab-pane" id="uapPane"> |
75 | 75 | <script type="text/javascript"> |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | </form> |
97 | 97 | </div> |
98 | 98 | <?php |
99 | - $rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names . ' AS groupnames |
|
100 | - LEFT JOIN ' . $tbl_member_groups . ' AS groups ON groups.user_group = groupnames.id |
|
101 | - LEFT JOIN ' . $tbl_manager_users . ' AS users ON users.id = groups.member', '', 'groupnames.name, user_name'); |
|
102 | - if($modx->db->getRecordCount($rs) < 1) { |
|
99 | + $rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names.' AS groupnames |
|
100 | + LEFT JOIN ' . $tbl_member_groups.' AS groups ON groups.user_group = groupnames.id |
|
101 | + LEFT JOIN ' . $tbl_manager_users.' AS users ON users.id = groups.member', '', 'groupnames.name, user_name'); |
|
102 | + if ($modx->db->getRecordCount($rs) < 1) { |
|
103 | 103 | ?> |
104 | 104 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
105 | 105 | <?php |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | <div class="form-group"> |
109 | 109 | <?php |
110 | 110 | $pid = ''; |
111 | - while($row = $modx->db->getRow($rs)) { |
|
112 | - if($pid != $row['id']) { |
|
113 | - if($pid != '') { |
|
111 | + while ($row = $modx->db->getRow($rs)) { |
|
112 | + if ($pid != $row['id']) { |
|
113 | + if ($pid != '') { |
|
114 | 114 | echo '</div><div class="form-group">'; |
115 | 115 | } |
116 | 116 | ?> |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | <?= $_lang['access_permissions_users_in_group'] ?> |
130 | 130 | <?php |
131 | 131 | } |
132 | - if(!$row['user_id']) { |
|
132 | + if (!$row['user_id']) { |
|
133 | 133 | ?> |
134 | 134 | <i><?= $_lang['access_permissions_no_users_in_group'] ?></i> |
135 | 135 | <?php |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | </form> |
168 | 168 | </div> |
169 | 169 | <?php |
170 | - $rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names . ' AS dgnames |
|
171 | - LEFT JOIN ' . $tbl_document_groups . ' AS dg ON dg.document_group = dgnames.id |
|
172 | - LEFT JOIN ' . $tbl_site_content . ' AS sc ON sc.id = dg.document', '', 'dgnames.name, sc.id'); |
|
173 | - if($modx->db->getRecordCount($rs) < 1) { |
|
170 | + $rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names.' AS dgnames |
|
171 | + LEFT JOIN ' . $tbl_document_groups.' AS dg ON dg.document_group = dgnames.id |
|
172 | + LEFT JOIN ' . $tbl_site_content.' AS sc ON sc.id = dg.document', '', 'dgnames.name, sc.id'); |
|
173 | + if ($modx->db->getRecordCount($rs) < 1) { |
|
174 | 174 | ?> |
175 | 175 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
176 | 176 | <?php |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | <div class="form-group"> |
180 | 180 | <?php |
181 | 181 | $pid = ''; |
182 | - while($row = $modx->db->getRow($rs)) { |
|
183 | - if($pid != $row['id']) { |
|
184 | - if($pid != '') { |
|
182 | + while ($row = $modx->db->getRow($rs)) { |
|
183 | + if ($pid != $row['id']) { |
|
184 | + if ($pid != '') { |
|
185 | 185 | echo '</div><div class="form-group">'; |
186 | 186 | } |
187 | 187 | ?> |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | <?= $_lang['access_permissions_resources_in_group'] ?> |
201 | 201 | <?php |
202 | 202 | } |
203 | - if(!$row['doc_id']) { |
|
203 | + if (!$row['doc_id']) { |
|
204 | 204 | ?> |
205 | 205 | <i><?= $_lang['access_permissions_no_resources_in_group'] ?></i> |
206 | 206 | <?php |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | <p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p> |
227 | 227 | <?php |
228 | 228 | // User/Document Group Links |
229 | - $rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names . ' AS groupnames |
|
230 | - LEFT JOIN ' . $tbl_membergroup_access . ' AS groupacc ON groupacc.membergroup = groupnames.id |
|
231 | - LEFT JOIN ' . $tbl_documentgroup_names . ' AS dgnames ON dgnames.id = groupacc.documentgroup', '', 'name, dg_name'); |
|
232 | - if($modx->db->getRecordCount($rs) < 1) { |
|
229 | + $rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names.' AS groupnames |
|
230 | + LEFT JOIN ' . $tbl_membergroup_access.' AS groupacc ON groupacc.membergroup = groupnames.id |
|
231 | + LEFT JOIN ' . $tbl_documentgroup_names.' AS dgnames ON dgnames.id = groupacc.documentgroup', '', 'name, dg_name'); |
|
232 | + if ($modx->db->getRecordCount($rs) < 1) { |
|
233 | 233 | ?> |
234 | 234 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
235 | 235 | <?php |
@@ -251,23 +251,23 @@ discard block |
||
251 | 251 | <ul> |
252 | 252 | <?php |
253 | 253 | $pid = ''; |
254 | - while($row = $modx->db->getRow($rs)) { |
|
255 | - if($row['id'] != $pid) { |
|
256 | - if($pid != '') { |
|
254 | + while ($row = $modx->db->getRow($rs)) { |
|
255 | + if ($row['id'] != $pid) { |
|
256 | + if ($pid != '') { |
|
257 | 257 | echo '</ul></li>'; |
258 | 258 | } // close previous one |
259 | 259 | ?> |
260 | 260 | <li><b><?= $row['name'] ?></b></li> |
261 | 261 | <?php |
262 | - if(!$row['dg_id']) { |
|
263 | - echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
262 | + if (!$row['dg_id']) { |
|
263 | + echo '<i>'.$_lang['no_groups_found'].'</i></li>'; |
|
264 | 264 | $pid = ''; |
265 | 265 | continue; |
266 | 266 | } else { |
267 | 267 | echo '<ul>'; |
268 | 268 | } |
269 | 269 | } |
270 | - if(!$row['dg_id']) { |
|
270 | + if (!$row['dg_id']) { |
|
271 | 271 | continue; |
272 | 272 | } |
273 | 273 | ?> |
@@ -113,31 +113,31 @@ discard block |
||
113 | 113 | // Handle Input "Search in main fields" |
114 | 114 | if ($searchfields != '') { |
115 | 115 | |
116 | - /*start search by TV. Added Rising13*/ |
|
117 | - $tbl_site_tmplvar_contentvalues = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
118 | - $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
119 | - $articul_result = $modx->db->query($articul_query); |
|
120 | - $articul_id_array = $modx->db->makeArray($articul_result); |
|
121 | - if(count($articul_id_array)>0){ |
|
122 | - $articul_id = ''; |
|
123 | - $i = 1; |
|
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
128 | - } |
|
129 | - $i++; |
|
130 | - } |
|
131 | - $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
132 | - }else{ |
|
133 | - $articul_id_query = ''; |
|
134 | - } |
|
135 | - /*end search by TV*/ |
|
116 | + /*start search by TV. Added Rising13*/ |
|
117 | + $tbl_site_tmplvar_contentvalues = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
118 | + $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
119 | + $articul_result = $modx->db->query($articul_query); |
|
120 | + $articul_id_array = $modx->db->makeArray($articul_result); |
|
121 | + if(count($articul_id_array)>0){ |
|
122 | + $articul_id = ''; |
|
123 | + $i = 1; |
|
124 | + foreach( $articul_id_array as $articul ) { |
|
125 | + $articul_id.=$articul['contentid']; |
|
126 | + if($i !== count($articul_id_array)){ |
|
127 | + $articul_id.=','; |
|
128 | + } |
|
129 | + $i++; |
|
130 | + } |
|
131 | + $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
132 | + }else{ |
|
133 | + $articul_id_query = ''; |
|
134 | + } |
|
135 | + /*end search by TV*/ |
|
136 | 136 | |
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query;//search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'"; |
158 | 158 | $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'"; |
159 | 159 | $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'"; |
160 | - $sqladd .= $articul_id_query;//search by TV |
|
160 | + $sqladd .= $articul_id_query;//search by TV |
|
161 | 161 | } |
162 | 162 | } else if ($idFromAlias) { |
163 | 163 | $sqladd .= " sc.id='{$idFromAlias}'"; |
@@ -1,5 +1,5 @@ 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 | exit(); |
4 | 4 | } |
5 | 5 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $option[] = '<option value="">No selected</option>'; |
44 | 44 | $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? intval($_REQUEST['templateid']) : ''; |
45 | 45 | $selected = $templateid === 0 ? ' selected="selected"' : ''; |
46 | - $option[] = '<option value="0"' . $selected . '>(blank)</option>'; |
|
46 | + $option[] = '<option value="0"'.$selected.'>(blank)</option>'; |
|
47 | 47 | while ($row = $modx->db->getRow($rs)) { |
48 | 48 | $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']); |
49 | 49 | $selected = $row['id'] == $templateid ? ' selected="selected"' : ''; |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | $friendly_url_suffix = $modx->config['friendly_url_suffix']; |
101 | 101 | $base_url = $modx->config['base_url']; |
102 | 102 | $site_url = $modx->config['site_url']; |
103 | - $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url); |
|
103 | + $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url); |
|
104 | 104 | if ($url[0] === '/') { |
105 | - $url = preg_replace('@^' . $base_url . '@', '', $url); |
|
105 | + $url = preg_replace('@^'.$base_url.'@', '', $url); |
|
106 | 106 | } |
107 | 107 | if (substr($url, 0, 4) === 'http') { |
108 | - $url = preg_replace('@^' . $site_url . '@', '', $url); |
|
108 | + $url = preg_replace('@^'.$site_url.'@', '', $url); |
|
109 | 109 | } |
110 | 110 | $idFromAlias = $modx->getIdFromAlias($url); |
111 | 111 | } |
@@ -118,18 +118,18 @@ discard block |
||
118 | 118 | $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
119 | 119 | $articul_result = $modx->db->query($articul_query); |
120 | 120 | $articul_id_array = $modx->db->makeArray($articul_result); |
121 | - if(count($articul_id_array)>0){ |
|
121 | + if (count($articul_id_array) > 0) { |
|
122 | 122 | $articul_id = ''; |
123 | 123 | $i = 1; |
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
124 | + foreach ($articul_id_array as $articul) { |
|
125 | + $articul_id .= $articul['contentid']; |
|
126 | + if ($i !== count($articul_id_array)) { |
|
127 | + $articul_id .= ','; |
|
128 | 128 | } |
129 | 129 | $i++; |
130 | 130 | } |
131 | 131 | $articul_id_query = " OR sc.id IN ({$articul_id})"; |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $articul_id_query = ''; |
134 | 134 | } |
135 | 135 | /*end search by TV*/ |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query; //search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'"; |
158 | 158 | $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'"; |
159 | 159 | $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'"; |
160 | - $sqladd .= $articul_id_query;//search by TV |
|
160 | + $sqladd .= $articul_id_query; //search by TV |
|
161 | 161 | } |
162 | 162 | } else if ($idFromAlias) { |
163 | 163 | $sqladd .= " sc.id='{$idFromAlias}'"; |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
181 | 181 | $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0; |
182 | 182 | $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : ''; |
183 | - $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess'; |
|
184 | - $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
183 | + $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess'; |
|
184 | + $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | if ($sqladd) { |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $where = $sqladd; |
192 | 192 | |
193 | 193 | if ($where) { |
194 | - $rs = $modx->db->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
194 | + $rs = $modx->db->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
195 | 195 | $limit = $modx->db->getRecordCount($rs); |
196 | 196 | } else { |
197 | 197 | $limit = 0; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if ($limit < 1) { |
211 | 211 | echo $_lang['search_empty']; |
212 | 212 | } else { |
213 | - printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit); |
|
213 | + printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit); |
|
214 | 214 | ?> |
215 | 215 | <script type="text/javascript" src="media/script/tablesort.js"></script> |
216 | 216 | <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1"> |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | if (function_exists('mb_strlen') && function_exists('mb_substr')) { |
271 | 271 | ?> |
272 | 272 | <td<?= $tdClass ?>> |
273 | - <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset) . "..." : $row['pagetitle'] ?></a> |
|
273 | + <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset)."..." : $row['pagetitle'] ?></a> |
|
274 | 274 | </td> |
275 | - <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset) . "..." : $row['description'] ?></td> |
|
275 | + <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset)."..." : $row['description'] ?></td> |
|
276 | 276 | <?php |
277 | 277 | } else { |
278 | 278 | ?> |
279 | - <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td> |
|
280 | - <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td> |
|
279 | + <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td> |
|
280 | + <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td> |
|
281 | 281 | <?php |
282 | 282 | } |
283 | 283 | ?> |
@@ -297,115 +297,115 @@ discard block |
||
297 | 297 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
298 | 298 | $docscounts = $modx->db->getRecordCount($rs); |
299 | 299 | if ($docscounts > 0) { |
300 | - $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>'; |
|
300 | + $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>'; |
|
301 | 301 | while ($row = $modx->db->getRow($rs)) { |
302 | - $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '><a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['pagetitle'] . ' <small>(' . $row['id'] . ')</small>', $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
302 | + $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'><a href="index.php?a=27&id='.$row['id'].'" id="content_'.$row['id'].'" target="main">'.highlightingCoincidence($row['pagetitle'].' <small>('.$row['id'].')</small>', $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | 307 | //templates |
308 | 308 | if ($modx->hasPermission('edit_template')) { |
309 | - $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' |
|
310 | - OR `templatename` like '%" . $searchfields . "%' |
|
311 | - OR `description` like '%" . $searchfields . "%' |
|
312 | - OR `content` like '%" . $searchfields . "%'"); |
|
309 | + $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' |
|
310 | + OR `templatename` like '%" . $searchfields."%' |
|
311 | + OR `description` like '%" . $searchfields."%' |
|
312 | + OR `content` like '%" . $searchfields."%'"); |
|
313 | 313 | $templatecounts = $modx->db->getRecordCount($rs); |
314 | 314 | if ($templatecounts > 0) { |
315 | - $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>'; |
|
315 | + $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>'; |
|
316 | 316 | while ($row = $modx->db->getRow($rs)) { |
317 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
317 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | 322 | //tvs |
323 | 323 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
324 | - $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%" . $searchfields . "%' |
|
325 | - OR `name` like '%" . $searchfields . "%' |
|
326 | - OR `description` like '%" . $searchfields . "%' |
|
327 | - OR `type` like '%" . $searchfields . "%' |
|
328 | - OR `elements` like '%" . $searchfields . "%' |
|
329 | - OR `display` like '%" . $searchfields . "%' |
|
330 | - OR `display_params` like '%" . $searchfields . "%' |
|
331 | - OR `default_text` like '%" . $searchfields . "%'"); |
|
324 | + $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%".$searchfields."%' |
|
325 | + OR `name` like '%" . $searchfields."%' |
|
326 | + OR `description` like '%" . $searchfields."%' |
|
327 | + OR `type` like '%" . $searchfields."%' |
|
328 | + OR `elements` like '%" . $searchfields."%' |
|
329 | + OR `display` like '%" . $searchfields."%' |
|
330 | + OR `display_params` like '%" . $searchfields."%' |
|
331 | + OR `default_text` like '%" . $searchfields."%'"); |
|
332 | 332 | $tvscounts = $modx->db->getRecordCount($rs); |
333 | 333 | if ($tvscounts > 0) { |
334 | - $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>'; |
|
334 | + $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>'; |
|
335 | 335 | while ($row = $modx->db->getRow($rs)) { |
336 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
336 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
341 | 341 | //Chunks |
342 | 342 | if ($modx->hasPermission('edit_chunk')) { |
343 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%" . $searchfields . "%' |
|
344 | - OR `name` like '%" . $searchfields . "%' |
|
345 | - OR `description` like '%" . $searchfields . "%' |
|
346 | - OR `snippet` like '%" . $searchfields . "%'"); |
|
343 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%".$searchfields."%' |
|
344 | + OR `name` like '%" . $searchfields."%' |
|
345 | + OR `description` like '%" . $searchfields."%' |
|
346 | + OR `snippet` like '%" . $searchfields."%'"); |
|
347 | 347 | $chunkscounts = $modx->db->getRecordCount($rs); |
348 | 348 | if ($chunkscounts > 0) { |
349 | - $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>'; |
|
349 | + $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>'; |
|
350 | 350 | while ($row = $modx->db->getRow($rs)) { |
351 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
351 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | 356 | //Snippets |
357 | 357 | if ($modx->hasPermission('edit_snippet')) { |
358 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%" . $searchfields . "%' |
|
359 | - OR `name` like '%" . $searchfields . "%' |
|
360 | - OR `description` like '%" . $searchfields . "%' |
|
361 | - OR `snippet` like '%" . $searchfields . "%' |
|
362 | - OR `properties` like '%" . $searchfields . "%' |
|
363 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
358 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%".$searchfields."%' |
|
359 | + OR `name` like '%" . $searchfields."%' |
|
360 | + OR `description` like '%" . $searchfields."%' |
|
361 | + OR `snippet` like '%" . $searchfields."%' |
|
362 | + OR `properties` like '%" . $searchfields."%' |
|
363 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
364 | 364 | $snippetscounts = $modx->db->getRecordCount($rs); |
365 | 365 | if ($snippetscounts > 0) { |
366 | - $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>'; |
|
366 | + $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>'; |
|
367 | 367 | while ($row = $modx->db->getRow($rs)) { |
368 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
368 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | 373 | //plugins |
374 | 374 | if ($modx->hasPermission('edit_plugin')) { |
375 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%" . $searchfields . "%' |
|
376 | - OR `name` like '%" . $searchfields . "%' |
|
377 | - OR `description` like '%" . $searchfields . "%' |
|
378 | - OR `plugincode` like '%" . $searchfields . "%' |
|
379 | - OR `properties` like '%" . $searchfields . "%' |
|
380 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
375 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%".$searchfields."%' |
|
376 | + OR `name` like '%" . $searchfields."%' |
|
377 | + OR `description` like '%" . $searchfields."%' |
|
378 | + OR `plugincode` like '%" . $searchfields."%' |
|
379 | + OR `properties` like '%" . $searchfields."%' |
|
380 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
381 | 381 | $pluginscounts = $modx->db->getRecordCount($rs); |
382 | 382 | if ($pluginscounts > 0) { |
383 | - $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>'; |
|
383 | + $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>'; |
|
384 | 384 | while ($row = $modx->db->getRow($rs)) { |
385 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
385 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
390 | 390 | //modules |
391 | 391 | if ($modx->hasPermission('edit_module')) { |
392 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%" . $searchfields . "%' |
|
393 | - OR `name` like '%" . $searchfields . "%' |
|
394 | - OR `description` like '%" . $searchfields . "%' |
|
395 | - OR `modulecode` like '%" . $searchfields . "%' |
|
396 | - OR `properties` like '%" . $searchfields . "%' |
|
397 | - OR `guid` like '%" . $searchfields . "%' |
|
398 | - OR `resourcefile` like '%" . $searchfields . "%'"); |
|
392 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%".$searchfields."%' |
|
393 | + OR `name` like '%" . $searchfields."%' |
|
394 | + OR `description` like '%" . $searchfields."%' |
|
395 | + OR `modulecode` like '%" . $searchfields."%' |
|
396 | + OR `properties` like '%" . $searchfields."%' |
|
397 | + OR `guid` like '%" . $searchfields."%' |
|
398 | + OR `resourcefile` like '%" . $searchfields."%'"); |
|
399 | 399 | $modulescounts = $modx->db->getRecordCount($rs); |
400 | 400 | if ($modulescounts > 0) { |
401 | - $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>'; |
|
401 | + $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>'; |
|
402 | 402 | while ($row = $modx->db->getRow($rs)) { |
403 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
403 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
408 | - echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1'; |
|
408 | + echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1'; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | ?> |
@@ -416,13 +416,13 @@ discard block |
||
416 | 416 | |
417 | 417 | function highlightingCoincidence($text, $search) |
418 | 418 | { |
419 | - $regexp = '!(' . str_replace(array( |
|
419 | + $regexp = '!('.str_replace(array( |
|
420 | 420 | '(', |
421 | 421 | ')' |
422 | 422 | ), array( |
423 | 423 | '\(', |
424 | 424 | '\)' |
425 | - ), trim($search)) . ')!isu'; |
|
425 | + ), trim($search)).')!isu'; |
|
426 | 426 | return preg_replace($regexp, '<span class="text-danger">$1</span>', $text); |
427 | 427 | } |
428 | 428 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $class .= ' deleted'; |
440 | 440 | } |
441 | 441 | if ($class) { |
442 | - $class = ' class="' . trim($class) . '"'; |
|
442 | + $class = ' class="'.trim($class).'"'; |
|
443 | 443 | } |
444 | 444 | return $class; |
445 | 445 | } |
@@ -118,18 +118,18 @@ |
||
118 | 118 | $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
119 | 119 | $articul_result = $modx->db->query($articul_query); |
120 | 120 | $articul_id_array = $modx->db->makeArray($articul_result); |
121 | - if(count($articul_id_array)>0){ |
|
121 | + if(count($articul_id_array)>0) { |
|
122 | 122 | $articul_id = ''; |
123 | 123 | $i = 1; |
124 | 124 | foreach( $articul_id_array as $articul ) { |
125 | 125 | $articul_id.=$articul['contentid']; |
126 | - if($i !== count($articul_id_array)){ |
|
126 | + if($i !== count($articul_id_array)) { |
|
127 | 127 | $articul_id.=','; |
128 | 128 | } |
129 | 129 | $i++; |
130 | 130 | } |
131 | 131 | $articul_id_query = " OR sc.id IN ({$articul_id})"; |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $articul_id_query = ''; |
134 | 134 | } |
135 | 135 | /*end search by TV*/ |
@@ -1,9 +1,9 @@ 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 | if(!$modx->hasPermission('view_eventlog')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // Get table Names (alphabetical) |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | |
17 | 17 | // get and save search string |
18 | 18 | if($_REQUEST['op'] == 'reset') { |
19 | - $sqlQuery = $query = ''; |
|
20 | - $_PAGE['vs']['search'] = ''; |
|
19 | + $sqlQuery = $query = ''; |
|
20 | + $_PAGE['vs']['search'] = ''; |
|
21 | 21 | } else { |
22 | - $sqlQuery = $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
|
23 | - if(!is_numeric($sqlQuery)) { |
|
24 | - $sqlQuery = $modx->db->escape($query); |
|
25 | - } |
|
26 | - $_PAGE['vs']['search'] = $query; |
|
22 | + $sqlQuery = $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
|
23 | + if(!is_numeric($sqlQuery)) { |
|
24 | + $sqlQuery = $modx->db->escape($query); |
|
25 | + } |
|
26 | + $_PAGE['vs']['search'] = $query; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // get & save listmode |
@@ -125,33 +125,33 @@ discard block |
||
125 | 125 | <div class="row"> |
126 | 126 | <div class="table-responsive"> |
127 | 127 | <?php |
128 | - $ds = $modx->db->select("el.id, ELT(el.type , 'text-info {$_style['actions_info']}' , 'text-warning {$_style['actions_triangle']}' , 'text-danger {$_style['actions_error']}' ) as icon, el.createdon, el.source, el.eventid,IFNULL(wu.username,mu.username) as username", "{$tbl_event_log} AS el |
|
128 | + $ds = $modx->db->select("el.id, ELT(el.type , 'text-info {$_style['actions_info']}' , 'text-warning {$_style['actions_triangle']}' , 'text-danger {$_style['actions_error']}' ) as icon, el.createdon, el.source, el.eventid,IFNULL(wu.username,mu.username) as username", "{$tbl_event_log} AS el |
|
129 | 129 | LEFT JOIN {$tbl_manager_users} AS mu ON mu.id=el.user AND el.usertype=0 |
130 | 130 | LEFT JOIN {$tbl_web_users} AS wu ON wu.id=el.user AND el.usertype=1", ($sqlQuery ? "" . (is_numeric($sqlQuery) ? "(eventid='{$sqlQuery}') OR " : '') . "(source LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "createdon DESC"); |
131 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
132 | - $grd = new DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items |
|
133 | - $grd->pagerClass = ''; |
|
134 | - $grd->pageClass = 'page-item'; |
|
135 | - $grd->selPageClass = 'page-item active'; |
|
136 | - $grd->noRecordMsg = $_lang['no_records_found']; |
|
137 | - $grd->cssClass = "table data nowrap"; |
|
138 | - $grd->columnHeaderClass = "tableHeader"; |
|
139 | - $grd->itemClass = "tableItem"; |
|
140 | - $grd->altItemClass = "tableAltItem"; |
|
141 | - $grd->fields = "type,source,createdon,eventid,username"; |
|
142 | - $grd->columns = $_lang['type'] . " ," . $_lang['source'] . " ," . $_lang['date'] . " ," . $_lang['event_id'] . " ," . $_lang['sysinfo_userid']; |
|
143 | - $grd->colWidths = "1%,,1%,1%,1%"; |
|
144 | - $grd->colAligns = "center,,,center,center"; |
|
145 | - $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang['click_to_context'] . "'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='" . $_lang['click_to_view_details'] . "'>[+source+]</a>||date: " . $modx->toDateFormat(null, 'formatOnly') . ' %I:%M %p'; |
|
146 | - if($listmode == '1') { |
|
147 | - $grd->pageSize = 0; |
|
148 | - } |
|
149 | - if($_REQUEST['op'] == 'reset') { |
|
150 | - $grd->pageNumber = 1; |
|
151 | - } |
|
152 | - // render grid |
|
153 | - echo $grd->render(); |
|
154 | - ?> |
|
131 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
132 | + $grd = new DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items |
|
133 | + $grd->pagerClass = ''; |
|
134 | + $grd->pageClass = 'page-item'; |
|
135 | + $grd->selPageClass = 'page-item active'; |
|
136 | + $grd->noRecordMsg = $_lang['no_records_found']; |
|
137 | + $grd->cssClass = "table data nowrap"; |
|
138 | + $grd->columnHeaderClass = "tableHeader"; |
|
139 | + $grd->itemClass = "tableItem"; |
|
140 | + $grd->altItemClass = "tableAltItem"; |
|
141 | + $grd->fields = "type,source,createdon,eventid,username"; |
|
142 | + $grd->columns = $_lang['type'] . " ," . $_lang['source'] . " ," . $_lang['date'] . " ," . $_lang['event_id'] . " ," . $_lang['sysinfo_userid']; |
|
143 | + $grd->colWidths = "1%,,1%,1%,1%"; |
|
144 | + $grd->colAligns = "center,,,center,center"; |
|
145 | + $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang['click_to_context'] . "'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='" . $_lang['click_to_view_details'] . "'>[+source+]</a>||date: " . $modx->toDateFormat(null, 'formatOnly') . ' %I:%M %p'; |
|
146 | + if($listmode == '1') { |
|
147 | + $grd->pageSize = 0; |
|
148 | + } |
|
149 | + if($_REQUEST['op'] == 'reset') { |
|
150 | + $grd->pageNumber = 1; |
|
151 | + } |
|
152 | + // render grid |
|
153 | + echo $grd->render(); |
|
154 | + ?> |
|
155 | 155 | </div> |
156 | 156 | </div> |
157 | 157 | </div> |
@@ -1,8 +1,8 @@ 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 | -if(!$modx->hasPermission('view_eventlog')) { |
|
5 | +if (!$modx->hasPermission('view_eventlog')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | $modx->manager->initPageViewState(); |
16 | 16 | |
17 | 17 | // get and save search string |
18 | -if($_REQUEST['op'] == 'reset') { |
|
18 | +if ($_REQUEST['op'] == 'reset') { |
|
19 | 19 | $sqlQuery = $query = ''; |
20 | 20 | $_PAGE['vs']['search'] = ''; |
21 | 21 | } else { |
22 | 22 | $sqlQuery = $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
23 | - if(!is_numeric($sqlQuery)) { |
|
23 | + if (!is_numeric($sqlQuery)) { |
|
24 | 24 | $sqlQuery = $modx->db->escape($query); |
25 | 25 | } |
26 | 26 | $_PAGE['vs']['search'] = $query; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $_PAGE['vs']['lm'] = $listmode; |
32 | 32 | |
33 | 33 | // context menu |
34 | -include_once MODX_MANAGER_PATH . "includes/controls/contextmenu.php"; |
|
34 | +include_once MODX_MANAGER_PATH."includes/controls/contextmenu.php"; |
|
35 | 35 | $cm = new ContextMenu("cntxm", 150); |
36 | 36 | $cm->addItem($_lang['view_log'], "js:menuAction(1)", $_style['actions_preview']); |
37 | 37 | $cm->addSeparator(); |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | <?php |
128 | 128 | $ds = $modx->db->select("el.id, ELT(el.type , 'text-info {$_style['actions_info']}' , 'text-warning {$_style['actions_triangle']}' , 'text-danger {$_style['actions_error']}' ) as icon, el.createdon, el.source, el.eventid,IFNULL(wu.username,mu.username) as username", "{$tbl_event_log} AS el |
129 | 129 | LEFT JOIN {$tbl_manager_users} AS mu ON mu.id=el.user AND el.usertype=0 |
130 | - LEFT JOIN {$tbl_web_users} AS wu ON wu.id=el.user AND el.usertype=1", ($sqlQuery ? "" . (is_numeric($sqlQuery) ? "(eventid='{$sqlQuery}') OR " : '') . "(source LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "createdon DESC"); |
|
131 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
130 | + LEFT JOIN {$tbl_web_users} AS wu ON wu.id=el.user AND el.usertype=1", ($sqlQuery ? "".(is_numeric($sqlQuery) ? "(eventid='{$sqlQuery}') OR " : '')."(source LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "createdon DESC"); |
|
131 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
132 | 132 | $grd = new DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items |
133 | 133 | $grd->pagerClass = ''; |
134 | 134 | $grd->pageClass = 'page-item'; |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | $grd->itemClass = "tableItem"; |
140 | 140 | $grd->altItemClass = "tableAltItem"; |
141 | 141 | $grd->fields = "type,source,createdon,eventid,username"; |
142 | - $grd->columns = $_lang['type'] . " ," . $_lang['source'] . " ," . $_lang['date'] . " ," . $_lang['event_id'] . " ," . $_lang['sysinfo_userid']; |
|
142 | + $grd->columns = $_lang['type']." ,".$_lang['source']." ,".$_lang['date']." ,".$_lang['event_id']." ,".$_lang['sysinfo_userid']; |
|
143 | 143 | $grd->colWidths = "1%,,1%,1%,1%"; |
144 | 144 | $grd->colAligns = "center,,,center,center"; |
145 | - $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang['click_to_context'] . "'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='" . $_lang['click_to_view_details'] . "'>[+source+]</a>||date: " . $modx->toDateFormat(null, 'formatOnly') . ' %I:%M %p'; |
|
146 | - if($listmode == '1') { |
|
145 | + $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='".$_lang['click_to_context']."'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='".$_lang['click_to_view_details']."'>[+source+]</a>||date: ".$modx->toDateFormat(null, 'formatOnly').' %I:%M %p'; |
|
146 | + if ($listmode == '1') { |
|
147 | 147 | $grd->pageSize = 0; |
148 | 148 | } |
149 | - if($_REQUEST['op'] == 'reset') { |
|
149 | + if ($_REQUEST['op'] == 'reset') { |
|
150 | 150 | $grd->pageNumber = 1; |
151 | 151 | } |
152 | 152 | // render grid |
@@ -1,8 +1,8 @@ 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 | -if(!$modx->hasPermission('view_eventlog')) { |
|
5 | +if(!$modx->hasPermission('view_eventlog')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | $modx->manager->initPageViewState(); |
16 | 16 | |
17 | 17 | // get and save search string |
18 | -if($_REQUEST['op'] == 'reset') { |
|
18 | +if($_REQUEST['op'] == 'reset') { |
|
19 | 19 | $sqlQuery = $query = ''; |
20 | 20 | $_PAGE['vs']['search'] = ''; |
21 | -} else { |
|
21 | +} else { |
|
22 | 22 | $sqlQuery = $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
23 | - if(!is_numeric($sqlQuery)) { |
|
23 | + if(!is_numeric($sqlQuery)) { |
|
24 | 24 | $sqlQuery = $modx->db->escape($query); |
25 | 25 | } |
26 | 26 | $_PAGE['vs']['search'] = $query; |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | $grd->colWidths = "1%,,1%,1%,1%"; |
144 | 144 | $grd->colAligns = "center,,,center,center"; |
145 | 145 | $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang['click_to_context'] . "'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='" . $_lang['click_to_view_details'] . "'>[+source+]</a>||date: " . $modx->toDateFormat(null, 'formatOnly') . ' %I:%M %p'; |
146 | - if($listmode == '1') { |
|
146 | + if($listmode == '1') { |
|
147 | 147 | $grd->pageSize = 0; |
148 | 148 | } |
149 | - if($_REQUEST['op'] == 'reset') { |
|
149 | + if($_REQUEST['op'] == 'reset') { |
|
150 | 150 | $grd->pageNumber = 1; |
151 | 151 | } |
152 | 152 | // render grid |
@@ -1,13 +1,13 @@ 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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | 8 | if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
9 | - // seems to be a new install - send the user to the configuration page |
|
10 | - exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
|
9 | + // seems to be a new install - send the user to the configuration page |
|
10 | + exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // set placeholders |
@@ -17,70 +17,70 @@ discard block |
||
17 | 17 | |
18 | 18 | // setup message info |
19 | 19 | if($modx->hasPermission('messages')) { |
20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
21 | - $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
22 | - $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
23 | - |
|
24 | - $msg = array(); |
|
25 | - $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
|
26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
27 | - $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
|
28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
29 | - $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
30 | - $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
|
31 | - $ph['MessageInfo'] = join("\n", $msg); |
|
20 | + include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
21 | + $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
22 | + $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
23 | + |
|
24 | + $msg = array(); |
|
25 | + $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
|
26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
27 | + $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
|
28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
29 | + $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
30 | + $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
|
31 | + $ph['MessageInfo'] = join("\n", $msg); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | // setup icons |
35 | 35 | if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
36 | - $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
37 | - $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
36 | + $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
37 | + $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
38 | 38 | } |
39 | 39 | if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
40 | - $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
41 | - $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
40 | + $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
41 | + $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
42 | 42 | } |
43 | 43 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
44 | - $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
45 | - $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
44 | + $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
45 | + $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
46 | 46 | } |
47 | 47 | if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
48 | - $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
49 | - $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
48 | + $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
49 | + $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
50 | 50 | } |
51 | 51 | if($modx->hasPermission('bk_manager')) { |
52 | - $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
53 | - $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
52 | + $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
53 | + $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
54 | 54 | } |
55 | 55 | if($modx->hasPermission('help')) { |
56 | - $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
57 | - $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
56 | + $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
57 | + $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
58 | 58 | } |
59 | 59 | // do some config checks |
60 | 60 | if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
62 | - if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | - $ph['config_check_results'] = $config_check_results; |
|
64 | - $ph['config_display'] = 'block'; |
|
65 | - } else { |
|
66 | - $ph['config_display'] = 'none'; |
|
67 | - } |
|
61 | + include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | + $ph['config_check_results'] = $config_check_results; |
|
64 | + $ph['config_display'] = 'block'; |
|
65 | + } else { |
|
66 | + $ph['config_display'] = 'none'; |
|
67 | + } |
|
68 | 68 | } else { |
69 | - $ph['config_display'] = 'none'; |
|
69 | + $ph['config_display'] = 'none'; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check logout-reminder |
73 | 73 | if(isset($_SESSION['show_logout_reminder'])) { |
74 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | - case 'logout_reminder': |
|
76 | - $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
77 | - $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
|
78 | - break; |
|
79 | - } |
|
80 | - $ph['show_logout_reminder'] = 'block'; |
|
81 | - unset($_SESSION['show_logout_reminder']); |
|
74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | + case 'logout_reminder': |
|
76 | + $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
77 | + $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
|
78 | + break; |
|
79 | + } |
|
80 | + $ph['show_logout_reminder'] = 'block'; |
|
81 | + unset($_SESSION['show_logout_reminder']); |
|
82 | 82 | } else { |
83 | - $ph['show_logout_reminder'] = 'none'; |
|
83 | + $ph['show_logout_reminder'] = 'none'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Check multiple sessions |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
129 | 129 | |
130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
131 | - 'username' => $modx->getLoginUserName(), |
|
132 | - 'role' => $_SESSION['mgrPermissions']['name'], |
|
133 | - 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
134 | - 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
135 | - 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
131 | + 'username' => $modx->getLoginUserName(), |
|
132 | + 'role' => $_SESSION['mgrPermissions']['name'], |
|
133 | + 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
134 | + 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
135 | + 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
136 | 136 | )); |
137 | 137 | |
138 | 138 | $from = array(); |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC'); |
142 | 142 | |
143 | 143 | if($modx->db->getRecordCount($rs) < 1) { |
144 | - $html = '<p>[%no_active_users_found%]</p>'; |
|
144 | + $html = '<p>[%no_active_users_found%]</p>'; |
|
145 | 145 | } else { |
146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
147 | - $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
148 | - $ph['now'] = strftime('%H:%M:%S', $now); |
|
149 | - $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
150 | - $html = ' |
|
146 | + include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
147 | + $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
148 | + $ph['now'] = strftime('%H:%M:%S', $now); |
|
149 | + $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
150 | + $html = ' |
|
151 | 151 | <div class="card-body"> |
152 | 152 | [%onlineusers_message%] |
153 | 153 | <b>[+now+]</b>): |
@@ -165,33 +165,33 @@ discard block |
||
165 | 165 | </thead> |
166 | 166 | <tbody>'; |
167 | 167 | |
168 | - $userList = array(); |
|
169 | - $userCount = array(); |
|
170 | - // Create userlist with session-count first before output |
|
171 | - while($activeusers = $modx->db->getRow($rs)) { |
|
172 | - $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
173 | - |
|
174 | - $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
175 | - $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
176 | - $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
177 | - $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
178 | - $userList[] = array( |
|
179 | - $idle, |
|
180 | - '', |
|
181 | - $activeusers['username'], |
|
182 | - $webicon, |
|
183 | - abs($activeusers['internalKey']), |
|
184 | - $ip, |
|
185 | - strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time), |
|
186 | - $currentaction |
|
187 | - ); |
|
188 | - } |
|
189 | - foreach($userList as $params) { |
|
190 | - $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
192 | - } |
|
193 | - |
|
194 | - $html .= ' |
|
168 | + $userList = array(); |
|
169 | + $userCount = array(); |
|
170 | + // Create userlist with session-count first before output |
|
171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
172 | + $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
173 | + |
|
174 | + $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
175 | + $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
176 | + $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
177 | + $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
178 | + $userList[] = array( |
|
179 | + $idle, |
|
180 | + '', |
|
181 | + $activeusers['username'], |
|
182 | + $webicon, |
|
183 | + abs($activeusers['internalKey']), |
|
184 | + $ip, |
|
185 | + strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time), |
|
186 | + $currentaction |
|
187 | + ); |
|
188 | + } |
|
189 | + foreach($userList as $params) { |
|
190 | + $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
191 | + $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
192 | + } |
|
193 | + |
|
194 | + $html .= ' |
|
195 | 195 | </tbody> |
196 | 196 | </table> |
197 | 197 | </div> |
@@ -232,17 +232,17 @@ discard block |
||
232 | 232 | // invoke event OnManagerWelcomePrerender |
233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
234 | 234 | if(is_array($evtOut)) { |
235 | - $output = implode('', $evtOut); |
|
236 | - $ph['OnManagerWelcomePrerender'] = $output; |
|
235 | + $output = implode('', $evtOut); |
|
236 | + $ph['OnManagerWelcomePrerender'] = $output; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | $widgets['welcome'] = array( |
240 | - 'menuindex' => '10', |
|
241 | - 'id' => 'welcome', |
|
242 | - 'cols' => 'col-sm-6', |
|
243 | - 'icon' => 'fa-home', |
|
244 | - 'title' => '[%welcome_title%]', |
|
245 | - 'body' => ' |
|
240 | + 'menuindex' => '10', |
|
241 | + 'id' => 'welcome', |
|
242 | + 'cols' => 'col-sm-6', |
|
243 | + 'icon' => 'fa-home', |
|
244 | + 'title' => '[%welcome_title%]', |
|
245 | + 'body' => ' |
|
246 | 246 | <div class="wm_buttons card-body"> |
247 | 247 | <!--@IF:[[#hasPermission?key=new_user]] OR [[#hasPermission?key=edit_user]]--> |
248 | 248 | <span class="wm_button"> |
@@ -320,25 +320,25 @@ discard block |
||
320 | 320 | </table> |
321 | 321 | </div> |
322 | 322 | ', |
323 | - 'hide'=>'0' |
|
323 | + 'hide'=>'0' |
|
324 | 324 | ); |
325 | 325 | $widgets['onlineinfo'] = array( |
326 | - 'menuindex' => '20', |
|
327 | - 'id' => 'onlineinfo', |
|
328 | - 'cols' => 'col-sm-6', |
|
329 | - 'icon' => 'fa-user', |
|
330 | - 'title' => '[%onlineusers_title%]', |
|
331 | - 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
332 | - 'hide'=>'0' |
|
326 | + 'menuindex' => '20', |
|
327 | + 'id' => 'onlineinfo', |
|
328 | + 'cols' => 'col-sm-6', |
|
329 | + 'icon' => 'fa-user', |
|
330 | + 'title' => '[%onlineusers_title%]', |
|
331 | + 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
332 | + 'hide'=>'0' |
|
333 | 333 | ); |
334 | 334 | $widgets['recentinfo'] = array( |
335 | - 'menuindex' => '30', |
|
336 | - 'id' => 'modxrecent_widget', |
|
337 | - 'cols' => 'col-sm-12', |
|
338 | - 'icon' => 'fa-pencil-square-o', |
|
339 | - 'title' => '[%activity_title%]', |
|
340 | - 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
341 | - 'hide'=>'0' |
|
335 | + 'menuindex' => '30', |
|
336 | + 'id' => 'modxrecent_widget', |
|
337 | + 'cols' => 'col-sm-12', |
|
338 | + 'icon' => 'fa-pencil-square-o', |
|
339 | + 'title' => '[%activity_title%]', |
|
340 | + 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
341 | + 'hide'=>'0' |
|
342 | 342 | ); |
343 | 343 | if ($modx->config['rss_url_news']) { |
344 | 344 | $widgets['news'] = array( |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | // invoke OnManagerWelcomeHome event |
367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
368 | 368 | if(is_array($sitewidgets)) { |
369 | - $newwidgets = array(); |
|
369 | + $newwidgets = array(); |
|
370 | 370 | foreach($sitewidgets as $widget){ |
371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
372 | 372 | } |
@@ -374,21 +374,21 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | usort($widgets, function ($a, $b) { |
377 | - return $a['menuindex'] - $b['menuindex']; |
|
377 | + return $a['menuindex'] - $b['menuindex']; |
|
378 | 378 | }); |
379 | 379 | |
380 | 380 | $tpl = getTplWidget(); |
381 | 381 | $output = ''; |
382 | 382 | foreach($widgets as $widget) { |
383 | - if ($widget['hide'] != '1'){ |
|
384 | - $output .= $modx->parseText($tpl, $widget); |
|
385 | - } |
|
383 | + if ($widget['hide'] != '1'){ |
|
384 | + $output .= $modx->parseText($tpl, $widget); |
|
385 | + } |
|
386 | 386 | } |
387 | 387 | $ph['widgets'] = $output; |
388 | 388 | |
389 | 389 | // load template |
390 | 390 | if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
@@ -396,27 +396,27 @@ discard block |
||
396 | 396 | $target = $modx->mergeSettingsContent($target); |
397 | 397 | |
398 | 398 | if(substr($target, 0, 1) === '@') { |
399 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | - $content = $modx->getChunk(trim(substr($target, 7))); |
|
401 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | - $content = file_get_contents(trim(substr($target, 6))); |
|
403 | - } else { |
|
404 | - $content = ''; |
|
405 | - } |
|
399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | + $content = $modx->getChunk(trim(substr($target, 7))); |
|
401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | + $content = file_get_contents(trim(substr($target, 6))); |
|
403 | + } else { |
|
404 | + $content = ''; |
|
405 | + } |
|
406 | 406 | } else { |
407 | - $chunk = $modx->getChunk($target); |
|
408 | - if($chunk !== false && !empty($chunk)) { |
|
409 | - $content = $chunk; |
|
410 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
415 | - { |
|
416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | - } else { |
|
418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
419 | - } |
|
407 | + $chunk = $modx->getChunk($target); |
|
408 | + if($chunk !== false && !empty($chunk)) { |
|
409 | + $content = $chunk; |
|
410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | + $content = file_get_contents(MODX_BASE_PATH . $target); |
|
412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
415 | + { |
|
416 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | + } else { |
|
418 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
419 | + } |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | // merge placeholders |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | $content = $modx->mergeSettingsContent($content); |
425 | 425 | $content = $modx->parseText($content, $ph); |
426 | 426 | if(strpos($content, '[+') !== false) { |
427 | - $modx->toPlaceholders($ph); |
|
428 | - $content = $modx->mergePlaceholderContent($content); |
|
427 | + $modx->toPlaceholders($ph); |
|
428 | + $content = $modx->mergePlaceholderContent($content); |
|
429 | 429 | } |
430 | 430 | $content = $modx->parseDocumentSource($content); |
431 | 431 | $content = $modx->parseText($content, $_lang, '[%', '%]'); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
434 | 434 | |
435 | 435 | if($js = $modx->getRegisteredClientScripts()) { |
436 | - $content .= $js; |
|
436 | + $content .= $js; |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | echo $content; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
444 | 444 | //</span> |
445 | 445 | function getTplWidget() { // recent document info |
446 | - return ' |
|
446 | + return ' |
|
447 | 447 | <div class="[+cols+]" id="[+id+]"> |
448 | 448 | <div class="card"[+cardAttr+]> |
449 | 449 | <div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div> |
@@ -454,11 +454,11 @@ discard block |
||
454 | 454 | } |
455 | 455 | |
456 | 456 | function getRecentInfo() { // recent document info |
457 | - global $modx; |
|
457 | + global $modx; |
|
458 | 458 | |
459 | - $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
|
459 | + $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
|
460 | 460 | |
461 | - $html = ' |
|
461 | + $html = ' |
|
462 | 462 | <div class="table-responsive"> |
463 | 463 | <table class="table data"> |
464 | 464 | <thead> |
@@ -476,96 +476,96 @@ discard block |
||
476 | 476 | </table> |
477 | 477 | </div> |
478 | 478 | '; |
479 | - return $html; |
|
479 | + return $html; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | function getRecentInfoList() { |
483 | - global $modx; |
|
484 | - |
|
485 | - $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
|
486 | - |
|
487 | - if($modx->db->getRecordCount($rs) < 1) { |
|
488 | - return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
489 | - } |
|
490 | - |
|
491 | - $tpl = getRecentInfoRowTpl(); |
|
492 | - |
|
493 | - $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
494 | - $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
495 | - |
|
496 | - $output = array(); |
|
497 | - while($ph = $modx->db->getRow($rs)) { |
|
498 | - $docid = $ph['id']; |
|
499 | - $_ = $modx->getUserInfo($ph['editedby']); |
|
500 | - $ph['username'] = $_['username']; |
|
501 | - |
|
502 | - if($ph['deleted'] == 1) { |
|
503 | - $ph['status'] = 'deleted text-danger'; |
|
504 | - } elseif($ph['published'] == 0) { |
|
505 | - $ph['status'] = 'unpublished font-italic text-muted'; |
|
506 | - } else { |
|
507 | - $ph['status'] = 'published'; |
|
508 | - } |
|
509 | - |
|
510 | - if($modx->hasPermission('edit_document')) { |
|
511 | - $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
|
512 | - } else { |
|
513 | - $ph['edit_btn'] = ''; |
|
514 | - } |
|
515 | - |
|
516 | - $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
517 | - $ph['preview_btn'] = str_replace(array( |
|
518 | - '[+id+]', |
|
519 | - '[+preview_disabled+]' |
|
520 | - ), array( |
|
521 | - $docid, |
|
522 | - $preview_disabled |
|
523 | - ), $btntpl['preview_btn']); |
|
524 | - |
|
525 | - if($modx->hasPermission('delete_document')) { |
|
526 | - if($ph['deleted'] == 0) { |
|
527 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
528 | - } else { |
|
529 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
530 | - } |
|
531 | - $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
|
532 | - } else { |
|
533 | - $ph['delete_btn'] = ''; |
|
534 | - } |
|
535 | - |
|
536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | - $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
542 | - } else { |
|
543 | - $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
544 | - } |
|
545 | - $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
|
546 | - |
|
547 | - $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
|
548 | - |
|
549 | - if($ph['longtitle'] == '') { |
|
550 | - $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
551 | - } |
|
552 | - if($ph['description'] == '') { |
|
553 | - $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
554 | - } |
|
555 | - if($ph['introtext'] == '') { |
|
556 | - $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
557 | - } |
|
558 | - if($ph['alias'] == '') { |
|
559 | - $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
560 | - } |
|
561 | - |
|
562 | - $output[] = $modx->parseText($tpl, $ph); |
|
563 | - } |
|
564 | - return join("\n", $output); |
|
483 | + global $modx; |
|
484 | + |
|
485 | + $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
|
486 | + |
|
487 | + if($modx->db->getRecordCount($rs) < 1) { |
|
488 | + return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
489 | + } |
|
490 | + |
|
491 | + $tpl = getRecentInfoRowTpl(); |
|
492 | + |
|
493 | + $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
494 | + $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
495 | + |
|
496 | + $output = array(); |
|
497 | + while($ph = $modx->db->getRow($rs)) { |
|
498 | + $docid = $ph['id']; |
|
499 | + $_ = $modx->getUserInfo($ph['editedby']); |
|
500 | + $ph['username'] = $_['username']; |
|
501 | + |
|
502 | + if($ph['deleted'] == 1) { |
|
503 | + $ph['status'] = 'deleted text-danger'; |
|
504 | + } elseif($ph['published'] == 0) { |
|
505 | + $ph['status'] = 'unpublished font-italic text-muted'; |
|
506 | + } else { |
|
507 | + $ph['status'] = 'published'; |
|
508 | + } |
|
509 | + |
|
510 | + if($modx->hasPermission('edit_document')) { |
|
511 | + $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
|
512 | + } else { |
|
513 | + $ph['edit_btn'] = ''; |
|
514 | + } |
|
515 | + |
|
516 | + $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
517 | + $ph['preview_btn'] = str_replace(array( |
|
518 | + '[+id+]', |
|
519 | + '[+preview_disabled+]' |
|
520 | + ), array( |
|
521 | + $docid, |
|
522 | + $preview_disabled |
|
523 | + ), $btntpl['preview_btn']); |
|
524 | + |
|
525 | + if($modx->hasPermission('delete_document')) { |
|
526 | + if($ph['deleted'] == 0) { |
|
527 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
528 | + } else { |
|
529 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
530 | + } |
|
531 | + $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
|
532 | + } else { |
|
533 | + $ph['delete_btn'] = ''; |
|
534 | + } |
|
535 | + |
|
536 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
538 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
540 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | + $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
542 | + } else { |
|
543 | + $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
544 | + } |
|
545 | + $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
|
546 | + |
|
547 | + $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
|
548 | + |
|
549 | + if($ph['longtitle'] == '') { |
|
550 | + $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
551 | + } |
|
552 | + if($ph['description'] == '') { |
|
553 | + $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
554 | + } |
|
555 | + if($ph['introtext'] == '') { |
|
556 | + $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
557 | + } |
|
558 | + if($ph['alias'] == '') { |
|
559 | + $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
560 | + } |
|
561 | + |
|
562 | + $output[] = $modx->parseText($tpl, $ph); |
|
563 | + } |
|
564 | + return join("\n", $output); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | function getRecentInfoRowTpl() { |
568 | - $tpl = ' |
|
568 | + $tpl = ' |
|
569 | 569 | <tr> |
570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
571 | 571 | <td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&id=[+id+]" target="main">[+pagetitle+]</a></td> |
@@ -589,16 +589,16 @@ discard block |
||
589 | 589 | </div> |
590 | 590 | </td> |
591 | 591 | </tr>'; |
592 | - return $tpl; |
|
592 | + return $tpl; |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | // setup icons |
596 | 596 | function wrapIcon($i, $action) { |
597 | - return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
|
597 | + return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | function getStartUpScript() { |
601 | - $script = ' |
|
601 | + $script = ' |
|
602 | 602 | <script type="text/javascript"> |
603 | 603 | function hideConfigCheckWarning(key) { |
604 | 604 | var xhr = new XMLHttpRequest(); |
@@ -622,5 +622,5 @@ discard block |
||
622 | 622 | })(jQuery); |
623 | 623 | </script> |
624 | 624 | '; |
625 | - return $script; |
|
625 | + return $script; |
|
626 | 626 | } |
@@ -1,11 +1,11 @@ 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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
8 | +if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
9 | 9 | // seems to be a new install - send the user to the configuration page |
10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
11 | 11 | } |
@@ -16,50 +16,50 @@ discard block |
||
16 | 16 | $_SESSION['nrnewmessages'] = 0; |
17 | 17 | |
18 | 18 | // setup message info |
19 | -if($modx->hasPermission('messages')) { |
|
20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
19 | +if ($modx->hasPermission('messages')) { |
|
20 | + include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php'); |
|
21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
23 | 23 | |
24 | 24 | $msg = array(); |
25 | 25 | $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : ''; |
|
27 | 27 | $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0'; |
|
29 | 29 | $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
30 | 30 | $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
31 | 31 | $ph['MessageInfo'] = join("\n", $msg); |
32 | 32 | } |
33 | 33 | |
34 | 34 | // setup icons |
35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
35 | +if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
38 | 38 | } |
39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
39 | +if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
42 | 42 | } |
43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
43 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
46 | 46 | } |
47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
47 | +if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
50 | 50 | } |
51 | -if($modx->hasPermission('bk_manager')) { |
|
51 | +if ($modx->hasPermission('bk_manager')) { |
|
52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
54 | 54 | } |
55 | -if($modx->hasPermission('help')) { |
|
55 | +if ($modx->hasPermission('help')) { |
|
56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
58 | 58 | } |
59 | 59 | // do some config checks |
60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
62 | - if($config_check_results != $_lang['configcheck_ok']) { |
|
60 | +if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
61 | + include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php'); |
|
62 | + if ($config_check_results != $_lang['configcheck_ok']) { |
|
63 | 63 | $ph['config_check_results'] = $config_check_results; |
64 | 64 | $ph['config_display'] = 'block'; |
65 | 65 | } else { |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check logout-reminder |
73 | -if(isset($_SESSION['show_logout_reminder'])) { |
|
74 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
73 | +if (isset($_SESSION['show_logout_reminder'])) { |
|
74 | + switch ($_SESSION['show_logout_reminder']['type']) { |
|
75 | 75 | case 'logout_reminder': |
76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | </tr> |
126 | 126 | </table>'; |
127 | 127 | |
128 | -$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
|
128 | +$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>'; |
|
129 | 129 | |
130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
131 | 131 | 'username' => $modx->getLoginUserName(), |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC'); |
142 | 142 | |
143 | -if($modx->db->getRecordCount($rs) < 1) { |
|
143 | +if ($modx->db->getRecordCount($rs) < 1) { |
|
144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
145 | 145 | } else { |
146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
146 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now); |
149 | 149 | $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $userList = array(); |
169 | 169 | $userCount = array(); |
170 | 170 | // Create userlist with session-count first before output |
171 | - while($activeusers = $modx->db->getRow($rs)) { |
|
171 | + while ($activeusers = $modx->db->getRow($rs)) { |
|
172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
173 | 173 | |
174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | $currentaction |
187 | 187 | ); |
188 | 188 | } |
189 | - foreach($userList as $params) { |
|
189 | + foreach ($userList as $params) { |
|
190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
191 | + $html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | $html .= ' |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $ph['OnlineInfo'] = $html; |
201 | 201 | |
202 | 202 | // include rss feeds for important forum topics |
203 | -include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php'); |
|
203 | +include_once(MODX_MANAGER_PATH.'includes/rss.inc.php'); |
|
204 | 204 | $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content']; |
205 | 205 | $ph['modx_news_content'] = $feedData['modx_news_content']; |
206 | 206 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | // invoke event OnManagerWelcomePrerender |
233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
234 | -if(is_array($evtOut)) { |
|
234 | +if (is_array($evtOut)) { |
|
235 | 235 | $output = implode('', $evtOut); |
236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
237 | 237 | } |
@@ -365,57 +365,57 @@ discard block |
||
365 | 365 | |
366 | 366 | // invoke OnManagerWelcomeHome event |
367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
368 | -if(is_array($sitewidgets)) { |
|
368 | +if (is_array($sitewidgets)) { |
|
369 | 369 | $newwidgets = array(); |
370 | - foreach($sitewidgets as $widget){ |
|
370 | + foreach ($sitewidgets as $widget) { |
|
371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
372 | 372 | } |
373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
374 | 374 | } |
375 | 375 | |
376 | -usort($widgets, function ($a, $b) { |
|
376 | +usort($widgets, function($a, $b){ |
|
377 | 377 | return $a['menuindex'] - $b['menuindex']; |
378 | 378 | }); |
379 | 379 | |
380 | 380 | $tpl = getTplWidget(); |
381 | 381 | $output = ''; |
382 | -foreach($widgets as $widget) { |
|
383 | - if ($widget['hide'] != '1'){ |
|
382 | +foreach ($widgets as $widget) { |
|
383 | + if ($widget['hide'] != '1') { |
|
384 | 384 | $output .= $modx->parseText($tpl, $widget); |
385 | 385 | } |
386 | 386 | } |
387 | 387 | $ph['widgets'] = $output; |
388 | 388 | |
389 | 389 | // load template |
390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
390 | +if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl'; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target); |
396 | 396 | $target = $modx->mergeSettingsContent($target); |
397 | 397 | |
398 | -if(substr($target, 0, 1) === '@') { |
|
399 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
398 | +if (substr($target, 0, 1) === '@') { |
|
399 | + if (substr($target, 0, 6) === '@CHUNK') { |
|
400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
401 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
401 | + } elseif (substr($target, 0, 5) === '@FILE') { |
|
402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
403 | 403 | } else { |
404 | 404 | $content = ''; |
405 | 405 | } |
406 | 406 | } else { |
407 | 407 | $chunk = $modx->getChunk($target); |
408 | - if($chunk !== false && !empty($chunk)) { |
|
408 | + if ($chunk !== false && !empty($chunk)) { |
|
409 | 409 | $content = $chunk; |
410 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
410 | + } elseif (is_file(MODX_BASE_PATH.$target)) { |
|
411 | + $content = file_get_contents(MODX_BASE_PATH.$target); |
|
412 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) { |
|
413 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl'); |
|
414 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible |
|
415 | 415 | { |
416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
416 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html'); |
|
417 | 417 | } else { |
418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
418 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl'); |
|
419 | 419 | } |
420 | 420 | } |
421 | 421 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $content = $modx->mergeConditionalTagsContent($content); |
424 | 424 | $content = $modx->mergeSettingsContent($content); |
425 | 425 | $content = $modx->parseText($content, $ph); |
426 | -if(strpos($content, '[+') !== false) { |
|
426 | +if (strpos($content, '[+') !== false) { |
|
427 | 427 | $modx->toPlaceholders($ph); |
428 | 428 | $content = $modx->mergePlaceholderContent($content); |
429 | 429 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
434 | 434 | |
435 | -if($js = $modx->getRegisteredClientScripts()) { |
|
435 | +if ($js = $modx->getRegisteredClientScripts()) { |
|
436 | 436 | $content .= $js; |
437 | 437 | } |
438 | 438 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
444 | 444 | //</span> |
445 | -function getTplWidget() { // recent document info |
|
445 | +function getTplWidget(){ // recent document info |
|
446 | 446 | return ' |
447 | 447 | <div class="[+cols+]" id="[+id+]"> |
448 | 448 | <div class="card"[+cardAttr+]> |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | '; |
454 | 454 | } |
455 | 455 | |
456 | -function getRecentInfo() { // recent document info |
|
456 | +function getRecentInfo(){ // recent document info |
|
457 | 457 | global $modx; |
458 | 458 | |
459 | 459 | $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | return $html; |
480 | 480 | } |
481 | 481 | |
482 | -function getRecentInfoList() { |
|
482 | +function getRecentInfoList(){ |
|
483 | 483 | global $modx; |
484 | 484 | |
485 | 485 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
486 | 486 | |
487 | - if($modx->db->getRecordCount($rs) < 1) { |
|
487 | + if ($modx->db->getRecordCount($rs) < 1) { |
|
488 | 488 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
489 | 489 | } |
490 | 490 | |
@@ -494,20 +494,20 @@ discard block |
||
494 | 494 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
495 | 495 | |
496 | 496 | $output = array(); |
497 | - while($ph = $modx->db->getRow($rs)) { |
|
497 | + while ($ph = $modx->db->getRow($rs)) { |
|
498 | 498 | $docid = $ph['id']; |
499 | 499 | $_ = $modx->getUserInfo($ph['editedby']); |
500 | 500 | $ph['username'] = $_['username']; |
501 | 501 | |
502 | - if($ph['deleted'] == 1) { |
|
502 | + if ($ph['deleted'] == 1) { |
|
503 | 503 | $ph['status'] = 'deleted text-danger'; |
504 | - } elseif($ph['published'] == 0) { |
|
504 | + } elseif ($ph['published'] == 0) { |
|
505 | 505 | $ph['status'] = 'unpublished font-italic text-muted'; |
506 | 506 | } else { |
507 | 507 | $ph['status'] = 'published'; |
508 | 508 | } |
509 | 509 | |
510 | - if($modx->hasPermission('edit_document')) { |
|
510 | + if ($modx->hasPermission('edit_document')) { |
|
511 | 511 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
512 | 512 | } else { |
513 | 513 | $ph['edit_btn'] = ''; |
@@ -522,8 +522,8 @@ discard block |
||
522 | 522 | $preview_disabled |
523 | 523 | ), $btntpl['preview_btn']); |
524 | 524 | |
525 | - if($modx->hasPermission('delete_document')) { |
|
526 | - if($ph['deleted'] == 0) { |
|
525 | + if ($modx->hasPermission('delete_document')) { |
|
526 | + if ($ph['deleted'] == 0) { |
|
527 | 527 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
528 | 528 | } else { |
529 | 529 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | $ph['delete_btn'] = ''; |
534 | 534 | } |
535 | 535 | |
536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
536 | + if ($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | 537 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
538 | + } elseif ($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | 539 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
540 | + } elseif ($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | 541 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
542 | 542 | } else { |
543 | 543 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
@@ -546,16 +546,16 @@ discard block |
||
546 | 546 | |
547 | 547 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
548 | 548 | |
549 | - if($ph['longtitle'] == '') { |
|
549 | + if ($ph['longtitle'] == '') { |
|
550 | 550 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
551 | 551 | } |
552 | - if($ph['description'] == '') { |
|
552 | + if ($ph['description'] == '') { |
|
553 | 553 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
554 | 554 | } |
555 | - if($ph['introtext'] == '') { |
|
555 | + if ($ph['introtext'] == '') { |
|
556 | 556 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
557 | 557 | } |
558 | - if($ph['alias'] == '') { |
|
558 | + if ($ph['alias'] == '') { |
|
559 | 559 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
560 | 560 | } |
561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | return join("\n", $output); |
565 | 565 | } |
566 | 566 | |
567 | -function getRecentInfoRowTpl() { |
|
567 | +function getRecentInfoRowTpl(){ |
|
568 | 568 | $tpl = ' |
569 | 569 | <tr> |
570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | } |
594 | 594 | |
595 | 595 | // setup icons |
596 | -function wrapIcon($i, $action) { |
|
596 | +function wrapIcon($i, $action){ |
|
597 | 597 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
598 | 598 | } |
599 | 599 | |
600 | -function getStartUpScript() { |
|
600 | +function getStartUpScript(){ |
|
601 | 601 | $script = ' |
602 | 602 | <script type="text/javascript"> |
603 | 603 | function hideConfigCheckWarning(key) { |
@@ -1,11 +1,11 @@ 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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
8 | +if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
9 | 9 | // seems to be a new install - send the user to the configuration page |
10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
11 | 11 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $_SESSION['nrnewmessages'] = 0; |
17 | 17 | |
18 | 18 | // setup message info |
19 | -if($modx->hasPermission('messages')) { |
|
19 | +if($modx->hasPermission('messages')) { |
|
20 | 20 | include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
@@ -32,46 +32,46 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | // setup icons |
35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
35 | +if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
38 | 38 | } |
39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
39 | +if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
42 | 42 | } |
43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
43 | +if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
46 | 46 | } |
47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
47 | +if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
50 | 50 | } |
51 | -if($modx->hasPermission('bk_manager')) { |
|
51 | +if($modx->hasPermission('bk_manager')) { |
|
52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
54 | 54 | } |
55 | -if($modx->hasPermission('help')) { |
|
55 | +if($modx->hasPermission('help')) { |
|
56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
58 | 58 | } |
59 | 59 | // do some config checks |
60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
60 | +if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
61 | 61 | include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
62 | - if($config_check_results != $_lang['configcheck_ok']) { |
|
62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | 63 | $ph['config_check_results'] = $config_check_results; |
64 | 64 | $ph['config_display'] = 'block'; |
65 | - } else { |
|
65 | + } else { |
|
66 | 66 | $ph['config_display'] = 'none'; |
67 | 67 | } |
68 | -} else { |
|
68 | +} else { |
|
69 | 69 | $ph['config_display'] = 'none'; |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check logout-reminder |
73 | -if(isset($_SESSION['show_logout_reminder'])) { |
|
74 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
73 | +if(isset($_SESSION['show_logout_reminder'])) { |
|
74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | 75 | case 'logout_reminder': |
76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | $ph['show_logout_reminder'] = 'block'; |
81 | 81 | unset($_SESSION['show_logout_reminder']); |
82 | -} else { |
|
82 | +} else { |
|
83 | 83 | $ph['show_logout_reminder'] = 'none'; |
84 | 84 | } |
85 | 85 | |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC'); |
142 | 142 | |
143 | -if($modx->db->getRecordCount($rs) < 1) { |
|
143 | +if($modx->db->getRecordCount($rs) < 1) { |
|
144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
145 | -} else { |
|
145 | +} else { |
|
146 | 146 | include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $userList = array(); |
169 | 169 | $userCount = array(); |
170 | 170 | // Create userlist with session-count first before output |
171 | - while($activeusers = $modx->db->getRow($rs)) { |
|
171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
173 | 173 | |
174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $currentaction |
187 | 187 | ); |
188 | 188 | } |
189 | - foreach($userList as $params) { |
|
189 | + foreach($userList as $params) { |
|
190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
191 | 191 | $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
192 | 192 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | // invoke event OnManagerWelcomePrerender |
233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
234 | -if(is_array($evtOut)) { |
|
234 | +if(is_array($evtOut)) { |
|
235 | 235 | $output = implode('', $evtOut); |
236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
237 | 237 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
341 | 341 | 'hide'=>'0' |
342 | 342 | ); |
343 | -if ($modx->config['rss_url_news']) { |
|
343 | +if ($modx->config['rss_url_news']) { |
|
344 | 344 | $widgets['news'] = array( |
345 | 345 | 'menuindex' => '40', |
346 | 346 | 'id' => 'news', |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | 'hide'=>'0' |
352 | 352 | ); |
353 | 353 | } |
354 | -if ($modx->config['rss_url_security']) { |
|
354 | +if ($modx->config['rss_url_security']) { |
|
355 | 355 | $widgets['security'] = array( |
356 | 356 | 'menuindex' => '50', |
357 | 357 | 'id' => 'security', |
@@ -365,29 +365,29 @@ discard block |
||
365 | 365 | |
366 | 366 | // invoke OnManagerWelcomeHome event |
367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
368 | -if(is_array($sitewidgets)) { |
|
368 | +if(is_array($sitewidgets)) { |
|
369 | 369 | $newwidgets = array(); |
370 | - foreach($sitewidgets as $widget){ |
|
370 | + foreach($sitewidgets as $widget) { |
|
371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
372 | 372 | } |
373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
374 | 374 | } |
375 | 375 | |
376 | -usort($widgets, function ($a, $b) { |
|
376 | +usort($widgets, function ($a, $b){ |
|
377 | 377 | return $a['menuindex'] - $b['menuindex']; |
378 | 378 | }); |
379 | 379 | |
380 | 380 | $tpl = getTplWidget(); |
381 | 381 | $output = ''; |
382 | -foreach($widgets as $widget) { |
|
383 | - if ($widget['hide'] != '1'){ |
|
382 | +foreach($widgets as $widget) { |
|
383 | + if ($widget['hide'] != '1') { |
|
384 | 384 | $output .= $modx->parseText($tpl, $widget); |
385 | 385 | } |
386 | 386 | } |
387 | 387 | $ph['widgets'] = $output; |
388 | 388 | |
389 | 389 | // load template |
390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
390 | +if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
391 | 391 | $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
392 | 392 | } |
393 | 393 | |
@@ -395,26 +395,28 @@ discard block |
||
395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target); |
396 | 396 | $target = $modx->mergeSettingsContent($target); |
397 | 397 | |
398 | -if(substr($target, 0, 1) === '@') { |
|
399 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
398 | +if(substr($target, 0, 1) === '@') { |
|
399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
401 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
403 | - } else { |
|
403 | + } else { |
|
404 | 404 | $content = ''; |
405 | 405 | } |
406 | -} else { |
|
406 | +} else { |
|
407 | 407 | $chunk = $modx->getChunk($target); |
408 | - if($chunk !== false && !empty($chunk)) { |
|
408 | + if($chunk !== false && !empty($chunk)) { |
|
409 | 409 | $content = $chunk; |
410 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | 411 | $content = file_get_contents(MODX_BASE_PATH . $target); |
412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | 413 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) { |
|
415 | + // ClipperCMS compatible |
|
415 | 416 | { |
416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | - } else { |
|
417 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
418 | + } |
|
419 | + } else { |
|
418 | 420 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
419 | 421 | } |
420 | 422 | } |
@@ -423,7 +425,7 @@ discard block |
||
423 | 425 | $content = $modx->mergeConditionalTagsContent($content); |
424 | 426 | $content = $modx->mergeSettingsContent($content); |
425 | 427 | $content = $modx->parseText($content, $ph); |
426 | -if(strpos($content, '[+') !== false) { |
|
428 | +if(strpos($content, '[+') !== false) { |
|
427 | 429 | $modx->toPlaceholders($ph); |
428 | 430 | $content = $modx->mergePlaceholderContent($content); |
429 | 431 | } |
@@ -432,7 +434,7 @@ discard block |
||
432 | 434 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
433 | 435 | $content = $modx->cleanUpMODXTags($content); //cleanup |
434 | 436 | |
435 | -if($js = $modx->getRegisteredClientScripts()) { |
|
437 | +if($js = $modx->getRegisteredClientScripts()) { |
|
436 | 438 | $content .= $js; |
437 | 439 | } |
438 | 440 | |
@@ -442,7 +444,9 @@ discard block |
||
442 | 444 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
443 | 445 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
444 | 446 | //</span> |
445 | -function getTplWidget() { // recent document info |
|
447 | +function getTplWidget() |
|
448 | +{ |
|
449 | +// recent document info |
|
446 | 450 | return ' |
447 | 451 | <div class="[+cols+]" id="[+id+]"> |
448 | 452 | <div class="card"[+cardAttr+]> |
@@ -453,7 +457,9 @@ discard block |
||
453 | 457 | '; |
454 | 458 | } |
455 | 459 | |
456 | -function getRecentInfo() { // recent document info |
|
460 | +function getRecentInfo() |
|
461 | +{ |
|
462 | +// recent document info |
|
457 | 463 | global $modx; |
458 | 464 | |
459 | 465 | $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
@@ -479,12 +485,13 @@ discard block |
||
479 | 485 | return $html; |
480 | 486 | } |
481 | 487 | |
482 | -function getRecentInfoList() { |
|
488 | +function getRecentInfoList() |
|
489 | +{ |
|
483 | 490 | global $modx; |
484 | 491 | |
485 | 492 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
486 | 493 | |
487 | - if($modx->db->getRecordCount($rs) < 1) { |
|
494 | + if($modx->db->getRecordCount($rs) < 1) { |
|
488 | 495 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
489 | 496 | } |
490 | 497 | |
@@ -494,22 +501,22 @@ discard block |
||
494 | 501 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
495 | 502 | |
496 | 503 | $output = array(); |
497 | - while($ph = $modx->db->getRow($rs)) { |
|
504 | + while($ph = $modx->db->getRow($rs)) { |
|
498 | 505 | $docid = $ph['id']; |
499 | 506 | $_ = $modx->getUserInfo($ph['editedby']); |
500 | 507 | $ph['username'] = $_['username']; |
501 | 508 | |
502 | - if($ph['deleted'] == 1) { |
|
509 | + if($ph['deleted'] == 1) { |
|
503 | 510 | $ph['status'] = 'deleted text-danger'; |
504 | - } elseif($ph['published'] == 0) { |
|
511 | + } elseif($ph['published'] == 0) { |
|
505 | 512 | $ph['status'] = 'unpublished font-italic text-muted'; |
506 | - } else { |
|
513 | + } else { |
|
507 | 514 | $ph['status'] = 'published'; |
508 | 515 | } |
509 | 516 | |
510 | - if($modx->hasPermission('edit_document')) { |
|
517 | + if($modx->hasPermission('edit_document')) { |
|
511 | 518 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
512 | - } else { |
|
519 | + } else { |
|
513 | 520 | $ph['edit_btn'] = ''; |
514 | 521 | } |
515 | 522 | |
@@ -522,40 +529,40 @@ discard block |
||
522 | 529 | $preview_disabled |
523 | 530 | ), $btntpl['preview_btn']); |
524 | 531 | |
525 | - if($modx->hasPermission('delete_document')) { |
|
526 | - if($ph['deleted'] == 0) { |
|
532 | + if($modx->hasPermission('delete_document')) { |
|
533 | + if($ph['deleted'] == 0) { |
|
527 | 534 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
528 | - } else { |
|
535 | + } else { |
|
529 | 536 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
530 | 537 | } |
531 | 538 | $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
532 | - } else { |
|
539 | + } else { |
|
533 | 540 | $ph['delete_btn'] = ''; |
534 | 541 | } |
535 | 542 | |
536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
543 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | 544 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
545 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | 546 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
547 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | 548 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
542 | - } else { |
|
549 | + } else { |
|
543 | 550 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
544 | 551 | } |
545 | 552 | $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
546 | 553 | |
547 | 554 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
548 | 555 | |
549 | - if($ph['longtitle'] == '') { |
|
556 | + if($ph['longtitle'] == '') { |
|
550 | 557 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
551 | 558 | } |
552 | - if($ph['description'] == '') { |
|
559 | + if($ph['description'] == '') { |
|
553 | 560 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
554 | 561 | } |
555 | - if($ph['introtext'] == '') { |
|
562 | + if($ph['introtext'] == '') { |
|
556 | 563 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
557 | 564 | } |
558 | - if($ph['alias'] == '') { |
|
565 | + if($ph['alias'] == '') { |
|
559 | 566 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
560 | 567 | } |
561 | 568 | |
@@ -564,7 +571,8 @@ discard block |
||
564 | 571 | return join("\n", $output); |
565 | 572 | } |
566 | 573 | |
567 | -function getRecentInfoRowTpl() { |
|
574 | +function getRecentInfoRowTpl() |
|
575 | +{ |
|
568 | 576 | $tpl = ' |
569 | 577 | <tr> |
570 | 578 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +601,13 @@ discard block |
||
593 | 601 | } |
594 | 602 | |
595 | 603 | // setup icons |
596 | -function wrapIcon($i, $action) { |
|
604 | +function wrapIcon($i, $action) |
|
605 | +{ |
|
597 | 606 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
598 | 607 | } |
599 | 608 | |
600 | -function getStartUpScript() { |
|
609 | +function getStartUpScript() |
|
610 | +{ |
|
601 | 611 | $script = ' |
602 | 612 | <script type="text/javascript"> |
603 | 613 | function hideConfigCheckWarning(key) { |
@@ -1,10 +1,10 @@ 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 | if(!$modx->hasPermission('edit_module')) { |
7 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -26,91 +26,91 @@ discard block |
||
26 | 26 | // check to see the editor isn't locked |
27 | 27 | $rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
28 | 28 | if($username = $modx->db->getValue($rs)) { |
29 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
29 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
30 | 30 | } |
31 | 31 | // end check for lock |
32 | 32 | |
33 | 33 | // take action |
34 | 34 | switch($_REQUEST['op']) { |
35 | - case 'add': |
|
36 | - // convert ids to numbers |
|
37 | - $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
38 | - |
|
39 | - if(count($opids) > 0) { |
|
40 | - // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
41 | - $rt = strtolower($_REQUEST["rt"]); |
|
42 | - if($rt == 'chunk') { |
|
43 | - $type = 10; |
|
44 | - } |
|
45 | - if($rt == 'doc') { |
|
46 | - $type = 20; |
|
47 | - } |
|
48 | - if($rt == 'plug') { |
|
49 | - $type = 30; |
|
50 | - } |
|
51 | - if($rt == 'snip') { |
|
52 | - $type = 40; |
|
53 | - } |
|
54 | - if($rt == 'tpl') { |
|
55 | - $type = 50; |
|
56 | - } |
|
57 | - if($rt == 'tv') { |
|
58 | - $type = 60; |
|
59 | - } |
|
60 | - $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
61 | - foreach($opids as $opid) { |
|
62 | - $modx->db->insert(array( |
|
63 | - 'module' => $id, |
|
64 | - 'resource' => $opid, |
|
65 | - 'type' => $type, |
|
66 | - ), $tbl_site_module_depobj); |
|
67 | - } |
|
68 | - } |
|
69 | - break; |
|
70 | - case 'del': |
|
71 | - // convert ids to numbers |
|
72 | - $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
73 | - |
|
74 | - // get resources that needs to be removed |
|
75 | - $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
76 | - // loop through resources and look for plugins and snippets |
|
77 | - $plids = array(); |
|
78 | - $snid = array(); |
|
79 | - while($row = $modx->db->getRow($ds)) { |
|
80 | - if($row['type'] == '30') { |
|
81 | - $plids[$i] = $row['resource']; |
|
82 | - } |
|
83 | - if($row['type'] == '40') { |
|
84 | - $snids[$i] = $row['resource']; |
|
85 | - } |
|
86 | - } |
|
87 | - // get guid |
|
88 | - $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
89 | - $guid = $modx->db->getValue($ds); |
|
90 | - // reset moduleguid for deleted resources |
|
91 | - if(($cp = count($plids)) || ($cs = count($snids))) { |
|
92 | - if($cp) { |
|
93 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
94 | - } |
|
95 | - if($cs) { |
|
96 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
97 | - } |
|
98 | - // reset cache |
|
99 | - $modx->clearCache('full'); |
|
100 | - } |
|
101 | - $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
102 | - break; |
|
35 | + case 'add': |
|
36 | + // convert ids to numbers |
|
37 | + $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
38 | + |
|
39 | + if(count($opids) > 0) { |
|
40 | + // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
41 | + $rt = strtolower($_REQUEST["rt"]); |
|
42 | + if($rt == 'chunk') { |
|
43 | + $type = 10; |
|
44 | + } |
|
45 | + if($rt == 'doc') { |
|
46 | + $type = 20; |
|
47 | + } |
|
48 | + if($rt == 'plug') { |
|
49 | + $type = 30; |
|
50 | + } |
|
51 | + if($rt == 'snip') { |
|
52 | + $type = 40; |
|
53 | + } |
|
54 | + if($rt == 'tpl') { |
|
55 | + $type = 50; |
|
56 | + } |
|
57 | + if($rt == 'tv') { |
|
58 | + $type = 60; |
|
59 | + } |
|
60 | + $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
61 | + foreach($opids as $opid) { |
|
62 | + $modx->db->insert(array( |
|
63 | + 'module' => $id, |
|
64 | + 'resource' => $opid, |
|
65 | + 'type' => $type, |
|
66 | + ), $tbl_site_module_depobj); |
|
67 | + } |
|
68 | + } |
|
69 | + break; |
|
70 | + case 'del': |
|
71 | + // convert ids to numbers |
|
72 | + $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
73 | + |
|
74 | + // get resources that needs to be removed |
|
75 | + $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
76 | + // loop through resources and look for plugins and snippets |
|
77 | + $plids = array(); |
|
78 | + $snid = array(); |
|
79 | + while($row = $modx->db->getRow($ds)) { |
|
80 | + if($row['type'] == '30') { |
|
81 | + $plids[$i] = $row['resource']; |
|
82 | + } |
|
83 | + if($row['type'] == '40') { |
|
84 | + $snids[$i] = $row['resource']; |
|
85 | + } |
|
86 | + } |
|
87 | + // get guid |
|
88 | + $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
89 | + $guid = $modx->db->getValue($ds); |
|
90 | + // reset moduleguid for deleted resources |
|
91 | + if(($cp = count($plids)) || ($cs = count($snids))) { |
|
92 | + if($cp) { |
|
93 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
94 | + } |
|
95 | + if($cs) { |
|
96 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
97 | + } |
|
98 | + // reset cache |
|
99 | + $modx->clearCache('full'); |
|
100 | + } |
|
101 | + $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
102 | + break; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // load record |
106 | 106 | $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'"); |
107 | 107 | $content = $modx->db->getRow($rs); |
108 | 108 | if(!$content) { |
109 | - $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
109 | + $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
110 | 110 | } |
111 | 111 | $_SESSION['itemname'] = $content['name']; |
112 | 112 | if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
113 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
113 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | ?> |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | <tr> |
204 | 204 | <td valign="top" align="left"> |
205 | 205 | <?php |
206 | - $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
206 | + $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
207 | 207 | CASE smd.type |
208 | 208 | WHEN 10 THEN 'Chunk' |
209 | 209 | WHEN 20 THEN 'Document' |
@@ -218,18 +218,18 @@ discard block |
||
218 | 218 | LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40' |
219 | 219 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50' |
220 | 220 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name"); |
221 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
222 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
223 | - $grd->noRecordMsg = $_lang["no_records_found"]; |
|
224 | - $grd->cssClass = "grid"; |
|
225 | - $grd->columnHeaderClass = "gridHeader"; |
|
226 | - $grd->itemClass = "gridItem"; |
|
227 | - $grd->altItemClass = "gridAltItem"; |
|
228 | - $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
229 | - $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
230 | - $grd->fields = "name,type"; |
|
231 | - echo $grd->render(); |
|
232 | - ?> |
|
221 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
222 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
223 | + $grd->noRecordMsg = $_lang["no_records_found"]; |
|
224 | + $grd->cssClass = "grid"; |
|
225 | + $grd->columnHeaderClass = "gridHeader"; |
|
226 | + $grd->itemClass = "gridItem"; |
|
227 | + $grd->altItemClass = "gridAltItem"; |
|
228 | + $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
229 | + $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
230 | + $grd->fields = "name,type"; |
|
231 | + echo $grd->render(); |
|
232 | + ?> |
|
233 | 233 | </td> |
234 | 234 | <td valign="top" style="width: 150px;"> |
235 | 235 | <a class="btn btn-block btn-danger text-left" style="margin-bottom:10px;" href="javascript:;" onclick="removeDependencies();return false;"><i class="<?php echo $_style["actions_delete"] ?>"></i> <?php echo $_lang['remove']; ?></a> |
@@ -1,9 +1,9 @@ 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 | -if(!$modx->hasPermission('edit_module')) { |
|
6 | +if (!$modx->hasPermission('edit_module')) { |
|
7 | 7 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
8 | 8 | } |
9 | 9 | |
@@ -24,41 +24,41 @@ discard block |
||
24 | 24 | $modx->manager->initPageViewState(); |
25 | 25 | |
26 | 26 | // check to see the editor isn't locked |
27 | -$rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
|
28 | -if($username = $modx->db->getValue($rs)) { |
|
27 | +$rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
28 | +if ($username = $modx->db->getValue($rs)) { |
|
29 | 29 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
30 | 30 | } |
31 | 31 | // end check for lock |
32 | 32 | |
33 | 33 | // take action |
34 | -switch($_REQUEST['op']) { |
|
34 | +switch ($_REQUEST['op']) { |
|
35 | 35 | case 'add': |
36 | 36 | // convert ids to numbers |
37 | 37 | $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
38 | 38 | |
39 | - if(count($opids) > 0) { |
|
39 | + if (count($opids) > 0) { |
|
40 | 40 | // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
41 | 41 | $rt = strtolower($_REQUEST["rt"]); |
42 | - if($rt == 'chunk') { |
|
42 | + if ($rt == 'chunk') { |
|
43 | 43 | $type = 10; |
44 | 44 | } |
45 | - if($rt == 'doc') { |
|
45 | + if ($rt == 'doc') { |
|
46 | 46 | $type = 20; |
47 | 47 | } |
48 | - if($rt == 'plug') { |
|
48 | + if ($rt == 'plug') { |
|
49 | 49 | $type = 30; |
50 | 50 | } |
51 | - if($rt == 'snip') { |
|
51 | + if ($rt == 'snip') { |
|
52 | 52 | $type = 40; |
53 | 53 | } |
54 | - if($rt == 'tpl') { |
|
54 | + if ($rt == 'tpl') { |
|
55 | 55 | $type = 50; |
56 | 56 | } |
57 | - if($rt == 'tv') { |
|
57 | + if ($rt == 'tv') { |
|
58 | 58 | $type = 60; |
59 | 59 | } |
60 | - $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
61 | - foreach($opids as $opid) { |
|
60 | + $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (".implode(',', $opids).") AND type='{$type}'"); |
|
61 | + foreach ($opids as $opid) { |
|
62 | 62 | $modx->db->insert(array( |
63 | 63 | 'module' => $id, |
64 | 64 | 'resource' => $opid, |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
73 | 73 | |
74 | 74 | // get resources that needs to be removed |
75 | - $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
75 | + $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (".implode(",", $opids).")"); |
|
76 | 76 | // loop through resources and look for plugins and snippets |
77 | 77 | $plids = array(); |
78 | 78 | $snid = array(); |
79 | - while($row = $modx->db->getRow($ds)) { |
|
80 | - if($row['type'] == '30') { |
|
79 | + while ($row = $modx->db->getRow($ds)) { |
|
80 | + if ($row['type'] == '30') { |
|
81 | 81 | $plids[$i] = $row['resource']; |
82 | 82 | } |
83 | - if($row['type'] == '40') { |
|
83 | + if ($row['type'] == '40') { |
|
84 | 84 | $snids[$i] = $row['resource']; |
85 | 85 | } |
86 | 86 | } |
@@ -88,28 +88,28 @@ discard block |
||
88 | 88 | $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
89 | 89 | $guid = $modx->db->getValue($ds); |
90 | 90 | // reset moduleguid for deleted resources |
91 | - if(($cp = count($plids)) || ($cs = count($snids))) { |
|
92 | - if($cp) { |
|
93 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
91 | + if (($cp = count($plids)) || ($cs = count($snids))) { |
|
92 | + if ($cp) { |
|
93 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (".implode(',', $plids).") AND moduleguid='{$guid}'"); |
|
94 | 94 | } |
95 | - if($cs) { |
|
96 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
95 | + if ($cs) { |
|
96 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (".implode(',', $snids).") AND moduleguid='{$guid}'"); |
|
97 | 97 | } |
98 | 98 | // reset cache |
99 | 99 | $modx->clearCache('full'); |
100 | 100 | } |
101 | - $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
101 | + $modx->db->delete($tbl_site_module_depobj, "id IN (".implode(',', $opids).")"); |
|
102 | 102 | break; |
103 | 103 | } |
104 | 104 | |
105 | 105 | // load record |
106 | 106 | $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'"); |
107 | 107 | $content = $modx->db->getRow($rs); |
108 | -if(!$content) { |
|
108 | +if (!$content) { |
|
109 | 109 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
110 | 110 | } |
111 | 111 | $_SESSION['itemname'] = $content['name']; |
112 | -if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
112 | +if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
113 | 113 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
114 | 114 | } |
115 | 115 | |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | <input type="hidden" name="id" value="<?php echo $content['id']; ?>" /> |
189 | 189 | |
190 | 190 | <h1> |
191 | - <i class="fa fa-cogs"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['module_resource_title']) ?> |
|
191 | + <i class="fa fa-cogs"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['module_resource_title']) ?> |
|
192 | 192 | </h1> |
193 | 193 | |
194 | 194 | <?php echo $_style['actionbuttons']['dynamic']['close'] ?> |
195 | 195 | |
196 | 196 | <div class="section"> |
197 | - <div class="sectionHeader"><?php echo $content["name"] . " - " . $_lang['module_resource_title']; ?></div> |
|
197 | + <div class="sectionHeader"><?php echo $content["name"]." - ".$_lang['module_resource_title']; ?></div> |
|
198 | 198 | <div class="sectionBody"> |
199 | 199 | <p><?php echo $_lang['module_resource_msg']; ?></p> |
200 | 200 | <br /> |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40' |
219 | 219 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50' |
220 | 220 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name"); |
221 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
221 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
222 | 222 | $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
223 | 223 | $grd->noRecordMsg = $_lang["no_records_found"]; |
224 | 224 | $grd->cssClass = "grid"; |
225 | 225 | $grd->columnHeaderClass = "gridHeader"; |
226 | 226 | $grd->itemClass = "gridItem"; |
227 | 227 | $grd->altItemClass = "gridAltItem"; |
228 | - $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
228 | + $grd->columns = $_lang["element_name"]." ,".$_lang["type"]; |
|
229 | 229 | $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
230 | 230 | $grd->fields = "name,type"; |
231 | 231 | echo $grd->render(); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
23 | 23 | { |
24 | - $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
|
24 | + $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | foreach( $cm->getCategories() as $category ) |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | |
107 | 107 | if( empty( $category ) ) |
108 | 108 | { |
109 | - $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
110 | - return; |
|
109 | + $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
110 | + return; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | if( $cm->isCategoryExists( $category ) ) |
114 | 114 | { |
115 | - $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
116 | - return; |
|
115 | + $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
116 | + return; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | if( $cm->addCategory( $category, $rank ) !== 0 ) |
@@ -2,16 +2,16 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Ajax Requests |
4 | 4 | */ |
5 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
5 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
7 | 7 | } |
8 | 8 | |
9 | -if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) |
|
9 | +if (isset($_REQUEST[$cm->get('request_key')]['ajax'])) |
|
10 | 10 | { |
11 | 11 | $_data = $_REQUEST[$cm->get('request_key')]; |
12 | 12 | $output = ''; |
13 | 13 | $task = $_data['task']; |
14 | - switch( $task ) |
|
14 | + switch ($task) |
|
15 | 15 | { |
16 | 16 | /** |
17 | 17 | * get categories |
@@ -19,19 +19,19 @@ discard block |
||
19 | 19 | case 'categorize_load_elements': |
20 | 20 | $elements = $_data['elements']; |
21 | 21 | |
22 | - if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
|
22 | + if ($uncategorized_elements = $cm->getAssignedElements(0, $_data['elements'])) |
|
23 | 23 | { |
24 | 24 | $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
25 | 25 | } |
26 | 26 | |
27 | - foreach( $cm->getCategories() as $category ) |
|
27 | + foreach ($cm->getCategories() as $category) |
|
28 | 28 | { |
29 | - $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] ); |
|
29 | + $category['elements'] = $cm->getAssignedElements($category['id'], $_data['elements']); |
|
30 | 30 | $output .= $cm->renderView('chunks/categorize/category', $category); |
31 | 31 | } |
32 | 32 | break; |
33 | 33 | } |
34 | - exit( $output ); |
|
34 | + exit($output); |
|
35 | 35 | } |
36 | 36 | /** |
37 | 37 | * Categorize elements |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476 |
42 | 42 | * |
43 | 43 | */ |
44 | -if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) |
|
44 | +if (isset($_POST[$cm->get('request_key')]['categorize']['submit'])) |
|
45 | 45 | { |
46 | 46 | $_data = $_POST[$cm->get('request_key')]['categorize']; |
47 | 47 | $_changes = 0; |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | 'categorize' |
55 | 55 | ); |
56 | 56 | |
57 | - if( !isset( $_data['elements'] ) ) |
|
57 | + if (!isset($_data['elements'])) |
|
58 | 58 | { |
59 | - $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' ); |
|
59 | + $cm->addMessage($cm->txt('cm_unknown_error'), 'categorize'); |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | - foreach( $_data['elements'] as $element_id => $data ) |
|
63 | + foreach ($_data['elements'] as $element_id => $data) |
|
64 | 64 | { |
65 | - if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) |
|
65 | + if ($cm->updateElement($_data['elementsgroup'], $element_id, $data['category_id'])) |
|
66 | 66 | { |
67 | 67 | $cm->addMessage( |
68 | 68 | sprintf( |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - if( $_changes === 0 ) |
|
81 | + if ($_changes === 0) |
|
82 | 82 | { |
83 | - $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' ); |
|
83 | + $cm->addMessage($cm->txt('cm_no_categorization'), 'categorize'); |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | else |
@@ -98,29 +98,29 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Add a new category |
100 | 100 | */ |
101 | -if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) |
|
101 | +if (isset($_POST[$cm->get('request_key')]['add']['submit'])) |
|
102 | 102 | { |
103 | 103 | $_data = $_POST[$cm->get('request_key')]['add']['data']; |
104 | - $category = trim( html_entity_decode($_data['name']) ); |
|
104 | + $category = trim(html_entity_decode($_data['name'])); |
|
105 | 105 | $rank = (int) $_data['rank']; |
106 | 106 | |
107 | - if( empty( $category ) ) |
|
107 | + if (empty($category)) |
|
108 | 108 | { |
109 | - $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
109 | + $cm->addMessage($cm->txt('cm_enter_name_for_category'), 'add'); |
|
110 | 110 | return; |
111 | 111 | } |
112 | 112 | |
113 | - if( $cm->isCategoryExists( $category ) ) |
|
113 | + if ($cm->isCategoryExists($category)) |
|
114 | 114 | { |
115 | - $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
115 | + $cm->addMessage(sprintf($cm->txt('cm_category_x_exists'), $category), 'add'); |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | |
119 | - if( $cm->addCategory( $category, $rank ) !== 0 ) |
|
119 | + if ($cm->addCategory($category, $rank) !== 0) |
|
120 | 120 | { |
121 | 121 | $cm->addMessage( |
122 | 122 | sprintf( |
123 | - $cm->txt( 'cm_category_x_saved_at_position_y' ), |
|
123 | + $cm->txt('cm_category_x_saved_at_position_y'), |
|
124 | 124 | $category, |
125 | 125 | $rank |
126 | 126 | ), |
@@ -129,26 +129,26 @@ discard block |
||
129 | 129 | } |
130 | 130 | else |
131 | 131 | { |
132 | - $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' ); |
|
132 | + $cm->addMessage($cm->txt('cm_unknown_error'), 'add'); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Sort categories |
138 | 138 | */ |
139 | -if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) |
|
139 | +if (isset($_POST[$cm->get('request_key')]['sort']['submit'])) |
|
140 | 140 | { |
141 | 141 | $categories = $_POST[$cm->get('request_key')]['sort']['data']; |
142 | 142 | $_changes = 0; |
143 | 143 | |
144 | - foreach( $categories as $category_id => $_data ) |
|
144 | + foreach ($categories as $category_id => $_data) |
|
145 | 145 | { |
146 | 146 | $data = array( |
147 | - 'category' => urldecode( $_data['category'] ), |
|
147 | + 'category' => urldecode($_data['category']), |
|
148 | 148 | 'rank' => $_data['rank'] |
149 | 149 | ); |
150 | 150 | |
151 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
151 | + if ($cm->updateCategory($category_id, $data)) |
|
152 | 152 | { |
153 | 153 | $cm->addMessage( |
154 | 154 | sprintf( |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - if( $_changes === 0 ) |
|
165 | + if ($_changes === 0) |
|
166 | 166 | { |
167 | - $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort'); |
|
167 | + $cm->addMessage($cm->txt('cm_no_changes'), 'sort'); |
|
168 | 168 | } |
169 | 169 | else |
170 | 170 | { |
@@ -181,21 +181,21 @@ discard block |
||
181 | 181 | /** |
182 | 182 | * Edit categories |
183 | 183 | */ |
184 | -if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) |
|
184 | +if (isset($_POST[$cm->get('request_key')]['edit']['submit'])) |
|
185 | 185 | { |
186 | 186 | $categories = $_POST[$cm->get('request_key')]['edit']['data']; |
187 | 187 | $_changes = 0; |
188 | 188 | |
189 | - foreach( $categories as $category_id => $_data ) |
|
189 | + foreach ($categories as $category_id => $_data) |
|
190 | 190 | { |
191 | - if( isset( $_data['delete'] ) ) |
|
191 | + if (isset($_data['delete'])) |
|
192 | 192 | { |
193 | - if( $cm->deleteCategory( $category_id ) ) |
|
193 | + if ($cm->deleteCategory($category_id)) |
|
194 | 194 | { |
195 | 195 | $cm->addMessage( |
196 | 196 | sprintf( |
197 | 197 | $cm->txt('cm_category_x_deleted'), |
198 | - urldecode( $_data['origin'] ) |
|
198 | + urldecode($_data['origin']) |
|
199 | 199 | ), |
200 | 200 | 'edit' |
201 | 201 | ); |
@@ -205,16 +205,16 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | $data = array( |
208 | - 'category' => trim( html_entity_decode( $_data['category'] ) ), |
|
208 | + 'category' => trim(html_entity_decode($_data['category'])), |
|
209 | 209 | 'rank' => $_data['rank'] |
210 | 210 | ); |
211 | 211 | |
212 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
212 | + if ($cm->updateCategory($category_id, $data)) |
|
213 | 213 | { |
214 | 214 | $cm->addMessage( |
215 | 215 | sprintf( |
216 | 216 | $cm->txt('cm_category_x_renamed_to_y'), |
217 | - urldecode( $_data['origin'] ), |
|
217 | + urldecode($_data['origin']), |
|
218 | 218 | $data['category'] |
219 | 219 | ), |
220 | 220 | 'edit' |
@@ -223,26 +223,26 @@ discard block |
||
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | - if( $_changes === 0 ) |
|
226 | + if ($_changes === 0) |
|
227 | 227 | { |
228 | - $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit'); |
|
228 | + $cm->addMessage($cm->txt('cm_no_changes'), 'edit'); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Delete singel category by $_GET |
234 | 234 | */ |
235 | -if( isset( $_GET[$cm->get('request_key')]['delete'] ) |
|
236 | - && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) |
|
235 | +if (isset($_GET[$cm->get('request_key')]['delete']) |
|
236 | + && !empty($_GET[$cm->get('request_key')]['delete'])) |
|
237 | 237 | { |
238 | - $category_id = (int)$_GET[$cm->get('request_key')]['delete']; |
|
238 | + $category_id = (int) $_GET[$cm->get('request_key')]['delete']; |
|
239 | 239 | |
240 | - if( $cm->deleteCategory( $category_id ) ) |
|
240 | + if ($cm->deleteCategory($category_id)) |
|
241 | 241 | { |
242 | 242 | $cm->addMessage( |
243 | 243 | sprintf( |
244 | 244 | $cm->txt('cm_category_x_deleted'), |
245 | - urldecode( $_GET[$cm->get('request_key')]['category'] ) |
|
245 | + urldecode($_GET[$cm->get('request_key')]['category']) |
|
246 | 246 | ), |
247 | 247 | 'edit' |
248 | 248 | ); |
@@ -251,15 +251,15 @@ discard block |
||
251 | 251 | /** |
252 | 252 | * Translate phrases |
253 | 253 | */ |
254 | -if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) |
|
254 | +if (isset($_POST[$cm->get('request_key')]['translate']['submit'])) |
|
255 | 255 | { |
256 | 256 | $translations = $_POST[$cm->get('request_key')]['translate']['data']; |
257 | 257 | |
258 | - foreach( $translations as $native_phrase => $translation ) |
|
258 | + foreach ($translations as $native_phrase => $translation) |
|
259 | 259 | { |
260 | - $native_phrase = urldecode( $native_phrase ); |
|
260 | + $native_phrase = urldecode($native_phrase); |
|
261 | 261 | |
262 | - if( empty( $translation ) ) |
|
262 | + if (empty($translation)) |
|
263 | 263 | { |
264 | 264 | $translation = $native_phrase; |
265 | 265 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | ); |
273 | 273 | } |
274 | 274 | |
275 | - $cm->c('Translator')->addTranslation( $native_phrase, $translation, 'phrase' ); |
|
275 | + $cm->c('Translator')->addTranslation($native_phrase, $translation, 'phrase'); |
|
276 | 276 | |
277 | 277 | $cm->addMessage( |
278 | 278 | sprintf( |
@@ -6,26 +6,22 @@ discard block |
||
6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
7 | 7 | } |
8 | 8 | |
9 | -if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) |
|
10 | -{ |
|
9 | +if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) { |
|
11 | 10 | $_data = $_REQUEST[$cm->get('request_key')]; |
12 | 11 | $output = ''; |
13 | 12 | $task = $_data['task']; |
14 | - switch( $task ) |
|
15 | - { |
|
13 | + switch( $task ) { |
|
16 | 14 | /** |
17 | 15 | * get categories |
18 | 16 | */ |
19 | 17 | case 'categorize_load_elements': |
20 | 18 | $elements = $_data['elements']; |
21 | 19 | |
22 | - if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
|
23 | - { |
|
20 | + if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) { |
|
24 | 21 | $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
25 | 22 | } |
26 | 23 | |
27 | - foreach( $cm->getCategories() as $category ) |
|
28 | - { |
|
24 | + foreach( $cm->getCategories() as $category ) { |
|
29 | 25 | $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] ); |
30 | 26 | $output .= $cm->renderView('chunks/categorize/category', $category); |
31 | 27 | } |
@@ -41,8 +37,7 @@ discard block |
||
41 | 37 | * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476 |
42 | 38 | * |
43 | 39 | */ |
44 | -if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) |
|
45 | -{ |
|
40 | +if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) { |
|
46 | 41 | $_data = $_POST[$cm->get('request_key')]['categorize']; |
47 | 42 | $_changes = 0; |
48 | 43 | |
@@ -54,16 +49,13 @@ discard block |
||
54 | 49 | 'categorize' |
55 | 50 | ); |
56 | 51 | |
57 | - if( !isset( $_data['elements'] ) ) |
|
58 | - { |
|
52 | + if( !isset( $_data['elements'] ) ) { |
|
59 | 53 | $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' ); |
60 | 54 | return; |
61 | 55 | } |
62 | 56 | |
63 | - foreach( $_data['elements'] as $element_id => $data ) |
|
64 | - { |
|
65 | - if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) |
|
66 | - { |
|
57 | + foreach( $_data['elements'] as $element_id => $data ) { |
|
58 | + if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) { |
|
67 | 59 | $cm->addMessage( |
68 | 60 | sprintf( |
69 | 61 | $cm->txt('cm_x_assigned_to_category_y'), |
@@ -78,13 +70,10 @@ discard block |
||
78 | 70 | } |
79 | 71 | } |
80 | 72 | |
81 | - if( $_changes === 0 ) |
|
82 | - { |
|
73 | + if( $_changes === 0 ) { |
|
83 | 74 | $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' ); |
84 | 75 | return; |
85 | - } |
|
86 | - else |
|
87 | - { |
|
76 | + } else { |
|
88 | 77 | $cm->addMessage( |
89 | 78 | sprintf( |
90 | 79 | $cm->txt('cm_x_changes_made'), |
@@ -98,26 +87,22 @@ discard block |
||
98 | 87 | /** |
99 | 88 | * Add a new category |
100 | 89 | */ |
101 | -if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) |
|
102 | -{ |
|
90 | +if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) { |
|
103 | 91 | $_data = $_POST[$cm->get('request_key')]['add']['data']; |
104 | 92 | $category = trim( html_entity_decode($_data['name']) ); |
105 | 93 | $rank = (int) $_data['rank']; |
106 | 94 | |
107 | - if( empty( $category ) ) |
|
108 | - { |
|
95 | + if( empty( $category ) ) { |
|
109 | 96 | $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
110 | 97 | return; |
111 | 98 | } |
112 | 99 | |
113 | - if( $cm->isCategoryExists( $category ) ) |
|
114 | - { |
|
100 | + if( $cm->isCategoryExists( $category ) ) { |
|
115 | 101 | $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
116 | 102 | return; |
117 | 103 | } |
118 | 104 | |
119 | - if( $cm->addCategory( $category, $rank ) !== 0 ) |
|
120 | - { |
|
105 | + if( $cm->addCategory( $category, $rank ) !== 0 ) { |
|
121 | 106 | $cm->addMessage( |
122 | 107 | sprintf( |
123 | 108 | $cm->txt( 'cm_category_x_saved_at_position_y' ), |
@@ -126,9 +111,7 @@ discard block |
||
126 | 111 | ), |
127 | 112 | 'add' |
128 | 113 | ); |
129 | - } |
|
130 | - else |
|
131 | - { |
|
114 | + } else { |
|
132 | 115 | $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' ); |
133 | 116 | } |
134 | 117 | } |
@@ -136,20 +119,17 @@ discard block |
||
136 | 119 | /** |
137 | 120 | * Sort categories |
138 | 121 | */ |
139 | -if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) |
|
140 | -{ |
|
122 | +if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) { |
|
141 | 123 | $categories = $_POST[$cm->get('request_key')]['sort']['data']; |
142 | 124 | $_changes = 0; |
143 | 125 | |
144 | - foreach( $categories as $category_id => $_data ) |
|
145 | - { |
|
126 | + foreach( $categories as $category_id => $_data ) { |
|
146 | 127 | $data = array( |
147 | 128 | 'category' => urldecode( $_data['category'] ), |
148 | 129 | 'rank' => $_data['rank'] |
149 | 130 | ); |
150 | 131 | |
151 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
152 | - { |
|
132 | + if( $cm->updateCategory( $category_id, $data ) ) { |
|
153 | 133 | $cm->addMessage( |
154 | 134 | sprintf( |
155 | 135 | $cm->txt('cm_category_x_moved_to_position_y'), |
@@ -162,12 +142,9 @@ discard block |
||
162 | 142 | } |
163 | 143 | } |
164 | 144 | |
165 | - if( $_changes === 0 ) |
|
166 | - { |
|
145 | + if( $_changes === 0 ) { |
|
167 | 146 | $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort'); |
168 | - } |
|
169 | - else |
|
170 | - { |
|
147 | + } else { |
|
171 | 148 | $cm->addMessage( |
172 | 149 | sprintf( |
173 | 150 | $cm->txt('cm_x_changes_made'), |
@@ -181,17 +158,13 @@ discard block |
||
181 | 158 | /** |
182 | 159 | * Edit categories |
183 | 160 | */ |
184 | -if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) |
|
185 | -{ |
|
161 | +if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) { |
|
186 | 162 | $categories = $_POST[$cm->get('request_key')]['edit']['data']; |
187 | 163 | $_changes = 0; |
188 | 164 | |
189 | - foreach( $categories as $category_id => $_data ) |
|
190 | - { |
|
191 | - if( isset( $_data['delete'] ) ) |
|
192 | - { |
|
193 | - if( $cm->deleteCategory( $category_id ) ) |
|
194 | - { |
|
165 | + foreach( $categories as $category_id => $_data ) { |
|
166 | + if( isset( $_data['delete'] ) ) { |
|
167 | + if( $cm->deleteCategory( $category_id ) ) { |
|
195 | 168 | $cm->addMessage( |
196 | 169 | sprintf( |
197 | 170 | $cm->txt('cm_category_x_deleted'), |
@@ -209,8 +182,7 @@ discard block |
||
209 | 182 | 'rank' => $_data['rank'] |
210 | 183 | ); |
211 | 184 | |
212 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
213 | - { |
|
185 | + if( $cm->updateCategory( $category_id, $data ) ) { |
|
214 | 186 | $cm->addMessage( |
215 | 187 | sprintf( |
216 | 188 | $cm->txt('cm_category_x_renamed_to_y'), |
@@ -223,8 +195,7 @@ discard block |
||
223 | 195 | } |
224 | 196 | } |
225 | 197 | |
226 | - if( $_changes === 0 ) |
|
227 | - { |
|
198 | + if( $_changes === 0 ) { |
|
228 | 199 | $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit'); |
229 | 200 | } |
230 | 201 | } |
@@ -233,12 +204,10 @@ discard block |
||
233 | 204 | * Delete singel category by $_GET |
234 | 205 | */ |
235 | 206 | if( isset( $_GET[$cm->get('request_key')]['delete'] ) |
236 | - && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) |
|
237 | -{ |
|
207 | + && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) { |
|
238 | 208 | $category_id = (int)$_GET[$cm->get('request_key')]['delete']; |
239 | 209 | |
240 | - if( $cm->deleteCategory( $category_id ) ) |
|
241 | - { |
|
210 | + if( $cm->deleteCategory( $category_id ) ) { |
|
242 | 211 | $cm->addMessage( |
243 | 212 | sprintf( |
244 | 213 | $cm->txt('cm_category_x_deleted'), |
@@ -251,16 +220,13 @@ discard block |
||
251 | 220 | /** |
252 | 221 | * Translate phrases |
253 | 222 | */ |
254 | -if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) |
|
255 | -{ |
|
223 | +if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) { |
|
256 | 224 | $translations = $_POST[$cm->get('request_key')]['translate']['data']; |
257 | 225 | |
258 | - foreach( $translations as $native_phrase => $translation ) |
|
259 | - { |
|
226 | + foreach( $translations as $native_phrase => $translation ) { |
|
260 | 227 | $native_phrase = urldecode( $native_phrase ); |
261 | 228 | |
262 | - if( empty( $translation ) ) |
|
263 | - { |
|
229 | + if( empty( $translation ) ) { |
|
264 | 230 | $translation = $native_phrase; |
265 | 231 | |
266 | 232 | $cm->addMessage( |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Class for MODx Categories Manager |
4 | 4 | */ |
5 | -if( !is_object( $modx ) |
|
6 | - || $modx->isBackend() === false ) |
|
5 | +if (!is_object($modx) |
|
6 | + || $modx->isBackend() === false) |
|
7 | 7 | { |
8 | 8 | die('Please use the MODx Backend.'); |
9 | 9 | } |
10 | 10 | |
11 | -require_once realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'Categories.php'; |
|
11 | +require_once realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Categories.php'; |
|
12 | 12 | |
13 | 13 | class Module_Categories_Manager extends Categories |
14 | 14 | { |
@@ -37,19 +37,19 @@ discard block |
||
37 | 37 | * @return mixed return the parameter value if exists, otherwise false |
38 | 38 | * @param string $key Paramter-key |
39 | 39 | */ |
40 | - public function get( $key ) |
|
40 | + public function get($key) |
|
41 | 41 | { |
42 | 42 | global $modx; |
43 | 43 | |
44 | - if( isset( $this->params[$key] ) ) |
|
44 | + if (isset($this->params[$key])) |
|
45 | 45 | { |
46 | 46 | return $this->params[$key]; |
47 | 47 | } |
48 | - elseif( isset( $modx->config[$key] ) ) |
|
48 | + elseif (isset($modx->config[$key])) |
|
49 | 49 | { |
50 | 50 | return $modx->config[$key]; |
51 | 51 | } |
52 | - elseif( isset( $modx->event->params[$key] ) ) |
|
52 | + elseif (isset($modx->event->params[$key])) |
|
53 | 53 | { |
54 | 54 | return $modx->event->params[$key]; |
55 | 55 | } |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | - public function addMessage( $message, $namespace = 'default' ) |
|
60 | + public function addMessage($message, $namespace = 'default') |
|
61 | 61 | { |
62 | 62 | $this->params['messages'][$namespace][] = $message; |
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | - public function getMessages( $namespace = 'default' ) |
|
66 | + public function getMessages($namespace = 'default') |
|
67 | 67 | { |
68 | - if( isset( $this->params['messages'][$namespace] ) ) |
|
68 | + if (isset($this->params['messages'][$namespace])) |
|
69 | 69 | { |
70 | 70 | return $this->params['messages'][$namespace]; |
71 | 71 | } |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | - public function renderView( $view_name, $data = array() ) |
|
76 | + public function renderView($view_name, $data = array()) |
|
77 | 77 | { |
78 | 78 | global $_lang, $_style; |
79 | 79 | |
80 | - $filename = trim( $view_name ) . '.tpl.phtml'; |
|
81 | - $file = self::get('views_dir') . $filename; |
|
80 | + $filename = trim($view_name).'.tpl.phtml'; |
|
81 | + $file = self::get('views_dir').$filename; |
|
82 | 82 | $view = & $this; |
83 | 83 | |
84 | - if( is_file( $file ) |
|
85 | - && is_readable( $file ) ) |
|
84 | + if (is_file($file) |
|
85 | + && is_readable($file)) |
|
86 | 86 | { |
87 | 87 | include $file; |
88 | 88 | } |
@@ -96,28 +96,28 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - public function updateElement( $element, $element_id, $category_id ) |
|
99 | + public function updateElement($element, $element_id, $category_id) |
|
100 | 100 | { |
101 | 101 | |
102 | 102 | $_update = array( |
103 | - 'id' => (int)$element_id, |
|
104 | - 'category' => (int)$category_id |
|
103 | + 'id' => (int) $element_id, |
|
104 | + 'category' => (int) $category_id |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | $this->db->update( |
108 | 108 | $_update, |
109 | 109 | $this->db_tbl[$element], |
110 | - "`id` = '" . (int)$element_id . "'" |
|
110 | + "`id` = '".(int) $element_id."'" |
|
111 | 111 | ); |
112 | 112 | |
113 | 113 | return $this->db->getAffectedRows() === 1; |
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | - public function txt( $txt ) |
|
117 | + public function txt($txt) |
|
118 | 118 | { |
119 | 119 | global $_lang; |
120 | - if(isset($_lang[$txt])) return $_lang[$txt]; |
|
120 | + if (isset($_lang[$txt])) return $_lang[$txt]; |
|
121 | 121 | return $txt; |
122 | 122 | } |
123 | 123 | } |
@@ -3,8 +3,7 @@ discard block |
||
3 | 3 | * Class for MODx Categories Manager |
4 | 4 | */ |
5 | 5 | if( !is_object( $modx ) |
6 | - || $modx->isBackend() === false ) |
|
7 | -{ |
|
6 | + || $modx->isBackend() === false ) { |
|
8 | 7 | die('Please use the MODx Backend.'); |
9 | 8 | } |
10 | 9 | |
@@ -41,16 +40,11 @@ discard block |
||
41 | 40 | { |
42 | 41 | global $modx; |
43 | 42 | |
44 | - if( isset( $this->params[$key] ) ) |
|
45 | - { |
|
43 | + if( isset( $this->params[$key] ) ) { |
|
46 | 44 | return $this->params[$key]; |
47 | - } |
|
48 | - elseif( isset( $modx->config[$key] ) ) |
|
49 | - { |
|
45 | + } elseif( isset( $modx->config[$key] ) ) { |
|
50 | 46 | return $modx->config[$key]; |
51 | - } |
|
52 | - elseif( isset( $modx->event->params[$key] ) ) |
|
53 | - { |
|
47 | + } elseif( isset( $modx->event->params[$key] ) ) { |
|
54 | 48 | return $modx->event->params[$key]; |
55 | 49 | } |
56 | 50 | return false; |
@@ -65,8 +59,7 @@ discard block |
||
65 | 59 | |
66 | 60 | public function getMessages( $namespace = 'default' ) |
67 | 61 | { |
68 | - if( isset( $this->params['messages'][$namespace] ) ) |
|
69 | - { |
|
62 | + if( isset( $this->params['messages'][$namespace] ) ) { |
|
70 | 63 | return $this->params['messages'][$namespace]; |
71 | 64 | } |
72 | 65 | return false; |
@@ -82,12 +75,9 @@ discard block |
||
82 | 75 | $view = & $this; |
83 | 76 | |
84 | 77 | if( is_file( $file ) |
85 | - && is_readable( $file ) ) |
|
86 | - { |
|
78 | + && is_readable( $file ) ) { |
|
87 | 79 | include $file; |
88 | - } |
|
89 | - else |
|
90 | - { |
|
80 | + } else { |
|
91 | 81 | echo sprintf( |
92 | 82 | 'View "%s<strong>%s</strong>" not found.', |
93 | 83 | self::get('views_dir'), |
@@ -117,7 +107,9 @@ discard block |
||
117 | 107 | public function txt( $txt ) |
118 | 108 | { |
119 | 109 | global $_lang; |
120 | - if(isset($_lang[$txt])) return $_lang[$txt]; |
|
110 | + if(isset($_lang[$txt])) { |
|
111 | + return $_lang[$txt]; |
|
112 | + } |
|
121 | 113 | return $txt; |
122 | 114 | } |
123 | 115 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | { |
7 | 7 | public $db = ''; |
8 | 8 | public $db_tbl = array(); |
9 | - public $elements = array( 'templates', 'tmplvars', 'htmlsnippets', 'snippets', 'plugins', 'modules' ); |
|
9 | + public $elements = array('templates', 'tmplvars', 'htmlsnippets', 'snippets', 'plugins', 'modules'); |
|
10 | 10 | |
11 | 11 | public function __construct() |
12 | 12 | { |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $this->db = & $modx->db; |
16 | 16 | $this->db_tbl['categories'] = $modx->getFullTableName('categories'); |
17 | 17 | |
18 | - foreach( $this->elements as $element ) |
|
18 | + foreach ($this->elements as $element) |
|
19 | 19 | { |
20 | - $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element ); |
|
20 | + $this->db_tbl[$element] = $modx->getFullTableName('site_'.$element); |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
@@ -37,54 +37,54 @@ discard block |
||
37 | 37 | ) |
38 | 38 | ); |
39 | 39 | |
40 | - if( !empty( $categories ) ) |
|
40 | + if (!empty($categories)) |
|
41 | 41 | { |
42 | 42 | return $categories; |
43 | 43 | } |
44 | 44 | return false; |
45 | 45 | } |
46 | 46 | |
47 | - public function getCategory( $search, $where = 'category' ) |
|
47 | + public function getCategory($search, $where = 'category') |
|
48 | 48 | { |
49 | 49 | $category = $this->db->getRow( |
50 | 50 | $this->db->select( |
51 | 51 | '*', |
52 | 52 | $this->db_tbl['categories'], |
53 | - "`" . $where . "` = '" . $search . "'" |
|
53 | + "`".$where."` = '".$search."'" |
|
54 | 54 | ) |
55 | 55 | ); |
56 | 56 | return $category; |
57 | 57 | } |
58 | 58 | |
59 | - public function getCategoryValue( $value, $search, $where = 'category' ) |
|
59 | + public function getCategoryValue($value, $search, $where = 'category') |
|
60 | 60 | { |
61 | 61 | $_value = $this->db->getValue( |
62 | 62 | $this->db->select( |
63 | - '`' . $value . '`', |
|
63 | + '`'.$value.'`', |
|
64 | 64 | $this->db_tbl['categories'], |
65 | - "`" . $where . "` = '" . $search . "'" |
|
65 | + "`".$where."` = '".$search."'" |
|
66 | 66 | ) |
67 | 67 | ); |
68 | 68 | return $_value; |
69 | 69 | } |
70 | 70 | |
71 | - public function getAssignedElements( $category_id, $element ) |
|
71 | + public function getAssignedElements($category_id, $element) |
|
72 | 72 | { |
73 | - if( in_array( $element, $this->elements, true ) ) |
|
73 | + if (in_array($element, $this->elements, true)) |
|
74 | 74 | { |
75 | 75 | $elements = $this->db->makeArray( |
76 | 76 | $this->db->select( |
77 | 77 | '*', |
78 | 78 | $this->db_tbl[$element], |
79 | - "`category` = '" . $category_id . "'" |
|
79 | + "`category` = '".$category_id."'" |
|
80 | 80 | ) |
81 | 81 | ); |
82 | 82 | |
83 | 83 | // correct the name of templates |
84 | - if( $element === 'templates' ) |
|
84 | + if ($element === 'templates') |
|
85 | 85 | { |
86 | 86 | $_elements_count = count($elements); |
87 | - for( $i=0; $i < $_elements_count; $i++ ) |
|
87 | + for ($i = 0; $i < $_elements_count; $i++) |
|
88 | 88 | { |
89 | 89 | $elements[$i]['name'] = $elements[$i]['templatename']; |
90 | 90 | } |
@@ -94,56 +94,56 @@ discard block |
||
94 | 94 | return false; |
95 | 95 | } |
96 | 96 | |
97 | - public function getAllAssignedElements( $category_id ) |
|
97 | + public function getAllAssignedElements($category_id) |
|
98 | 98 | { |
99 | 99 | $elements = array(); |
100 | - foreach( $this->elements as $element ) |
|
100 | + foreach ($this->elements as $element) |
|
101 | 101 | { |
102 | - $elements[$element] = $this->getAssignedElements( $category_id, $element ); |
|
102 | + $elements[$element] = $this->getAssignedElements($category_id, $element); |
|
103 | 103 | } |
104 | 104 | return $elements; |
105 | 105 | } |
106 | 106 | |
107 | - public function deleteCategory( $category_id ) |
|
107 | + public function deleteCategory($category_id) |
|
108 | 108 | { |
109 | 109 | $_update = array('category' => 0); |
110 | - foreach( $this->elements as $element ) |
|
110 | + foreach ($this->elements as $element) |
|
111 | 111 | { |
112 | 112 | $this->db->update( |
113 | 113 | $_update, |
114 | 114 | $this->db_tbl[$element], |
115 | - "`category` = '" . $category_id . "'" |
|
115 | + "`category` = '".$category_id."'" |
|
116 | 116 | ); |
117 | 117 | } |
118 | 118 | |
119 | 119 | $this->db->delete( |
120 | 120 | $this->db_tbl['categories'], |
121 | - "`id` = '" . $category_id . "'" |
|
121 | + "`id` = '".$category_id."'" |
|
122 | 122 | ); |
123 | 123 | |
124 | 124 | return $this->db->getAffectedRows() === 1; |
125 | 125 | } |
126 | 126 | |
127 | - public function updateCategory( $category_id, $data = array() ) |
|
127 | + public function updateCategory($category_id, $data = array()) |
|
128 | 128 | { |
129 | - if( empty( $data ) |
|
130 | - || empty( $category_id ) ) |
|
129 | + if (empty($data) |
|
130 | + || empty($category_id)) |
|
131 | 131 | { |
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
135 | 135 | $_update = array( |
136 | - 'category' => $this->db->escape( $data['category'] ), |
|
137 | - 'rank' => (int)$data['rank'] |
|
136 | + 'category' => $this->db->escape($data['category']), |
|
137 | + 'rank' => (int) $data['rank'] |
|
138 | 138 | ); |
139 | 139 | |
140 | 140 | $this->db->update( |
141 | 141 | $_update, |
142 | 142 | $this->db_tbl['categories'], |
143 | - "`id` = '" . (int)$category_id . "'" |
|
143 | + "`id` = '".(int) $category_id."'" |
|
144 | 144 | ); |
145 | 145 | |
146 | - if( $this->db->getAffectedRows() === 1 ) |
|
146 | + if ($this->db->getAffectedRows() === 1) |
|
147 | 147 | { |
148 | 148 | return true; |
149 | 149 | } |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | |
154 | - public function addCategory( $category_name, $category_rank ) |
|
154 | + public function addCategory($category_name, $category_rank) |
|
155 | 155 | { |
156 | - if( $this->isCategoryExists( $category_name ) ) |
|
156 | + if ($this->isCategoryExists($category_name)) |
|
157 | 157 | { |
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | |
161 | 161 | $_insert = array( |
162 | - 'category' => $this->db->escape( $category_name ), |
|
163 | - 'rank' => (int)$category_rank |
|
162 | + 'category' => $this->db->escape($category_name), |
|
163 | + 'rank' => (int) $category_rank |
|
164 | 164 | ); |
165 | 165 | |
166 | 166 | $this->db->insert( |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $this->db_tbl['categories'] |
169 | 169 | ); |
170 | 170 | |
171 | - if( $this->db->getAffectedRows() === 1 ) |
|
171 | + if ($this->db->getAffectedRows() === 1) |
|
172 | 172 | { |
173 | 173 | return $this->db->getInsertId(); |
174 | 174 | } |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | return false; |
177 | 177 | } |
178 | 178 | |
179 | - public function isCategoryExists( $category_name ) |
|
179 | + public function isCategoryExists($category_name) |
|
180 | 180 | { |
181 | - $category = $this->db->escape( $category_name ); |
|
181 | + $category = $this->db->escape($category_name); |
|
182 | 182 | |
183 | 183 | $category_id = $this->db->getValue( |
184 | 184 | $this->db->select( |
185 | 185 | '`id`', |
186 | 186 | $this->db_tbl['categories'], |
187 | - "`category` = '" . $category . "'" |
|
187 | + "`category` = '".$category."'" |
|
188 | 188 | ) |
189 | 189 | ); |
190 | 190 | |
191 | - if( $this->db->getAffectedRows() === 1 ) |
|
191 | + if ($this->db->getAffectedRows() === 1) |
|
192 | 192 | { |
193 | 193 | return $category_id; |
194 | 194 | } |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | $this->db = & $modx->db; |
16 | 16 | $this->db_tbl['categories'] = $modx->getFullTableName('categories'); |
17 | 17 | |
18 | - foreach( $this->elements as $element ) |
|
19 | - { |
|
18 | + foreach( $this->elements as $element ) { |
|
20 | 19 | $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element ); |
21 | 20 | } |
22 | 21 | } |
@@ -37,8 +36,7 @@ discard block |
||
37 | 36 | ) |
38 | 37 | ); |
39 | 38 | |
40 | - if( !empty( $categories ) ) |
|
41 | - { |
|
39 | + if( !empty( $categories ) ) { |
|
42 | 40 | return $categories; |
43 | 41 | } |
44 | 42 | return false; |
@@ -70,8 +68,7 @@ discard block |
||
70 | 68 | |
71 | 69 | public function getAssignedElements( $category_id, $element ) |
72 | 70 | { |
73 | - if( in_array( $element, $this->elements, true ) ) |
|
74 | - { |
|
71 | + if( in_array( $element, $this->elements, true ) ) { |
|
75 | 72 | $elements = $this->db->makeArray( |
76 | 73 | $this->db->select( |
77 | 74 | '*', |
@@ -81,11 +78,9 @@ discard block |
||
81 | 78 | ); |
82 | 79 | |
83 | 80 | // correct the name of templates |
84 | - if( $element === 'templates' ) |
|
85 | - { |
|
81 | + if( $element === 'templates' ) { |
|
86 | 82 | $_elements_count = count($elements); |
87 | - for( $i=0; $i < $_elements_count; $i++ ) |
|
88 | - { |
|
83 | + for( $i=0; $i < $_elements_count; $i++ ) { |
|
89 | 84 | $elements[$i]['name'] = $elements[$i]['templatename']; |
90 | 85 | } |
91 | 86 | } |
@@ -97,8 +92,7 @@ discard block |
||
97 | 92 | public function getAllAssignedElements( $category_id ) |
98 | 93 | { |
99 | 94 | $elements = array(); |
100 | - foreach( $this->elements as $element ) |
|
101 | - { |
|
95 | + foreach( $this->elements as $element ) { |
|
102 | 96 | $elements[$element] = $this->getAssignedElements( $category_id, $element ); |
103 | 97 | } |
104 | 98 | return $elements; |
@@ -107,8 +101,7 @@ discard block |
||
107 | 101 | public function deleteCategory( $category_id ) |
108 | 102 | { |
109 | 103 | $_update = array('category' => 0); |
110 | - foreach( $this->elements as $element ) |
|
111 | - { |
|
104 | + foreach( $this->elements as $element ) { |
|
112 | 105 | $this->db->update( |
113 | 106 | $_update, |
114 | 107 | $this->db_tbl[$element], |
@@ -127,8 +120,7 @@ discard block |
||
127 | 120 | public function updateCategory( $category_id, $data = array() ) |
128 | 121 | { |
129 | 122 | if( empty( $data ) |
130 | - || empty( $category_id ) ) |
|
131 | - { |
|
123 | + || empty( $category_id ) ) { |
|
132 | 124 | return false; |
133 | 125 | } |
134 | 126 | |
@@ -143,8 +135,7 @@ discard block |
||
143 | 135 | "`id` = '" . (int)$category_id . "'" |
144 | 136 | ); |
145 | 137 | |
146 | - if( $this->db->getAffectedRows() === 1 ) |
|
147 | - { |
|
138 | + if( $this->db->getAffectedRows() === 1 ) { |
|
148 | 139 | return true; |
149 | 140 | } |
150 | 141 | |
@@ -153,8 +144,7 @@ discard block |
||
153 | 144 | |
154 | 145 | public function addCategory( $category_name, $category_rank ) |
155 | 146 | { |
156 | - if( $this->isCategoryExists( $category_name ) ) |
|
157 | - { |
|
147 | + if( $this->isCategoryExists( $category_name ) ) { |
|
158 | 148 | return false; |
159 | 149 | } |
160 | 150 | |
@@ -168,8 +158,7 @@ discard block |
||
168 | 158 | $this->db_tbl['categories'] |
169 | 159 | ); |
170 | 160 | |
171 | - if( $this->db->getAffectedRows() === 1 ) |
|
172 | - { |
|
161 | + if( $this->db->getAffectedRows() === 1 ) { |
|
173 | 162 | return $this->db->getInsertId(); |
174 | 163 | } |
175 | 164 | |
@@ -188,8 +177,7 @@ discard block |
||
188 | 177 | ) |
189 | 178 | ); |
190 | 179 | |
191 | - if( $this->db->getAffectedRows() === 1 ) |
|
192 | - { |
|
180 | + if( $this->db->getAffectedRows() === 1 ) { |
|
193 | 181 | return $category_id; |
194 | 182 | } |
195 | 183 | return false; |
@@ -1,9 +1,9 @@ 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 | if(!$modx->hasPermission('view_eventlog')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // get id |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | <div class="tab-page"> |
42 | 42 | <div class="container container-body"> |
43 | 43 | <?php |
44 | - $date = $modx->toDateFormat($content["createdon"]); |
|
45 | - if($content["type"] == 1) { |
|
46 | - $icon = $_style['actions_info'] . ' text-info'; |
|
47 | - $msgtype = $_lang["information"]; |
|
48 | - } else if($content["type"] == 2) { |
|
49 | - $icon = $_style['actions_triangle'] . ' text-warning'; |
|
50 | - $msgtype = $_lang["warning"]; |
|
51 | - } else if($content["type"] == 3) { |
|
52 | - $icon = $_style['actions_error'] . ' text-danger'; |
|
53 | - $msgtype = $_lang["error"]; |
|
54 | - } |
|
55 | - ?> |
|
44 | + $date = $modx->toDateFormat($content["createdon"]); |
|
45 | + if($content["type"] == 1) { |
|
46 | + $icon = $_style['actions_info'] . ' text-info'; |
|
47 | + $msgtype = $_lang["information"]; |
|
48 | + } else if($content["type"] == 2) { |
|
49 | + $icon = $_style['actions_triangle'] . ' text-warning'; |
|
50 | + $msgtype = $_lang["warning"]; |
|
51 | + } else if($content["type"] == 3) { |
|
52 | + $icon = $_style['actions_error'] . ' text-danger'; |
|
53 | + $msgtype = $_lang["error"]; |
|
54 | + } |
|
55 | + ?> |
|
56 | 56 | <p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p> |
57 | 57 | <p> |
58 | 58 | <i class="<?= $icon ?>"></i> <?= $msgtype ?> |
@@ -1,17 +1,17 @@ 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 | -if(!$modx->hasPermission('view_eventlog')) { |
|
5 | +if (!$modx->hasPermission('view_eventlog')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | 9 | // get id |
10 | 10 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
11 | 11 | |
12 | -$ds = $modx->db->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getFullTableName("event_log") . " el |
|
13 | - LEFT JOIN " . $modx->getFullTableName("manager_users") . " mu ON mu.id=el.user AND el.usertype=0 |
|
14 | - LEFT JOIN " . $modx->getFullTableName("web_users") . " wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'"); |
|
12 | +$ds = $modx->db->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getFullTableName("event_log")." el |
|
13 | + LEFT JOIN " . $modx->getFullTableName("manager_users")." mu ON mu.id=el.user AND el.usertype=0 |
|
14 | + LEFT JOIN " . $modx->getFullTableName("web_users")." wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'"); |
|
15 | 15 | $content = $modx->db->getRow($ds); |
16 | 16 | |
17 | 17 | ?> |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | <div class="container container-body"> |
43 | 43 | <?php |
44 | 44 | $date = $modx->toDateFormat($content["createdon"]); |
45 | - if($content["type"] == 1) { |
|
46 | - $icon = $_style['actions_info'] . ' text-info'; |
|
45 | + if ($content["type"] == 1) { |
|
46 | + $icon = $_style['actions_info'].' text-info'; |
|
47 | 47 | $msgtype = $_lang["information"]; |
48 | - } else if($content["type"] == 2) { |
|
49 | - $icon = $_style['actions_triangle'] . ' text-warning'; |
|
48 | + } else if ($content["type"] == 2) { |
|
49 | + $icon = $_style['actions_triangle'].' text-warning'; |
|
50 | 50 | $msgtype = $_lang["warning"]; |
51 | - } else if($content["type"] == 3) { |
|
52 | - $icon = $_style['actions_error'] . ' text-danger'; |
|
51 | + } else if ($content["type"] == 3) { |
|
52 | + $icon = $_style['actions_error'].' text-danger'; |
|
53 | 53 | $msgtype = $_lang["error"]; |
54 | 54 | } |
55 | 55 | ?> |
56 | - <p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p> |
|
56 | + <p><b><?= $content['source']." - ".$_lang['eventlog_viewer'] ?></b></p> |
|
57 | 57 | <p> |
58 | 58 | <i class="<?= $icon ?>"></i> <?= $msgtype ?> |
59 | 59 | </p> |