@@ -1,21 +1,21 @@ 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 | switch($modx->manager->action) { |
7 | - case 16: |
|
8 | - if(!$modx->hasPermission('edit_template')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 19: |
|
13 | - if(!$modx->hasPermission('new_template')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 16: |
|
8 | + if(!$modx->hasPermission('edit_template')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 19: |
|
13 | + if(!$modx->hasPermission('new_template')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | 26 | if($lockedEl = $modx->elementIsLocked(1, $id)) { |
27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
@@ -33,23 +33,23 @@ discard block |
||
33 | 33 | |
34 | 34 | $content = array(); |
35 | 35 | if(!empty($id)) { |
36 | - $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
|
37 | - $content = $modx->db->getRow($rs); |
|
38 | - if(!$content) { |
|
39 | - $modx->webAlertAndQuit("No database record has been found for this template."); |
|
40 | - } |
|
41 | - |
|
42 | - $_SESSION['itemname'] = $content['templatename']; |
|
43 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
44 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
45 | - } |
|
36 | + $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
|
37 | + $content = $modx->db->getRow($rs); |
|
38 | + if(!$content) { |
|
39 | + $modx->webAlertAndQuit("No database record has been found for this template."); |
|
40 | + } |
|
41 | + |
|
42 | + $_SESSION['itemname'] = $content['templatename']; |
|
43 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
44 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
45 | + } |
|
46 | 46 | } else { |
47 | - $_SESSION['itemname'] = $_lang["new_template"]; |
|
48 | - $content['category'] = (int)$_REQUEST['catid']; |
|
47 | + $_SESSION['itemname'] = $_lang["new_template"]; |
|
48 | + $content['category'] = (int)$_REQUEST['catid']; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if($modx->manager->hasFormValues()) { |
52 | - $modx->manager->loadFormValues(); |
|
52 | + $modx->manager->loadFormValues(); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $content = array_merge($content, $_POST); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | |
99 | 99 | <form name="mutate" method="post" action="index.php"> |
100 | 100 | <?php |
101 | - // invoke OnTempFormPrerender event |
|
102 | - $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
103 | - if(is_array($evtOut)) { |
|
104 | - echo implode("", $evtOut); |
|
105 | - } |
|
106 | - ?> |
|
101 | + // invoke OnTempFormPrerender event |
|
102 | + $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
103 | + if(is_array($evtOut)) { |
|
104 | + echo implode("", $evtOut); |
|
105 | + } |
|
106 | + ?> |
|
107 | 107 | <input type="hidden" name="a" value="20"> |
108 | 108 | <input type="hidden" name="id" value="<?= $_REQUEST['id'] ?>"> |
109 | 109 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | <label class="col-md-3 col-lg-2"> |
134 | 134 | <?= $_lang['template_name'] ?> |
135 | 135 | <?php if($id == $modx->config['default_template']) { |
136 | - echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
137 | - } ?> |
|
136 | + echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
137 | + } ?> |
|
138 | 138 | </label> |
139 | 139 | <div class="col-md-9 col-lg-10"> |
140 | 140 | <div class="form-control-name clearfix"> |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
163 | 163 | <option> </option> |
164 | 164 | <?php |
165 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
166 | - foreach(getCategories() as $n => $v) { |
|
167 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
168 | - } |
|
169 | - ?> |
|
165 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
166 | + foreach(getCategories() as $n => $v) { |
|
167 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
168 | + } |
|
169 | + ?> |
|
170 | 170 | </select> |
171 | 171 | </div> |
172 | 172 | </div> |
@@ -197,38 +197,38 @@ discard block |
||
197 | 197 | <input type="submit" name="save" style="display:none"> |
198 | 198 | |
199 | 199 | <?php |
200 | - $selectedTvs = array(); |
|
201 | - if(!isset($_POST['assignedTv'])) { |
|
202 | - $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
200 | + $selectedTvs = array(); |
|
201 | + if(!isset($_POST['assignedTv'])) { |
|
202 | + $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
203 | 203 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
204 | 204 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC" // workaround for correct sort of none-existing ranks |
205 | - ); |
|
206 | - while($row = $modx->db->getRow($rs)) { |
|
207 | - $selectedTvs[$row['tvid']] = $row; |
|
208 | - } |
|
209 | - $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
210 | - } |
|
211 | - |
|
212 | - $unselectedTvs = array(); |
|
213 | - $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
205 | + ); |
|
206 | + while($row = $modx->db->getRow($rs)) { |
|
207 | + $selectedTvs[$row['tvid']] = $row; |
|
208 | + } |
|
209 | + $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
210 | + } |
|
211 | + |
|
212 | + $unselectedTvs = array(); |
|
213 | + $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
214 | 214 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
215 | 215 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "", "category, tvcaption"); |
216 | - while($row = $modx->db->getRow($rs)) { |
|
217 | - $unselectedTvs[$row['tvid']] = $row; |
|
218 | - } |
|
219 | - |
|
220 | - // Catch checkboxes if form not validated |
|
221 | - if(isset($_POST['assignedTv'])) { |
|
222 | - $selectedTvs = array(); |
|
223 | - foreach($_POST['assignedTv'] as $tvid) { |
|
224 | - if(isset($unselectedTvs[$tvid])) { |
|
225 | - $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
226 | - } |
|
227 | - }; |
|
228 | - } |
|
229 | - |
|
230 | - $total = count($selectedTvs); |
|
231 | - ?> |
|
216 | + while($row = $modx->db->getRow($rs)) { |
|
217 | + $unselectedTvs[$row['tvid']] = $row; |
|
218 | + } |
|
219 | + |
|
220 | + // Catch checkboxes if form not validated |
|
221 | + if(isset($_POST['assignedTv'])) { |
|
222 | + $selectedTvs = array(); |
|
223 | + foreach($_POST['assignedTv'] as $tvid) { |
|
224 | + if(isset($unselectedTvs[$tvid])) { |
|
225 | + $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
226 | + } |
|
227 | + }; |
|
228 | + } |
|
229 | + |
|
230 | + $total = count($selectedTvs); |
|
231 | + ?> |
|
232 | 232 | </div> |
233 | 233 | |
234 | 234 | <div class="tab-page" id="tabAssignedTVs"> |
@@ -238,65 +238,65 @@ discard block |
||
238 | 238 | |
239 | 239 | <div class="container container-body"> |
240 | 240 | <?php |
241 | - if($total > 0) { |
|
242 | - echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
243 | - } |
|
244 | - if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
245 | - echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
246 | - } |
|
247 | - |
|
248 | - // Selected TVs |
|
249 | - $tvList = ''; |
|
250 | - if($total > 0) { |
|
251 | - $tvList .= '<ul>'; |
|
252 | - foreach($selectedTvs as $row) { |
|
253 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
254 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
255 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
256 | - } |
|
257 | - $tvList .= '</ul>'; |
|
258 | - |
|
259 | - } else { |
|
260 | - echo $_lang['template_no_tv']; |
|
261 | - } |
|
262 | - echo $tvList; |
|
263 | - |
|
264 | - // Unselected TVs |
|
265 | - $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
266 | - $preCat = ''; |
|
267 | - $insideUl = 0; |
|
268 | - while($row = array_shift($unselectedTvs)) { |
|
269 | - if(isset($selectedTvs[$row['tvid']])) { |
|
270 | - continue; |
|
271 | - } // Skip selected |
|
272 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
273 | - if($preCat !== $row['category']) { |
|
274 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
275 | - $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
276 | - $insideUl = 1; |
|
277 | - } |
|
278 | - |
|
279 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
280 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
281 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
282 | - $tvList .= '</li>'; |
|
283 | - |
|
284 | - $preCat = $row['category']; |
|
285 | - } |
|
286 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
287 | - $tvList .= '</ul>'; |
|
288 | - echo $tvList; |
|
289 | - |
|
290 | - ?> |
|
241 | + if($total > 0) { |
|
242 | + echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
243 | + } |
|
244 | + if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
245 | + echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
246 | + } |
|
247 | + |
|
248 | + // Selected TVs |
|
249 | + $tvList = ''; |
|
250 | + if($total > 0) { |
|
251 | + $tvList .= '<ul>'; |
|
252 | + foreach($selectedTvs as $row) { |
|
253 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
254 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
255 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
256 | + } |
|
257 | + $tvList .= '</ul>'; |
|
258 | + |
|
259 | + } else { |
|
260 | + echo $_lang['template_no_tv']; |
|
261 | + } |
|
262 | + echo $tvList; |
|
263 | + |
|
264 | + // Unselected TVs |
|
265 | + $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
266 | + $preCat = ''; |
|
267 | + $insideUl = 0; |
|
268 | + while($row = array_shift($unselectedTvs)) { |
|
269 | + if(isset($selectedTvs[$row['tvid']])) { |
|
270 | + continue; |
|
271 | + } // Skip selected |
|
272 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
273 | + if($preCat !== $row['category']) { |
|
274 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
275 | + $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
276 | + $insideUl = 1; |
|
277 | + } |
|
278 | + |
|
279 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
280 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
281 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
282 | + $tvList .= '</li>'; |
|
283 | + |
|
284 | + $preCat = $row['category']; |
|
285 | + } |
|
286 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
287 | + $tvList .= '</ul>'; |
|
288 | + echo $tvList; |
|
289 | + |
|
290 | + ?> |
|
291 | 291 | </div> |
292 | 292 | </div> |
293 | 293 | |
294 | 294 | <?php |
295 | - // invoke OnTempFormRender event |
|
296 | - $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
297 | - if(is_array($evtOut)) { |
|
298 | - echo implode("", $evtOut); |
|
299 | - } |
|
300 | - ?> |
|
295 | + // invoke OnTempFormRender event |
|
296 | + $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
297 | + if(is_array($evtOut)) { |
|
298 | + echo implode("", $evtOut); |
|
299 | + } |
|
300 | + ?> |
|
301 | 301 | </div> |
302 | 302 | </form> |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->manager->action) { |
7 | - case 16: |
|
8 | - if(!$modx->hasPermission('edit_template')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 19: |
|
13 | - if(!$modx->hasPermission('new_template')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 16: |
|
8 | + if(!$modx->hasPermission('edit_template')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 19: |
|
13 | + if(!$modx->hasPermission('new_template')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -1,16 +1,16 @@ 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 | -switch($modx->manager->action) { |
|
6 | +switch ($modx->manager->action) { |
|
7 | 7 | case 16: |
8 | - if(!$modx->hasPermission('edit_template')) { |
|
8 | + if (!$modx->hasPermission('edit_template')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 19: |
13 | - if(!$modx->hasPermission('new_template')) { |
|
13 | + if (!$modx->hasPermission('new_template')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | $tbl_site_templates = $modx->getFullTableName('site_templates'); |
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | -if($lockedEl = $modx->elementIsLocked(1, $id)) { |
|
26 | +if ($lockedEl = $modx->elementIsLocked(1, $id)) { |
|
27 | 27 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
28 | 28 | } |
29 | 29 | // end check for lock |
@@ -32,23 +32,23 @@ discard block |
||
32 | 32 | $modx->lockElement(1, $id); |
33 | 33 | |
34 | 34 | $content = array(); |
35 | -if(!empty($id)) { |
|
35 | +if (!empty($id)) { |
|
36 | 36 | $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
37 | 37 | $content = $modx->db->getRow($rs); |
38 | - if(!$content) { |
|
38 | + if (!$content) { |
|
39 | 39 | $modx->webAlertAndQuit("No database record has been found for this template."); |
40 | 40 | } |
41 | 41 | |
42 | 42 | $_SESSION['itemname'] = $content['templatename']; |
43 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
43 | + if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
44 | 44 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
45 | 45 | } |
46 | 46 | } else { |
47 | 47 | $_SESSION['itemname'] = $_lang["new_template"]; |
48 | - $content['category'] = (int)$_REQUEST['catid']; |
|
48 | + $content['category'] = (int) $_REQUEST['catid']; |
|
49 | 49 | } |
50 | 50 | |
51 | -if($modx->manager->hasFormValues()) { |
|
51 | +if ($modx->manager->hasFormValues()) { |
|
52 | 52 | $modx->manager->loadFormValues(); |
53 | 53 | } |
54 | 54 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // Add lock-element JS-Script |
59 | 59 | $lockElementId = $id; |
60 | 60 | $lockElementType = 1; |
61 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
61 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
62 | 62 | ?> |
63 | 63 | <script type="text/javascript"> |
64 | 64 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | <?php |
101 | 101 | // invoke OnTempFormPrerender event |
102 | 102 | $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
103 | - if(is_array($evtOut)) { |
|
103 | + if (is_array($evtOut)) { |
|
104 | 104 | echo implode("", $evtOut); |
105 | 105 | } |
106 | 106 | ?> |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
110 | 110 | |
111 | 111 | <h1> |
112 | - <i class="fa fa-newspaper-o"></i><?= ($content['templatename'] ? $content['templatename'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_template']) ?><i class="fa fa-question-circle help"></i> |
|
112 | + <i class="fa fa-newspaper-o"></i><?= ($content['templatename'] ? $content['templatename'].'<small>('.$content['id'].')</small>' : $_lang['new_template']) ?><i class="fa fa-question-circle help"></i> |
|
113 | 113 | </h1> |
114 | 114 | |
115 | 115 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | <div class="row form-row"> |
133 | 133 | <label class="col-md-3 col-lg-2"> |
134 | 134 | <?= $_lang['template_name'] ?> |
135 | - <?php if($id == $modx->config['default_template']) { |
|
136 | - echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
135 | + <?php if ($id == $modx->config['default_template']) { |
|
136 | + echo '<small class="form-text text-danger">'.mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset).'</small>'; |
|
137 | 137 | } ?> |
138 | 138 | </label> |
139 | 139 | <div class="col-md-9 col-lg-10"> |
140 | 140 | <div class="form-control-name clearfix"> |
141 | 141 | <input name="templatename" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['templatename']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;"> |
142 | - <?php if($modx->hasPermission('save_role')): ?> |
|
143 | - <label class="custom-control" title="<?= $_lang['lock_template'] . "\n" . $_lang['lock_template_msg'] ?>" tooltip> |
|
142 | + <?php if ($modx->hasPermission('save_role')): ?> |
|
143 | + <label class="custom-control" title="<?= $_lang['lock_template']."\n".$_lang['lock_template_msg'] ?>" tooltip> |
|
144 | 144 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
145 | 145 | <i class="fa fa-lock"></i> |
146 | 146 | </label> |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
163 | 163 | <option> </option> |
164 | 164 | <?php |
165 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
166 | - foreach(getCategories() as $n => $v) { |
|
167 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
165 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
166 | + foreach (getCategories() as $n => $v) { |
|
167 | + echo "<option value='".$v['id']."'".($content["category"] == $v["id"] ? " selected='selected'" : "").">".$modx->htmlspecialchars($v["category"])."</option>"; |
|
168 | 168 | } |
169 | 169 | ?> |
170 | 170 | </select> |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | </div> |
178 | 178 | </div> |
179 | 179 | </div> |
180 | - <?php if($modx->hasPermission('save_role')): ?> |
|
180 | + <?php if ($modx->hasPermission('save_role')): ?> |
|
181 | 181 | <div class="form-group"> |
182 | 182 | <label> |
183 | 183 | <input name="selectable" type="checkbox"<?= ($selectable == 1 ? ' checked="checked"' : '') ?> /> <?= $_lang['template_selectable'] ?></label> |
@@ -198,30 +198,30 @@ discard block |
||
198 | 198 | |
199 | 199 | <?php |
200 | 200 | $selectedTvs = array(); |
201 | - if(!isset($_POST['assignedTv'])) { |
|
201 | + if (!isset($_POST['assignedTv'])) { |
|
202 | 202 | $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
203 | 203 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
204 | 204 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC" // workaround for correct sort of none-existing ranks |
205 | 205 | ); |
206 | - while($row = $modx->db->getRow($rs)) { |
|
206 | + while ($row = $modx->db->getRow($rs)) { |
|
207 | 207 | $selectedTvs[$row['tvid']] = $row; |
208 | 208 | } |
209 | - $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
209 | + $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | $unselectedTvs = array(); |
213 | 213 | $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
214 | 214 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
215 | 215 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "", "category, tvcaption"); |
216 | - while($row = $modx->db->getRow($rs)) { |
|
216 | + while ($row = $modx->db->getRow($rs)) { |
|
217 | 217 | $unselectedTvs[$row['tvid']] = $row; |
218 | 218 | } |
219 | 219 | |
220 | 220 | // Catch checkboxes if form not validated |
221 | - if(isset($_POST['assignedTv'])) { |
|
221 | + if (isset($_POST['assignedTv'])) { |
|
222 | 222 | $selectedTvs = array(); |
223 | - foreach($_POST['assignedTv'] as $tvid) { |
|
224 | - if(isset($unselectedTvs[$tvid])) { |
|
223 | + foreach ($_POST['assignedTv'] as $tvid) { |
|
224 | + if (isset($unselectedTvs[$tvid])) { |
|
225 | 225 | $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
226 | 226 | } |
227 | 227 | }; |
@@ -238,20 +238,20 @@ discard block |
||
238 | 238 | |
239 | 239 | <div class="container container-body"> |
240 | 240 | <?php |
241 | - if($total > 0) { |
|
242 | - echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
241 | + if ($total > 0) { |
|
242 | + echo '<p>'.$_lang['template_tv_msg'].'</p>'; |
|
243 | 243 | } |
244 | - if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
244 | + if ($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
245 | 245 | echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
246 | 246 | } |
247 | 247 | |
248 | 248 | // Selected TVs |
249 | 249 | $tvList = ''; |
250 | - if($total > 0) { |
|
250 | + if ($total > 0) { |
|
251 | 251 | $tvList .= '<ul>'; |
252 | - foreach($selectedTvs as $row) { |
|
253 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
254 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
252 | + foreach ($selectedTvs as $row) { |
|
253 | + $desc = !empty($row['tvdescription']) ? ' <small>('.$row['tvdescription'].')</small>' : ''; |
|
254 | + $locked = $row['tvlocked'] ? ' <em>('.$_lang['locked'].')</em>' : ""; |
|
255 | 255 | $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
256 | 256 | } |
257 | 257 | $tvList .= '</ul>'; |
@@ -262,22 +262,22 @@ discard block |
||
262 | 262 | echo $tvList; |
263 | 263 | |
264 | 264 | // Unselected TVs |
265 | - $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
265 | + $tvList = '<hr/><p>'.$_lang['template_notassigned_tv'].'</p><ul>'; |
|
266 | 266 | $preCat = ''; |
267 | 267 | $insideUl = 0; |
268 | - while($row = array_shift($unselectedTvs)) { |
|
269 | - if(isset($selectedTvs[$row['tvid']])) { |
|
268 | + while ($row = array_shift($unselectedTvs)) { |
|
269 | + if (isset($selectedTvs[$row['tvid']])) { |
|
270 | 270 | continue; |
271 | 271 | } // Skip selected |
272 | 272 | $row['category'] = stripslashes($row['category']); //pixelchutes |
273 | - if($preCat !== $row['category']) { |
|
273 | + if ($preCat !== $row['category']) { |
|
274 | 274 | $tvList .= $insideUl ? '</ul>' : ''; |
275 | - $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
275 | + $tvList .= '<li><strong>'.$row['category'].($row['catid'] != '' ? ' <small>('.$row['catid'].')</small>' : '').'</strong><ul>'; |
|
276 | 276 | $insideUl = 1; |
277 | 277 | } |
278 | 278 | |
279 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
280 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
279 | + $desc = !empty($row['tvdescription']) ? ' <small>('.$row['tvdescription'].')</small>' : ''; |
|
280 | + $locked = $row['tvlocked'] ? ' <em>('.$_lang['locked'].')</em>' : ""; |
|
281 | 281 | $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
282 | 282 | $tvList .= '</li>'; |
283 | 283 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | <?php |
295 | 295 | // invoke OnTempFormRender event |
296 | 296 | $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
297 | - if(is_array($evtOut)) { |
|
297 | + if (is_array($evtOut)) { |
|
298 | 298 | echo implode("", $evtOut); |
299 | 299 | } |
300 | 300 | ?> |
@@ -1,19 +1,19 @@ 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 | if (!$modx->hasPermission('edit_document') || !$modx->hasPermission('save_document')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : null; |
|
9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : null; |
|
10 | 10 | $reset = isset($_POST['reset']) && $_POST['reset'] == 'true' ? 1 : 0; |
11 | 11 | $items = isset($_POST['list']) ? $_POST['list'] : ''; |
12 | 12 | $ressourcelist = ''; |
13 | 13 | $updateMsg = ''; |
14 | 14 | |
15 | 15 | // check permissions on the document |
16 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
16 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
17 | 17 | $udperms = new udperms(); |
18 | 18 | $udperms->user = $modx->getLoginUserID(); |
19 | 19 | $udperms->document = $id; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | if (isset($_POST['listSubmitted'])) { |
27 | - $updateMsg .= '<div class="text-success" id="updated">' . $_lang['sort_updated'] . '</div>'; |
|
27 | + $updateMsg .= '<div class="text-success" id="updated">'.$_lang['sort_updated'].'</div>'; |
|
28 | 28 | if (strlen($items) > 0) { |
29 | 29 | $items = explode(';', $items); |
30 | 30 | foreach ($items as $key => $value) { |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | $tblsc = $modx->getFullTableName('site_content'); |
45 | 45 | $tbldg = $modx->getFullTableName('document_groups'); |
46 | 46 | |
47 | - $rs = $modx->db->select('pagetitle', $tblsc, 'id=' . $id . ''); |
|
47 | + $rs = $modx->db->select('pagetitle', $tblsc, 'id='.$id.''); |
|
48 | 48 | $pagetitle = $modx->db->getValue($rs); |
49 | 49 | |
50 | 50 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
51 | 51 | $docgrp_cond = $docgrp ? "OR dg.document_group IN ({$docgrp})" : ''; |
52 | - $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
53 | - $access = " AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
52 | + $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
53 | + $access = " AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
54 | 54 | |
55 | - $rs = $modx->db->select('sc.id, sc.pagetitle, sc.parent, sc.menuindex, sc.published, sc.hidemenu, sc.deleted, sc.isfolder', $tblsc . 'AS sc LEFT JOIN ' . $tbldg . ' dg ON dg.document=sc.id', 'sc.parent=' . $id . $access . ' GROUP BY sc.id', 'menuindex ASC'); |
|
55 | + $rs = $modx->db->select('sc.id, sc.pagetitle, sc.parent, sc.menuindex, sc.published, sc.hidemenu, sc.deleted, sc.isfolder', $tblsc.'AS sc LEFT JOIN '.$tbldg.' dg ON dg.document=sc.id', 'sc.parent='.$id.$access.' GROUP BY sc.id', 'menuindex ASC'); |
|
56 | 56 | |
57 | 57 | if ($modx->db->getRecordCount($rs)) { |
58 | 58 | $ressourcelist .= '<div class="clearfix"><ul id="sortlist" class="sortableList">'; |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | $classes .= ($row['hidemenu']) ? ' notInMenuNode ' : ' inMenuNode'; |
62 | 62 | $classes .= ($row['published']) ? ' publishedNode ' : ' unpublishedNode '; |
63 | 63 | $classes = ($row['deleted']) ? ' deletedNode ' : $classes; |
64 | - $icon = $row['isfolder'] ? '<i class="' . $_style['files_folder'] . '"></i> ' : ' <i class="' . $_style['files_page_html'] . '"></i> '; |
|
65 | - $ressourcelist .= '<li id="item_' . $row['id'] . '" class="' . $classes . '">' . $icon . $row['pagetitle'] . ' <small>(' . $row['id'] . ')</small></li>'; |
|
64 | + $icon = $row['isfolder'] ? '<i class="'.$_style['files_folder'].'"></i> ' : ' <i class="'.$_style['files_page_html'].'"></i> '; |
|
65 | + $ressourcelist .= '<li id="item_'.$row['id'].'" class="'.$classes.'">'.$icon.$row['pagetitle'].' <small>('.$row['id'].')</small></li>'; |
|
66 | 66 | } |
67 | 67 | $ressourcelist .= '</ul></div>'; |
68 | 68 | } else { |
69 | - $updateMsg = '<p class="text-danger">' . $_lang['sort_nochildren'] . '</p>'; |
|
69 | + $updateMsg = '<p class="text-danger">'.$_lang['sort_nochildren'].'</p>'; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | </script> |
150 | 150 | |
151 | 151 | <h1> |
152 | - <i class="fa fa-sort-numeric-asc"></i><?= ($pagetitle ? $pagetitle . '<small>(' . $id . ')</small>' : $_lang['sort_menuindex']) ?> |
|
152 | + <i class="fa fa-sort-numeric-asc"></i><?= ($pagetitle ? $pagetitle.'<small>('.$id.')</small>' : $_lang['sort_menuindex']) ?> |
|
153 | 153 | </h1> |
154 | 154 | |
155 | 155 | <?= $_style['actionbuttons']['dynamic']['save'] ?> |
@@ -3,18 +3,18 @@ |
||
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 | switch($modx->manager->action) { |
6 | - case 107: |
|
7 | - if(!$modx->hasPermission('new_module')) { |
|
8 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | - } |
|
10 | - break; |
|
11 | - case 108: |
|
12 | - if(!$modx->hasPermission('edit_module')) { |
|
13 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | - } |
|
15 | - break; |
|
16 | - default: |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + case 107: |
|
7 | + if(!$modx->hasPermission('new_module')) { |
|
8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + } |
|
10 | + break; |
|
11 | + case 108: |
|
12 | + if(!$modx->hasPermission('edit_module')) { |
|
13 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | + } |
|
15 | + break; |
|
16 | + default: |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | 18 | } |
19 | 19 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
20 | 20 | // Get table names (alphabetical) |
@@ -1,20 +1,20 @@ 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 | switch($modx->manager->action) { |
6 | - case 107: |
|
7 | - if(!$modx->hasPermission('new_module')) { |
|
8 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | - } |
|
10 | - break; |
|
11 | - case 108: |
|
12 | - if(!$modx->hasPermission('edit_module')) { |
|
13 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | - } |
|
15 | - break; |
|
16 | - default: |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + case 107: |
|
7 | + if(!$modx->hasPermission('new_module')) { |
|
8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + } |
|
10 | + break; |
|
11 | + case 108: |
|
12 | + if(!$modx->hasPermission('edit_module')) { |
|
13 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | + } |
|
15 | + break; |
|
16 | + default: |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | 18 | } |
19 | 19 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
20 | 20 | // Get table names (alphabetical) |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | * @return string |
35 | 35 | */ |
36 | 36 | function createGUID() { |
37 | - srand((double) microtime() * 1000000); |
|
38 | - $r = rand(); |
|
39 | - $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
40 | - $m = md5($u); |
|
41 | - return $m; |
|
37 | + srand((double) microtime() * 1000000); |
|
38 | + $r = rand(); |
|
39 | + $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
40 | + $m = md5($u); |
|
41 | + return $m; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // check to see the module editor isn't locked |
45 | 45 | if($lockedEl = $modx->elementIsLocked(6, $id)) { |
46 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
46 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
47 | 47 | } |
48 | 48 | // end check for lock |
49 | 49 | |
@@ -51,22 +51,22 @@ discard block |
||
51 | 51 | $modx->lockElement(6, $id); |
52 | 52 | |
53 | 53 | if(isset($_GET['id'])) { |
54 | - $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
|
55 | - $content = $modx->db->getRow($rs); |
|
56 | - if(!$content) { |
|
57 | - $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
58 | - } |
|
59 | - $content['properties'] = str_replace("&", "&", $content['properties']); |
|
60 | - $_SESSION['itemname'] = $content['name']; |
|
61 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
62 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
63 | - } |
|
54 | + $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
|
55 | + $content = $modx->db->getRow($rs); |
|
56 | + if(!$content) { |
|
57 | + $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
58 | + } |
|
59 | + $content['properties'] = str_replace("&", "&", $content['properties']); |
|
60 | + $_SESSION['itemname'] = $content['name']; |
|
61 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
62 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
63 | + } |
|
64 | 64 | } else { |
65 | - $_SESSION['itemname'] = $_lang["new_module"]; |
|
66 | - $content['wrap'] = '1'; |
|
65 | + $_SESSION['itemname'] = $_lang["new_module"]; |
|
66 | + $content['wrap'] = '1'; |
|
67 | 67 | } |
68 | 68 | if($modx->manager->hasFormValues()) { |
69 | - $modx->manager->loadFormValues(); |
|
69 | + $modx->manager->loadFormValues(); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Add lock-element JS-Script |
@@ -437,18 +437,18 @@ discard block |
||
437 | 437 | |
438 | 438 | <form name="mutate" id="mutate" class="module" method="post" action="index.php?a=109"> |
439 | 439 | <?php |
440 | - // invoke OnModFormPrerender event |
|
441 | - $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
|
442 | - if(is_array($evtOut)) { |
|
443 | - echo implode('', $evtOut); |
|
444 | - } |
|
445 | - |
|
446 | - // Prepare internal params & info-tab via parseDocBlock |
|
447 | - $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : ''; |
|
448 | - $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
449 | - $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
450 | - $internal = array(); |
|
451 | - ?> |
|
440 | + // invoke OnModFormPrerender event |
|
441 | + $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
|
442 | + if(is_array($evtOut)) { |
|
443 | + echo implode('', $evtOut); |
|
444 | + } |
|
445 | + |
|
446 | + // Prepare internal params & info-tab via parseDocBlock |
|
447 | + $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : ''; |
|
448 | + $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
449 | + $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
450 | + $internal = array(); |
|
451 | + ?> |
|
452 | 452 | <input type="hidden" name="id" value="<?= $content['id'] ?>"> |
453 | 453 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
454 | 454 | |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
502 | 502 | <option> </option> |
503 | 503 | <?php |
504 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
505 | - foreach(getCategories() as $n => $v) { |
|
506 | - echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
507 | - } |
|
508 | - ?> |
|
504 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
505 | + foreach(getCategories() as $n => $v) { |
|
506 | + echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
507 | + } |
|
508 | + ?> |
|
509 | 509 | </select> |
510 | 510 | </div> |
511 | 511 | </div> |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | <i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang['manage_depends'] ?></a> |
613 | 613 | </div> |
614 | 614 | <?php |
615 | - $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, |
|
615 | + $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, |
|
616 | 616 | CASE smd.type |
617 | 617 | WHEN 10 THEN 'Chunk' |
618 | 618 | WHEN 20 THEN 'Document' |
@@ -628,17 +628,17 @@ discard block |
||
628 | 628 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50 |
629 | 629 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name'); |
630 | 630 | |
631 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
632 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
633 | - $grd->noRecordMsg = $_lang['no_records_found']; |
|
634 | - $grd->cssClass = 'grid'; |
|
635 | - $grd->columnHeaderClass = 'gridHeader'; |
|
636 | - $grd->itemClass = 'gridItem'; |
|
637 | - $grd->altItemClass = 'gridAltItem'; |
|
638 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
639 | - $grd->fields = "name,type"; |
|
640 | - echo $grd->render(); |
|
641 | - ?> |
|
631 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
632 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
633 | + $grd->noRecordMsg = $_lang['no_records_found']; |
|
634 | + $grd->cssClass = 'grid'; |
|
635 | + $grd->columnHeaderClass = 'gridHeader'; |
|
636 | + $grd->itemClass = 'gridItem'; |
|
637 | + $grd->altItemClass = 'gridAltItem'; |
|
638 | + $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
639 | + $grd->fields = "name,type"; |
|
640 | + echo $grd->render(); |
|
641 | + ?> |
|
642 | 642 | </div> |
643 | 643 | </div> |
644 | 644 | <?php endif; ?> |
@@ -650,12 +650,12 @@ discard block |
||
650 | 650 | <div class="container container-body"> |
651 | 651 | <?php if($use_udperms == 1) : ?> |
652 | 652 | <?php |
653 | - // fetch user access permissions for the module |
|
654 | - $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
|
655 | - $groupsarray = $modx->db->getColumn('usergroup', $rs); |
|
653 | + // fetch user access permissions for the module |
|
654 | + $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
|
655 | + $groupsarray = $modx->db->getColumn('usergroup', $rs); |
|
656 | 656 | |
657 | - if($modx->hasPermission('access_permissions')) { |
|
658 | - ?> |
|
657 | + if($modx->hasPermission('access_permissions')) { |
|
658 | + ?> |
|
659 | 659 | <!-- User Group Access Permissions --> |
660 | 660 | <script type="text/javascript"> |
661 | 661 | function makePublic(b) { |
@@ -679,28 +679,28 @@ discard block |
||
679 | 679 | </script> |
680 | 680 | <p><?= $_lang['module_group_access_msg'] ?></p> |
681 | 681 | <?php |
682 | - } |
|
683 | - $chk = ''; |
|
684 | - $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
|
685 | - while($row = $modx->db->getRow($rs)) { |
|
686 | - $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
687 | - $checked = in_array($row['id'], $groupsarray); |
|
688 | - if($modx->hasPermission('access_permissions')) { |
|
689 | - if($checked) { |
|
690 | - $notPublic = true; |
|
691 | - } |
|
692 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
693 | - } else { |
|
694 | - if($checked) { |
|
695 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
696 | - } |
|
697 | - } |
|
698 | - } |
|
699 | - if($modx->hasPermission('access_permissions')) { |
|
700 | - $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
701 | - } |
|
702 | - echo $chks; |
|
703 | - ?> |
|
682 | + } |
|
683 | + $chk = ''; |
|
684 | + $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
|
685 | + while($row = $modx->db->getRow($rs)) { |
|
686 | + $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
687 | + $checked = in_array($row['id'], $groupsarray); |
|
688 | + if($modx->hasPermission('access_permissions')) { |
|
689 | + if($checked) { |
|
690 | + $notPublic = true; |
|
691 | + } |
|
692 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
693 | + } else { |
|
694 | + if($checked) { |
|
695 | + $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
696 | + } |
|
697 | + } |
|
698 | + } |
|
699 | + if($modx->hasPermission('access_permissions')) { |
|
700 | + $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
701 | + } |
|
702 | + echo $chks; |
|
703 | + ?> |
|
704 | 704 | <?php endif; ?> |
705 | 705 | </div> |
706 | 706 | </div> |
@@ -716,11 +716,11 @@ discard block |
||
716 | 716 | |
717 | 717 | <input type="submit" name="save" style="display:none;"> |
718 | 718 | <?php |
719 | - // invoke OnModFormRender event |
|
720 | - $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
|
721 | - if(is_array($evtOut)) { |
|
722 | - echo implode('', $evtOut); |
|
723 | - } |
|
724 | - ?> |
|
719 | + // invoke OnModFormRender event |
|
720 | + $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
|
721 | + if(is_array($evtOut)) { |
|
722 | + echo implode('', $evtOut); |
|
723 | + } |
|
724 | + ?> |
|
725 | 725 | </form> |
726 | 726 | <script type="text/javascript">setTimeout('showParameters();', 10);</script> |
@@ -1,22 +1,22 @@ 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 | -switch($modx->manager->action) { |
|
5 | +switch ($modx->manager->action) { |
|
6 | 6 | case 107: |
7 | - if(!$modx->hasPermission('new_module')) { |
|
7 | + if (!$modx->hasPermission('new_module')) { |
|
8 | 8 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
9 | 9 | } |
10 | 10 | break; |
11 | 11 | case 108: |
12 | - if(!$modx->hasPermission('edit_module')) { |
|
12 | + if (!$modx->hasPermission('edit_module')) { |
|
13 | 13 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
14 | 14 | } |
15 | 15 | break; |
16 | 16 | default: |
17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
18 | 18 | } |
19 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
19 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
20 | 20 | // Get table names (alphabetical) |
21 | 21 | $tbl_membergroup_names = $modx->getFullTableName('membergroup_names'); |
22 | 22 | $tbl_site_content = $modx->getFullTableName('site_content'); |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string |
35 | 35 | */ |
36 | -function createGUID() { |
|
36 | +function createGUID(){ |
|
37 | 37 | srand((double) microtime() * 1000000); |
38 | 38 | $r = rand(); |
39 | - $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
39 | + $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1); |
|
40 | 40 | $m = md5($u); |
41 | 41 | return $m; |
42 | 42 | } |
43 | 43 | |
44 | 44 | // check to see the module editor isn't locked |
45 | -if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
45 | +if ($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
46 | 46 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
47 | 47 | } |
48 | 48 | // end check for lock |
@@ -50,29 +50,29 @@ discard block |
||
50 | 50 | // Lock snippet for other users to edit |
51 | 51 | $modx->lockElement(6, $id); |
52 | 52 | |
53 | -if(isset($_GET['id'])) { |
|
53 | +if (isset($_GET['id'])) { |
|
54 | 54 | $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
55 | 55 | $content = $modx->db->getRow($rs); |
56 | - if(!$content) { |
|
56 | + if (!$content) { |
|
57 | 57 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
58 | 58 | } |
59 | 59 | $content['properties'] = str_replace("&", "&", $content['properties']); |
60 | 60 | $_SESSION['itemname'] = $content['name']; |
61 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
61 | + if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
62 | 62 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
63 | 63 | } |
64 | 64 | } else { |
65 | 65 | $_SESSION['itemname'] = $_lang["new_module"]; |
66 | 66 | $content['wrap'] = '1'; |
67 | 67 | } |
68 | -if($modx->manager->hasFormValues()) { |
|
68 | +if ($modx->manager->hasFormValues()) { |
|
69 | 69 | $modx->manager->loadFormValues(); |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Add lock-element JS-Script |
73 | 73 | $lockElementId = $id; |
74 | 74 | $lockElementType = 6; |
75 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
75 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
76 | 76 | ?> |
77 | 77 | <script type="text/javascript"> |
78 | 78 | function loadDependencies() { |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | function BrowseServer() { |
420 | 420 | var w = screen.width * 0.7; |
421 | 421 | var h = screen.height * 0.7; |
422 | - OpenServerBrowser("<?= MODX_MANAGER_URL;?>media/browser/<?= $which_browser;?>/browser.php?Type=images", w, h); |
|
422 | + OpenServerBrowser("<?= MODX_MANAGER_URL; ?>media/browser/<?= $which_browser; ?>/browser.php?Type=images", w, h); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | function SetUrl(url, width, height, alt) { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | <?php |
440 | 440 | // invoke OnModFormPrerender event |
441 | 441 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
442 | - if(is_array($evtOut)) { |
|
442 | + if (is_array($evtOut)) { |
|
443 | 443 | echo implode('', $evtOut); |
444 | 444 | } |
445 | 445 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
454 | 454 | |
455 | 455 | <h1> |
456 | - <i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i> |
|
456 | + <i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i> |
|
457 | 457 | </h1> |
458 | 458 | |
459 | 459 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | <div class="col-md-9 col-lg-10"> |
479 | 479 | <div class="form-control-name clearfix"> |
480 | 480 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
481 | - <?php if($modx->hasPermission('save_role')): ?> |
|
482 | - <label class="custom-control" title="<?= $_lang['lock_module'] . "\n" . $_lang['lock_module_msg'] ?>" tooltip> |
|
481 | + <?php if ($modx->hasPermission('save_role')): ?> |
|
482 | + <label class="custom-control" title="<?= $_lang['lock_module']."\n".$_lang['lock_module_msg'] ?>" tooltip> |
|
483 | 483 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
484 | 484 | <i class="fa fa-lock"></i> |
485 | 485 | </label> |
@@ -501,9 +501,9 @@ discard block |
||
501 | 501 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
502 | 502 | <option> </option> |
503 | 503 | <?php |
504 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
505 | - foreach(getCategories() as $n => $v) { |
|
506 | - echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
504 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
505 | + foreach (getCategories() as $n => $v) { |
|
506 | + echo "\t\t\t".'<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category'])."</option>\n"; |
|
507 | 507 | } |
508 | 508 | ?> |
509 | 509 | </select> |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | <div class="form-group"> |
536 | 536 | <div class="form-row"> |
537 | 537 | <label for="disabled"><input name="disabled" id="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> |
538 | - <?= ($content['disabled'] == 1 ? '<span class="text-danger">' . $_lang['module_disabled'] . '</span>' : $_lang['module_disabled']) ?></label> |
|
538 | + <?= ($content['disabled'] == 1 ? '<span class="text-danger">'.$_lang['module_disabled'].'</span>' : $_lang['module_disabled']) ?></label> |
|
539 | 539 | </div> |
540 | 540 | <div class="form-row"> |
541 | 541 | <label for="parse_docblock"> |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | </div> |
601 | 601 | <!-- HTML text editor end --> |
602 | 602 | </div> |
603 | - <?php if($modx->manager->action == '108'): ?> |
|
603 | + <?php if ($modx->manager->action == '108'): ?> |
|
604 | 604 | <!-- Dependencies --> |
605 | 605 | <div class="tab-page" id="tabDepend"> |
606 | 606 | <h2 class="tab"><?= $_lang['settings_dependencies'] ?></h2> |
@@ -628,14 +628,14 @@ discard block |
||
628 | 628 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50 |
629 | 629 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name'); |
630 | 630 | |
631 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
631 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
632 | 632 | $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
633 | 633 | $grd->noRecordMsg = $_lang['no_records_found']; |
634 | 634 | $grd->cssClass = 'grid'; |
635 | 635 | $grd->columnHeaderClass = 'gridHeader'; |
636 | 636 | $grd->itemClass = 'gridItem'; |
637 | 637 | $grd->altItemClass = 'gridAltItem'; |
638 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
638 | + $grd->columns = $_lang['element_name']." ,".$_lang['type']; |
|
639 | 639 | $grd->fields = "name,type"; |
640 | 640 | echo $grd->render(); |
641 | 641 | ?> |
@@ -648,13 +648,13 @@ discard block |
||
648 | 648 | <h2 class="tab"><?= $_lang['access_permissions'] ?></h2> |
649 | 649 | <script type="text/javascript">tp.addTabPage(document.getElementById("tabPermissions"));</script> |
650 | 650 | <div class="container container-body"> |
651 | - <?php if($use_udperms == 1) : ?> |
|
651 | + <?php if ($use_udperms == 1) : ?> |
|
652 | 652 | <?php |
653 | 653 | // fetch user access permissions for the module |
654 | 654 | $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
655 | 655 | $groupsarray = $modx->db->getColumn('usergroup', $rs); |
656 | 656 | |
657 | - if($modx->hasPermission('access_permissions')) { |
|
657 | + if ($modx->hasPermission('access_permissions')) { |
|
658 | 658 | ?> |
659 | 659 | <!-- User Group Access Permissions --> |
660 | 660 | <script type="text/javascript"> |
@@ -682,22 +682,22 @@ discard block |
||
682 | 682 | } |
683 | 683 | $chk = ''; |
684 | 684 | $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
685 | - while($row = $modx->db->getRow($rs)) { |
|
685 | + while ($row = $modx->db->getRow($rs)) { |
|
686 | 686 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
687 | 687 | $checked = in_array($row['id'], $groupsarray); |
688 | - if($modx->hasPermission('access_permissions')) { |
|
689 | - if($checked) { |
|
688 | + if ($modx->hasPermission('access_permissions')) { |
|
689 | + if ($checked) { |
|
690 | 690 | $notPublic = true; |
691 | 691 | } |
692 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
692 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="'.$row['id'].'"'.($checked ? ' checked="checked"' : '').' onclick="makePublic(false)" /> '.$row['name']."</label><br />\n"; |
|
693 | 693 | } else { |
694 | - if($checked) { |
|
695 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
694 | + if ($checked) { |
|
695 | + $chks = '<input type="hidden" name="usrgroups[]" value="'.$row['id'].'" />'."\n".$chks; |
|
696 | 696 | } |
697 | 697 | } |
698 | 698 | } |
699 | - if($modx->hasPermission('access_permissions')) { |
|
700 | - $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
699 | + if ($modx->hasPermission('access_permissions')) { |
|
700 | + $chks = '<label><input type="checkbox" name="chkallgroups"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true)" /><span class="warning"> '.$_lang['all_usr_groups'].'</span></label><br />'."\n".$chks; |
|
701 | 701 | } |
702 | 702 | echo $chks; |
703 | 703 | ?> |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | <?php |
719 | 719 | // invoke OnModFormRender event |
720 | 720 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
721 | - if(is_array($evtOut)) { |
|
721 | + if (is_array($evtOut)) { |
|
722 | 722 | echo implode('', $evtOut); |
723 | 723 | } |
724 | 724 | ?> |
@@ -1,15 +1,15 @@ 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 | -switch($modx->manager->action) { |
|
5 | +switch($modx->manager->action) { |
|
6 | 6 | case 107: |
7 | - if(!$modx->hasPermission('new_module')) { |
|
7 | + if(!$modx->hasPermission('new_module')) { |
|
8 | 8 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
9 | 9 | } |
10 | 10 | break; |
11 | 11 | case 108: |
12 | - if(!$modx->hasPermission('edit_module')) { |
|
12 | + if(!$modx->hasPermission('edit_module')) { |
|
13 | 13 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
14 | 14 | } |
15 | 15 | break; |
@@ -33,7 +33,8 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string |
35 | 35 | */ |
36 | -function createGUID() { |
|
36 | +function createGUID() |
|
37 | +{ |
|
37 | 38 | srand((double) microtime() * 1000000); |
38 | 39 | $r = rand(); |
39 | 40 | $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
@@ -42,7 +43,7 @@ discard block |
||
42 | 43 | } |
43 | 44 | |
44 | 45 | // check to see the module editor isn't locked |
45 | -if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
46 | +if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
46 | 47 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
47 | 48 | } |
48 | 49 | // end check for lock |
@@ -50,22 +51,22 @@ discard block |
||
50 | 51 | // Lock snippet for other users to edit |
51 | 52 | $modx->lockElement(6, $id); |
52 | 53 | |
53 | -if(isset($_GET['id'])) { |
|
54 | +if(isset($_GET['id'])) { |
|
54 | 55 | $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
55 | 56 | $content = $modx->db->getRow($rs); |
56 | - if(!$content) { |
|
57 | + if(!$content) { |
|
57 | 58 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
58 | 59 | } |
59 | 60 | $content['properties'] = str_replace("&", "&", $content['properties']); |
60 | 61 | $_SESSION['itemname'] = $content['name']; |
61 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
62 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
62 | 63 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
63 | 64 | } |
64 | -} else { |
|
65 | +} else { |
|
65 | 66 | $_SESSION['itemname'] = $_lang["new_module"]; |
66 | 67 | $content['wrap'] = '1'; |
67 | 68 | } |
68 | -if($modx->manager->hasFormValues()) { |
|
69 | +if($modx->manager->hasFormValues()) { |
|
69 | 70 | $modx->manager->loadFormValues(); |
70 | 71 | } |
71 | 72 | |
@@ -439,7 +440,7 @@ discard block |
||
439 | 440 | <?php |
440 | 441 | // invoke OnModFormPrerender event |
441 | 442 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
442 | - if(is_array($evtOut)) { |
|
443 | + if(is_array($evtOut)) { |
|
443 | 444 | echo implode('', $evtOut); |
444 | 445 | } |
445 | 446 | |
@@ -502,7 +503,7 @@ discard block |
||
502 | 503 | <option> </option> |
503 | 504 | <?php |
504 | 505 | include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
505 | - foreach(getCategories() as $n => $v) { |
|
506 | + foreach(getCategories() as $n => $v) { |
|
506 | 507 | echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
507 | 508 | } |
508 | 509 | ?> |
@@ -654,7 +655,7 @@ discard block |
||
654 | 655 | $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
655 | 656 | $groupsarray = $modx->db->getColumn('usergroup', $rs); |
656 | 657 | |
657 | - if($modx->hasPermission('access_permissions')) { |
|
658 | + if($modx->hasPermission('access_permissions')) { |
|
658 | 659 | ?> |
659 | 660 | <!-- User Group Access Permissions --> |
660 | 661 | <script type="text/javascript"> |
@@ -682,21 +683,21 @@ discard block |
||
682 | 683 | } |
683 | 684 | $chk = ''; |
684 | 685 | $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
685 | - while($row = $modx->db->getRow($rs)) { |
|
686 | + while($row = $modx->db->getRow($rs)) { |
|
686 | 687 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
687 | 688 | $checked = in_array($row['id'], $groupsarray); |
688 | - if($modx->hasPermission('access_permissions')) { |
|
689 | - if($checked) { |
|
689 | + if($modx->hasPermission('access_permissions')) { |
|
690 | + if($checked) { |
|
690 | 691 | $notPublic = true; |
691 | 692 | } |
692 | 693 | $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
693 | - } else { |
|
694 | - if($checked) { |
|
694 | + } else { |
|
695 | + if($checked) { |
|
695 | 696 | $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
696 | 697 | } |
697 | 698 | } |
698 | 699 | } |
699 | - if($modx->hasPermission('access_permissions')) { |
|
700 | + if($modx->hasPermission('access_permissions')) { |
|
700 | 701 | $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
701 | 702 | } |
702 | 703 | echo $chks; |
@@ -718,7 +719,7 @@ discard block |
||
718 | 719 | <?php |
719 | 720 | // invoke OnModFormRender event |
720 | 721 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
721 | - if(is_array($evtOut)) { |
|
722 | + if(is_array($evtOut)) { |
|
722 | 723 | echo implode('', $evtOut); |
723 | 724 | } |
724 | 725 | ?> |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
13 | 13 | $origin = isset($_REQUEST['or']) ? (int)$_REQUEST['or'] : 76; |
14 | -$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : NULL; |
|
14 | +$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : null; |
|
15 | 15 | |
16 | 16 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
17 | 17 | $tbl_site_templates = $modx->getFullTableName('site_templates'); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('edit_template') && $modx->manager->action == '301') { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | if(!$modx->hasPermission('new_template') && $modx->manager->action == '300') { |
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | // check to see the snippet editor isn't locked |
22 | 22 | if($lockedEl = $modx->elementIsLocked(2, $id)) { |
23 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
|
23 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
|
24 | 24 | } |
25 | 25 | // end check for lock |
26 | 26 | |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | global $content; |
31 | 31 | $content = array(); |
32 | 32 | if(isset($_GET['id'])) { |
33 | - $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
|
34 | - $content = $modx->db->getRow($rs); |
|
35 | - if(!$content) { |
|
36 | - header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
37 | - } |
|
38 | - |
|
39 | - $_SESSION['itemname'] = $content['caption']; |
|
40 | - if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
41 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
42 | - } |
|
33 | + $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
|
34 | + $content = $modx->db->getRow($rs); |
|
35 | + if(!$content) { |
|
36 | + header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
37 | + } |
|
38 | + |
|
39 | + $_SESSION['itemname'] = $content['caption']; |
|
40 | + if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
41 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
42 | + } |
|
43 | 43 | } else if(isset($_REQUEST['itemname'])) { |
44 | - $content['name'] = $_REQUEST['itemname']; |
|
44 | + $content['name'] = $_REQUEST['itemname']; |
|
45 | 45 | } else { |
46 | - $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
|
47 | - $content['category'] = (int)$_REQUEST['catid']; |
|
46 | + $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
|
47 | + $content['category'] = (int)$_REQUEST['catid']; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | if($modx->manager->hasFormValues()) { |
51 | - $modx->manager->loadFormValues(); |
|
51 | + $modx->manager->loadFormValues(); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $content = array_merge($content, $_POST); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $RTEditors = ''; |
63 | 63 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister', array('forfrontend' => 1)); |
64 | 64 | if(is_array($evtOut)) { |
65 | - $RTEditors = implode(',', $evtOut); |
|
65 | + $RTEditors = implode(',', $evtOut); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | ?> |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | |
278 | 278 | <form name="mutate" method="post" action="index.php" enctype="multipart/form-data"> |
279 | 279 | <?php |
280 | - // invoke OnTVFormPrerender event |
|
281 | - $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
|
282 | - if(is_array($evtOut)) { |
|
283 | - echo implode("", $evtOut); |
|
284 | - } |
|
285 | - ?> |
|
280 | + // invoke OnTVFormPrerender event |
|
281 | + $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
|
282 | + if(is_array($evtOut)) { |
|
283 | + echo implode("", $evtOut); |
|
284 | + } |
|
285 | + ?> |
|
286 | 286 | <input type="hidden" name="id" value="<?= $content['id'] ?>"> |
287 | 287 | <input type="hidden" name="a" value="302"> |
288 | 288 | <input type="hidden" name="or" value="<?= $origin ?>"> |
@@ -343,11 +343,11 @@ discard block |
||
343 | 343 | <select name="categoryid" class="form-control" onChange="documentDirty=true;"> |
344 | 344 | <option> </option> |
345 | 345 | <?php |
346 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
347 | - foreach(getCategories() as $n => $v) { |
|
348 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
349 | - } |
|
350 | - ?> |
|
346 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
347 | + foreach(getCategories() as $n => $v) { |
|
348 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
349 | + } |
|
350 | + ?> |
|
351 | 351 | </select> |
352 | 352 | </div> |
353 | 353 | </div> |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | <optgroup label="Custom Type"> |
384 | 384 | <option value="custom_tv" <?= ($content['type'] == 'custom_tv' ? "selected='selected'" : "") ?>>Custom Input</option> |
385 | 385 | <?php |
386 | - $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
387 | - foreach($custom_tvs as $ctv) { |
|
388 | - if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
389 | - $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
390 | - echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
391 | - } |
|
392 | - } |
|
393 | - ?> |
|
386 | + $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
387 | + foreach($custom_tvs as $ctv) { |
|
388 | + if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
389 | + $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
390 | + echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
391 | + } |
|
392 | + } |
|
393 | + ?> |
|
394 | 394 | </optgroup> |
395 | 395 | </select> |
396 | 396 | </div> |
@@ -455,63 +455,63 @@ discard block |
||
455 | 455 | <a class="btn btn-secondary btn-sm" href="javascript:;" onClick="check_toggle(); return false;"><?= $_lang['check_toggle'] ?></a> |
456 | 456 | </div> |
457 | 457 | <?php |
458 | - $rs = $modx->db->select(sprintf("tpl.id AS id, templatename, tpl.description AS tpldescription, tpl.locked AS tpllocked, tpl.selectable AS selectable, tmplvarid, if(isnull(cat.category),'%s',cat.category) AS category, cat.id AS catid", $_lang['no_category']), sprintf("%s as tpl |
|
458 | + $rs = $modx->db->select(sprintf("tpl.id AS id, templatename, tpl.description AS tpldescription, tpl.locked AS tpllocked, tpl.selectable AS selectable, tmplvarid, if(isnull(cat.category),'%s',cat.category) AS category, cat.id AS catid", $_lang['no_category']), sprintf("%s as tpl |
|
459 | 459 | LEFT JOIN %s as stt ON stt.templateid=tpl.id AND stt.tmplvarid='%s' |
460 | 460 | LEFT JOIN %s as cat ON tpl.category=cat.id", $modx->getFullTableName('site_templates'), $modx->getFullTableName('site_tmplvar_templates'), $id, $modx->getFullTableName('categories')), '', "category, templatename"); |
461 | 461 | |
462 | - $tplList = '<ul>'; |
|
463 | - $preCat = ''; |
|
464 | - $insideUl = 0; |
|
465 | - while($row = $modx->db->getRow($rs)) { |
|
466 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
467 | - if($preCat !== $row['category']) { |
|
468 | - $tplList .= $insideUl ? '</ul>' : ''; |
|
469 | - $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
470 | - $insideUl = 1; |
|
471 | - } |
|
472 | - |
|
473 | - if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
474 | - $checked = true; |
|
475 | - } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
476 | - $checked = true; |
|
477 | - } elseif($id == 0 && is_array($_POST['template'])) { |
|
478 | - $checked = in_array($row['id'], $_POST['template']); |
|
479 | - } else { |
|
480 | - $checked = $row['tmplvarid']; |
|
481 | - } |
|
482 | - $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
|
483 | - $checked = $checked ? ' checked="checked"' : ''; |
|
484 | - $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
485 | - $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
486 | - |
|
487 | - $tplInfo = array(); |
|
488 | - if($row['tpllocked']) { |
|
489 | - $tplInfo[] = $_lang['locked']; |
|
490 | - } |
|
491 | - if($row['id'] == $modx->config['default_template']) { |
|
492 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
493 | - } |
|
494 | - $tplInfo = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
495 | - |
|
496 | - $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
|
497 | - $tplList .= '</li>'; |
|
498 | - |
|
499 | - $preCat = $row['category']; |
|
500 | - } |
|
501 | - $tplList .= $insideUl ? '</ul>' : ''; |
|
502 | - $tplList .= '</ul>'; |
|
503 | - echo $tplList; |
|
504 | - |
|
505 | - ?> |
|
462 | + $tplList = '<ul>'; |
|
463 | + $preCat = ''; |
|
464 | + $insideUl = 0; |
|
465 | + while($row = $modx->db->getRow($rs)) { |
|
466 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
467 | + if($preCat !== $row['category']) { |
|
468 | + $tplList .= $insideUl ? '</ul>' : ''; |
|
469 | + $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
470 | + $insideUl = 1; |
|
471 | + } |
|
472 | + |
|
473 | + if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
474 | + $checked = true; |
|
475 | + } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
476 | + $checked = true; |
|
477 | + } elseif($id == 0 && is_array($_POST['template'])) { |
|
478 | + $checked = in_array($row['id'], $_POST['template']); |
|
479 | + } else { |
|
480 | + $checked = $row['tmplvarid']; |
|
481 | + } |
|
482 | + $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
|
483 | + $checked = $checked ? ' checked="checked"' : ''; |
|
484 | + $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
485 | + $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
486 | + |
|
487 | + $tplInfo = array(); |
|
488 | + if($row['tpllocked']) { |
|
489 | + $tplInfo[] = $_lang['locked']; |
|
490 | + } |
|
491 | + if($row['id'] == $modx->config['default_template']) { |
|
492 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
493 | + } |
|
494 | + $tplInfo = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
495 | + |
|
496 | + $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
|
497 | + $tplList .= '</li>'; |
|
498 | + |
|
499 | + $preCat = $row['category']; |
|
500 | + } |
|
501 | + $tplList .= $insideUl ? '</ul>' : ''; |
|
502 | + $tplList .= '</ul>'; |
|
503 | + echo $tplList; |
|
504 | + |
|
505 | + ?> |
|
506 | 506 | |
507 | 507 | <!-- Access Permissions --> |
508 | 508 | <?php |
509 | - if($use_udperms == 1) { |
|
510 | - // fetch permissions for the variable |
|
511 | - $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
|
512 | - $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
|
509 | + if($use_udperms == 1) { |
|
510 | + // fetch permissions for the variable |
|
511 | + $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
|
512 | + $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
|
513 | 513 | |
514 | - ?> |
|
514 | + ?> |
|
515 | 515 | <?php if($modx->hasPermission('access_permissions')) { ?> |
516 | 516 | <script type="text/javascript"> |
517 | 517 | function makePublic(b) { |
@@ -539,29 +539,29 @@ discard block |
||
539 | 539 | <!--<b><?php /*echo $_lang['access_permissions']; */ ?></b>--> |
540 | 540 | <p><?= $_lang['tmplvar_access_msg'] ?></p> |
541 | 541 | <?php |
542 | - $chk = ''; |
|
543 | - $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
|
544 | - if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
545 | - $groupsarray = $_POST['docgroups']; |
|
546 | - } |
|
547 | - while($row = $modx->db->getRow($rs)) { |
|
548 | - $checked = in_array($row['id'], $groupsarray); |
|
549 | - if($modx->hasPermission('access_permissions')) { |
|
550 | - if($checked) { |
|
551 | - $notPublic = true; |
|
552 | - } |
|
553 | - $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
554 | - } else { |
|
555 | - if($checked) { |
|
556 | - echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
557 | - } |
|
558 | - } |
|
559 | - } |
|
560 | - if($modx->hasPermission('access_permissions')) { |
|
561 | - $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
562 | - } |
|
563 | - echo '<ul>' . $chks . '</ul>'; |
|
564 | - ?> |
|
542 | + $chk = ''; |
|
543 | + $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
|
544 | + if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
545 | + $groupsarray = $_POST['docgroups']; |
|
546 | + } |
|
547 | + while($row = $modx->db->getRow($rs)) { |
|
548 | + $checked = in_array($row['id'], $groupsarray); |
|
549 | + if($modx->hasPermission('access_permissions')) { |
|
550 | + if($checked) { |
|
551 | + $notPublic = true; |
|
552 | + } |
|
553 | + $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
554 | + } else { |
|
555 | + if($checked) { |
|
556 | + echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
557 | + } |
|
558 | + } |
|
559 | + } |
|
560 | + if($modx->hasPermission('access_permissions')) { |
|
561 | + $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
562 | + } |
|
563 | + echo '<ul>' . $chks . '</ul>'; |
|
564 | + ?> |
|
565 | 565 | <?php } ?> |
566 | 566 | <?php } ?> |
567 | 567 | |
@@ -571,12 +571,12 @@ discard block |
||
571 | 571 | <input type="submit" name="save" style="display:none"> |
572 | 572 | |
573 | 573 | <?php |
574 | - // invoke OnTVFormRender event |
|
575 | - $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
|
576 | - if(is_array($evtOut)) { |
|
577 | - echo implode('', $evtOut); |
|
578 | - } |
|
579 | - ?> |
|
574 | + // invoke OnTVFormRender event |
|
575 | + $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
|
576 | + if(is_array($evtOut)) { |
|
577 | + echo implode('', $evtOut); |
|
578 | + } |
|
579 | + ?> |
|
580 | 580 | </div> |
581 | 581 | </form> |
582 | 582 | <script type="text/javascript">setTimeout('showParameters()', 10);</script> |
@@ -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('edit_template') && $modx->manager->action == '301') { |
|
5 | +if (!$modx->hasPermission('edit_template') && $modx->manager->action == '301') { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | -if(!$modx->hasPermission('new_template') && $modx->manager->action == '300') { |
|
8 | +if (!$modx->hasPermission('new_template') && $modx->manager->action == '300') { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | |
12 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
13 | -$origin = isset($_REQUEST['or']) ? (int)$_REQUEST['or'] : 76; |
|
14 | -$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : NULL; |
|
12 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
13 | +$origin = isset($_REQUEST['or']) ? (int) $_REQUEST['or'] : 76; |
|
14 | +$originId = isset($_REQUEST['oid']) ? (int) $_REQUEST['oid'] : NULL; |
|
15 | 15 | |
16 | 16 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
17 | 17 | $tbl_site_templates = $modx->getFullTableName('site_templates'); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $tbl_documentgroup_names = $modx->getFullTableName('documentgroup_names'); |
20 | 20 | |
21 | 21 | // check to see the snippet editor isn't locked |
22 | -if($lockedEl = $modx->elementIsLocked(2, $id)) { |
|
22 | +if ($lockedEl = $modx->elementIsLocked(2, $id)) { |
|
23 | 23 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
24 | 24 | } |
25 | 25 | // end check for lock |
@@ -29,25 +29,25 @@ discard block |
||
29 | 29 | |
30 | 30 | global $content; |
31 | 31 | $content = array(); |
32 | -if(isset($_GET['id'])) { |
|
32 | +if (isset($_GET['id'])) { |
|
33 | 33 | $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
34 | 34 | $content = $modx->db->getRow($rs); |
35 | - if(!$content) { |
|
36 | - header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
35 | + if (!$content) { |
|
36 | + header("Location: ".MODX_SITE_URL."index.php?id={$site_start}"); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $_SESSION['itemname'] = $content['caption']; |
40 | - if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
40 | + if ($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
41 | 41 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
42 | 42 | } |
43 | -} else if(isset($_REQUEST['itemname'])) { |
|
43 | +} else if (isset($_REQUEST['itemname'])) { |
|
44 | 44 | $content['name'] = $_REQUEST['itemname']; |
45 | 45 | } else { |
46 | 46 | $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
47 | - $content['category'] = (int)$_REQUEST['catid']; |
|
47 | + $content['category'] = (int) $_REQUEST['catid']; |
|
48 | 48 | } |
49 | 49 | |
50 | -if($modx->manager->hasFormValues()) { |
|
50 | +if ($modx->manager->hasFormValues()) { |
|
51 | 51 | $modx->manager->loadFormValues(); |
52 | 52 | } |
53 | 53 | |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | // Add lock-element JS-Script |
57 | 57 | $lockElementId = $id; |
58 | 58 | $lockElementType = 2; |
59 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
59 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
60 | 60 | |
61 | 61 | // get available RichText Editors |
62 | 62 | $RTEditors = ''; |
63 | 63 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister', array('forfrontend' => 1)); |
64 | -if(is_array($evtOut)) { |
|
64 | +if (is_array($evtOut)) { |
|
65 | 65 | $RTEditors = implode(',', $evtOut); |
66 | 66 | } |
67 | 67 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | }, |
108 | 108 | cancel: function() { |
109 | 109 | documentDirty = false; |
110 | - document.location.href = 'index.php?a=<?= $origin ?><?=(empty($originId) ? '' : '&id=' . $originId) ?>'; |
|
110 | + document.location.href = 'index.php?a=<?= $origin ?><?=(empty($originId) ? '' : '&id='.$originId) ?>'; |
|
111 | 111 | } |
112 | 112 | }; |
113 | 113 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | <?php |
280 | 280 | // invoke OnTVFormPrerender event |
281 | 281 | $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
282 | - if(is_array($evtOut)) { |
|
282 | + if (is_array($evtOut)) { |
|
283 | 283 | echo implode("", $evtOut); |
284 | 284 | } |
285 | 285 | ?> |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | <input type="hidden" name="params" value="<?= $modx->htmlspecialchars($content['display_params']) ?>"> |
292 | 292 | |
293 | 293 | <h1> |
294 | - <i class="fa fa-list-alt"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_tmplvars']) ?><i class="fa fa-question-circle help"></i> |
|
294 | + <i class="fa fa-list-alt"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_tmplvars']) ?><i class="fa fa-question-circle help"></i> |
|
295 | 295 | </h1> |
296 | 296 | |
297 | 297 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -314,8 +314,8 @@ discard block |
||
314 | 314 | <div class="col-md-9 col-lg-10"> |
315 | 315 | <div class="form-control-name clearfix"> |
316 | 316 | <input name="name" type="text" maxlength="50" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
317 | - <?php if($modx->hasPermission('save_role')): ?> |
|
318 | - <label class="custom-control" title="<?= $_lang['lock_tmplvars'] . "\n" . $_lang['lock_tmplvars_msg'] ?>" tooltip> |
|
317 | + <?php if ($modx->hasPermission('save_role')): ?> |
|
318 | + <label class="custom-control" title="<?= $_lang['lock_tmplvars']."\n".$_lang['lock_tmplvars_msg'] ?>" tooltip> |
|
319 | 319 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
320 | 320 | <i class="fa fa-lock"></i> |
321 | 321 | </label> |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | <select name="categoryid" class="form-control" onChange="documentDirty=true;"> |
344 | 344 | <option> </option> |
345 | 345 | <?php |
346 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
347 | - foreach(getCategories() as $n => $v) { |
|
348 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
346 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
347 | + foreach (getCategories() as $n => $v) { |
|
348 | + echo "<option value='".$v['id']."'".($content["category"] == $v["id"] ? " selected='selected'" : "").">".$modx->htmlspecialchars($v["category"])."</option>"; |
|
349 | 349 | } |
350 | 350 | ?> |
351 | 351 | </select> |
@@ -383,11 +383,11 @@ discard block |
||
383 | 383 | <optgroup label="Custom Type"> |
384 | 384 | <option value="custom_tv" <?= ($content['type'] == 'custom_tv' ? "selected='selected'" : "") ?>>Custom Input</option> |
385 | 385 | <?php |
386 | - $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
387 | - foreach($custom_tvs as $ctv) { |
|
388 | - if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
389 | - $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
390 | - echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
386 | + $custom_tvs = scandir(MODX_BASE_PATH.'assets/tvs'); |
|
387 | + foreach ($custom_tvs as $ctv) { |
|
388 | + if (strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
389 | + $selected = ($content['type'] == 'custom_tv:'.$ctv ? "selected='selected'" : ""); |
|
390 | + echo '<option value="custom_tv:'.$ctv.'" '.$selected.'>'.$ctv.'</option>'; |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | ?> |
@@ -462,36 +462,36 @@ discard block |
||
462 | 462 | $tplList = '<ul>'; |
463 | 463 | $preCat = ''; |
464 | 464 | $insideUl = 0; |
465 | - while($row = $modx->db->getRow($rs)) { |
|
465 | + while ($row = $modx->db->getRow($rs)) { |
|
466 | 466 | $row['category'] = stripslashes($row['category']); //pixelchutes |
467 | - if($preCat !== $row['category']) { |
|
467 | + if ($preCat !== $row['category']) { |
|
468 | 468 | $tplList .= $insideUl ? '</ul>' : ''; |
469 | - $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
469 | + $tplList .= '<li><strong>'.$row['category'].($row['catid'] != '' ? ' <small>('.$row['catid'].')</small>' : '').'</strong><ul>'; |
|
470 | 470 | $insideUl = 1; |
471 | 471 | } |
472 | 472 | |
473 | - if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
473 | + if ($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
474 | 474 | $checked = true; |
475 | - } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
475 | + } elseif (isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
476 | 476 | $checked = true; |
477 | - } elseif($id == 0 && is_array($_POST['template'])) { |
|
477 | + } elseif ($id == 0 && is_array($_POST['template'])) { |
|
478 | 478 | $checked = in_array($row['id'], $_POST['template']); |
479 | 479 | } else { |
480 | 480 | $checked = $row['tmplvarid']; |
481 | 481 | } |
482 | 482 | $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
483 | 483 | $checked = $checked ? ' checked="checked"' : ''; |
484 | - $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
485 | - $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
484 | + $tplId = ' <small>('.$row['id'].')</small>'; |
|
485 | + $desc = !empty($row['tpldescription']) ? ' - '.$row['tpldescription'] : ''; |
|
486 | 486 | |
487 | 487 | $tplInfo = array(); |
488 | - if($row['tpllocked']) { |
|
488 | + if ($row['tpllocked']) { |
|
489 | 489 | $tplInfo[] = $_lang['locked']; |
490 | 490 | } |
491 | - if($row['id'] == $modx->config['default_template']) { |
|
491 | + if ($row['id'] == $modx->config['default_template']) { |
|
492 | 492 | $tplInfo[] = $_lang['defaulttemplate_title']; |
493 | 493 | } |
494 | - $tplInfo = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
494 | + $tplInfo = !empty($tplInfo) ? ' <em>('.implode(', ', $tplInfo).')</em>' : ''; |
|
495 | 495 | |
496 | 496 | $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
497 | 497 | $tplList .= '</li>'; |
@@ -506,13 +506,13 @@ discard block |
||
506 | 506 | |
507 | 507 | <!-- Access Permissions --> |
508 | 508 | <?php |
509 | - if($use_udperms == 1) { |
|
509 | + if ($use_udperms == 1) { |
|
510 | 510 | // fetch permissions for the variable |
511 | 511 | $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
512 | 512 | $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
513 | 513 | |
514 | 514 | ?> |
515 | - <?php if($modx->hasPermission('access_permissions')) { ?> |
|
515 | + <?php if ($modx->hasPermission('access_permissions')) { ?> |
|
516 | 516 | <script type="text/javascript"> |
517 | 517 | function makePublic(b) { |
518 | 518 | var notPublic = false; |
@@ -541,26 +541,26 @@ discard block |
||
541 | 541 | <?php |
542 | 542 | $chk = ''; |
543 | 543 | $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
544 | - if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
544 | + if (empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
545 | 545 | $groupsarray = $_POST['docgroups']; |
546 | 546 | } |
547 | - while($row = $modx->db->getRow($rs)) { |
|
547 | + while ($row = $modx->db->getRow($rs)) { |
|
548 | 548 | $checked = in_array($row['id'], $groupsarray); |
549 | - if($modx->hasPermission('access_permissions')) { |
|
550 | - if($checked) { |
|
549 | + if ($modx->hasPermission('access_permissions')) { |
|
550 | + if ($checked) { |
|
551 | 551 | $notPublic = true; |
552 | 552 | } |
553 | - $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
553 | + $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='".$row['id']."' ".($checked ? "checked='checked'" : '')." onclick=\"makePublic(false)\" /> ".$row['name']."</label></li>"; |
|
554 | 554 | } else { |
555 | - if($checked) { |
|
556 | - echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
555 | + if ($checked) { |
|
556 | + echo "<input type='hidden' name='docgroups[]' value='".$row['id']."' />"; |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | } |
560 | - if($modx->hasPermission('access_permissions')) { |
|
561 | - $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
560 | + if ($modx->hasPermission('access_permissions')) { |
|
561 | + $chks = "<li><label><input type='checkbox' name='chkalldocs' ".(!$notPublic ? "checked='checked'" : '')." onclick=\"makePublic(true)\" /> <span class='warning'>".$_lang['all_doc_groups']."</span></label></li>".$chks; |
|
562 | 562 | } |
563 | - echo '<ul>' . $chks . '</ul>'; |
|
563 | + echo '<ul>'.$chks.'</ul>'; |
|
564 | 564 | ?> |
565 | 565 | <?php } ?> |
566 | 566 | <?php } ?> |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | <?php |
574 | 574 | // invoke OnTVFormRender event |
575 | 575 | $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
576 | - if(is_array($evtOut)) { |
|
576 | + if (is_array($evtOut)) { |
|
577 | 577 | echo implode('', $evtOut); |
578 | 578 | } |
579 | 579 | ?> |
@@ -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']) ? (int)$_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,13 +1,13 @@ 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 | |
10 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
10 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
11 | 11 | |
12 | 12 | // Get table names (alphabetical) |
13 | 13 | $tbl_active_users = $modx->getFullTableName('active_users'); |
@@ -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(); |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch ($modx->manager->action) { |
7 | - case 102: |
|
8 | - if (!$modx->hasPermission('edit_plugin')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 101: |
|
13 | - if (!$modx->hasPermission('new_plugin')) { |
|
7 | + case 102: |
|
8 | + if (!$modx->hasPermission('edit_plugin')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 101: |
|
13 | + if (!$modx->hasPermission('new_plugin')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
14 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -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 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | $tbl_site_plugins = $modx->getFullTableName('site_plugins'); |
24 | 24 | $tbl_site_plugin_events = $modx->getFullTableName('site_plugin_events'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $content['properties'] = str_replace("&", "&", $content['properties']); |
47 | 47 | } else { |
48 | 48 | $_SESSION['itemname'] = $_lang["new_plugin"]; |
49 | - $content['category'] = (int)$_REQUEST['catid']; |
|
49 | + $content['category'] = (int) $_REQUEST['catid']; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | if ($modx->manager->hasFormValues()) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | // Add lock-element JS-Script |
57 | 57 | $lockElementId = $id; |
58 | 58 | $lockElementType = 5; |
59 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
59 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param bool $cond |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
479 | 479 | |
480 | 480 | <h1> |
481 | - <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i> |
|
481 | + <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i> |
|
482 | 482 | </h1> |
483 | 483 | |
484 | 484 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | <div class="form-control-name clearfix"> |
505 | 505 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
506 | 506 | <?php if ($modx->hasPermission('save_role')): ?> |
507 | - <label class="custom-control" title="<?= $_lang['lock_plugin'] . "\n" . $_lang['lock_plugin_msg'] ?>" tooltip> |
|
507 | + <label class="custom-control" title="<?= $_lang['lock_plugin']."\n".$_lang['lock_plugin_msg'] ?>" tooltip> |
|
508 | 508 | <input name="locked" type="checkbox" value="on"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
509 | 509 | <i class="fa fa-lock"></i> |
510 | 510 | </label> |
@@ -528,9 +528,9 @@ discard block |
||
528 | 528 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
529 | 529 | <option> </option> |
530 | 530 | <?php |
531 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
531 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
532 | 532 | foreach (getCategories() as $n => $v) { |
533 | - echo '<option value="' . $v['id'] . '"' . ($content["category"] == $v["id"] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
533 | + echo '<option value="'.$v['id'].'"'.($content["category"] == $v["id"] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v["category"])."</option>"; |
|
534 | 534 | } |
535 | 535 | ?> |
536 | 536 | </select> |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | <?php if ($modx->hasPermission('save_role')): ?> |
547 | 547 | <div class="form-group"> |
548 | 548 | <div class="form-row"> |
549 | - <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['plugin_disabled'] . "</span>" : $_lang['plugin_disabled']) ?></label> |
|
549 | + <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['plugin_disabled']."</span>" : $_lang['plugin_disabled']) ?></label> |
|
550 | 550 | </div> |
551 | 551 | <div class="form-row"> |
552 | 552 | <label> |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | <select name="moduleguid" class="form-control" onchange="documentDirty=true;"> |
594 | 594 | <option> </option> |
595 | 595 | <?php |
596 | - $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules") . " sm |
|
597 | - INNER JOIN " . $modx->getFullTableName("site_module_depobj") . " smd ON smd.module=sm.id AND smd.type=30 |
|
598 | - INNER JOIN " . $modx->getFullTableName("site_plugins") . " sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name'); |
|
596 | + $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules")." sm |
|
597 | + INNER JOIN " . $modx->getFullTableName("site_module_depobj")." smd ON smd.module=sm.id AND smd.type=30 |
|
598 | + INNER JOIN " . $modx->getFullTableName("site_plugins")." sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name'); |
|
599 | 599 | while ($row = $modx->db->getRow($ds)) { |
600 | - echo "<option value='" . $row['guid'] . "'" . ($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row["name"]) . "</option>"; |
|
600 | + echo "<option value='".$row['guid']."'".($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row["name"])."</option>"; |
|
601 | 601 | } |
602 | 602 | ?> |
603 | 603 | </select> |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | echoEventRows($evtnames); |
659 | 659 | } |
660 | 660 | echo '<hr class="clear">'; |
661 | - echo '<div class="form-group"><b>' . $services[$srv - 1] . '</b></div>'; |
|
661 | + echo '<div class="form-group"><b>'.$services[$srv - 1].'</b></div>'; |
|
662 | 662 | } |
663 | 663 | // display group name |
664 | 664 | if ($grp != $row['groupname']) { |
@@ -667,9 +667,9 @@ discard block |
||
667 | 667 | echoEventRows($evtnames); |
668 | 668 | } |
669 | 669 | echo '<hr class="clear">'; |
670 | - echo '<div class="form-group"><b>' . $row['groupname'] . '</b></div>'; |
|
670 | + echo '<div class="form-group"><b>'.$row['groupname'].'</b></div>'; |
|
671 | 671 | } |
672 | - $evtnames[] = '<input name="sysevents[]" id="' . $row['name'] . '" type="checkbox" ' . (in_array($row['id'], $evts) ? ' checked="checked" ' : '') . 'class="inputBox" value="' . $row['id'] . '" /> <label for="' . $row['name'] . '" ' . bold(in_array($row['id'], $evts)) . '> ' . $row['name'] . '</label>' . "\n"; |
|
672 | + $evtnames[] = '<input name="sysevents[]" id="'.$row['name'].'" type="checkbox" '.(in_array($row['id'], $evts) ? ' checked="checked" ' : '').'class="inputBox" value="'.$row['id'].'" /> <label for="'.$row['name'].'" '.bold(in_array($row['id'], $evts)).'> '.$row['name'].'</label>'."\n"; |
|
673 | 673 | if (count($evtnames) == 2) { |
674 | 674 | echoEventRows($evtnames); |
675 | 675 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | |
682 | 682 | function echoEventRows(&$evtnames) |
683 | 683 | { |
684 | - echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">' . implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames) . '</div></div>'; |
|
684 | + echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">'.implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames).'</div></div>'; |
|
685 | 685 | $evtnames = array(); |
686 | 686 | } |
687 | 687 |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch ($modx->manager->action) { |
7 | - case 22: |
|
8 | - if (!$modx->hasPermission('edit_snippet')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 23: |
|
13 | - if (!$modx->hasPermission('new_snippet')) { |
|
7 | + case 22: |
|
8 | + if (!$modx->hasPermission('edit_snippet')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 23: |
|
13 | + if (!$modx->hasPermission('new_snippet')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
14 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -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 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | // Get table Names (alphabetical) |
24 | 24 | $tbl_site_module_depobj = $modx->getFullTableName('site_module_depobj'); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $rs = $modx->db->select('*', $tbl_site_snippets, "id='{$id}'"); |
40 | 40 | $content = $modx->db->getRow($rs); |
41 | 41 | if (!$content) { |
42 | - header("Location: " . MODX_SITE_URL . "index.php?id=" . $site_start); |
|
42 | + header("Location: ".MODX_SITE_URL."index.php?id=".$site_start); |
|
43 | 43 | } |
44 | 44 | $_SESSION['itemname'] = $content['name']; |
45 | 45 | if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $content['name'] = $_REQUEST['itemname']; |
51 | 51 | } else { |
52 | 52 | $_SESSION['itemname'] = $_lang["new_snippet"]; |
53 | - $content['category'] = (int)$_REQUEST['catid']; |
|
53 | + $content['category'] = (int) $_REQUEST['catid']; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($modx->manager->hasFormValues()) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // Add lock-element JS-Script |
63 | 63 | $lockElementId = $id; |
64 | 64 | $lockElementType = 4; |
65 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
65 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
66 | 66 | ?> |
67 | 67 | <script type="text/javascript"> |
68 | 68 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
432 | 432 | |
433 | 433 | <h1 class="pagetitle"> |
434 | - <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i> |
|
434 | + <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i> |
|
435 | 435 | </h1> |
436 | 436 | |
437 | 437 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | <div class="form-control-name clearfix"> |
458 | 458 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
459 | 459 | <?php if ($modx->hasPermission('save_role')): ?> |
460 | - <label class="custom-control" title="<?= $_lang['lock_snippet'] . "\n" . $_lang['lock_snippet_msg'] ?>" tooltip> |
|
460 | + <label class="custom-control" title="<?= $_lang['lock_snippet']."\n".$_lang['lock_snippet_msg'] ?>" tooltip> |
|
461 | 461 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
462 | 462 | <i class="fa fa-lock"></i> |
463 | 463 | </label> |
@@ -481,9 +481,9 @@ discard block |
||
481 | 481 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
482 | 482 | <option> </option> |
483 | 483 | <?php |
484 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
484 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
485 | 485 | foreach (getCategories() as $n => $v) { |
486 | - echo '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . '</option>'; |
|
486 | + echo '<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category']).'</option>'; |
|
487 | 487 | } |
488 | 488 | ?> |
489 | 489 | </select> |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | <div class="form-group"> |
501 | 501 | <?php if ($_SESSION['mgrRole'] == 1): ?> |
502 | 502 | <div class="form-row"> |
503 | - <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['disabled'] . "</span>" : $_lang['disabled']) ?></label> |
|
503 | + <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['disabled']."</span>" : $_lang['disabled']) ?></label> |
|
504 | 504 | </div> |
505 | 505 | <?php endif; ?> |
506 | 506 | <div class="form-row"> |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | <span><?= $_lang['snippet_code'] ?></span> |
518 | 518 | </div> |
519 | 519 | <div class="section-editor clearfix"> |
520 | - <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->htmlspecialchars($content['post'])) : "<?php" . "\n" . trim($modx->htmlspecialchars($content['snippet'])) . "\n") ?></textarea> |
|
520 | + <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->htmlspecialchars($content['post'])) : "<?php"."\n".trim($modx->htmlspecialchars($content['snippet']))."\n") ?></textarea> |
|
521 | 521 | </div> |
522 | 522 | <!-- PHP text editor end --> |
523 | 523 | </div> |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | INNER JOIN {$tbl_site_module_depobj} AS smd ON smd.module=sm.id AND smd.type=40 |
553 | 553 | INNER JOIN {$tbl_site_snippets} AS ss ON ss.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams=1", 'sm.name'); |
554 | 554 | while ($row = $modx->db->getRow($ds)) { |
555 | - echo "<option value='" . $row['guid'] . "'" . ($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row['name']) . "</option>"; |
|
555 | + echo "<option value='".$row['guid']."'".($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row['name'])."</option>"; |
|
556 | 556 | } |
557 | 557 | ?> |
558 | 558 | </select> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -$userid = (int)$value; |
|
2 | +$userid = (int) $value; |
|
3 | 3 | if (!isset($modx->filter->cache['ui'][$userid])) { |
4 | 4 | if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid)); |
5 | 5 | else $user = $modx->getUserInfo($userid); |
@@ -1,8 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | $userid = (int)$value; |
3 | 3 | if (!isset($modx->filter->cache['ui'][$userid])) { |
4 | - if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid)); |
|
5 | - else $user = $modx->getUserInfo($userid); |
|
4 | + if ($userid < 0) { |
|
5 | + $user = $modx->getWebUserInfo(abs($userid)); |
|
6 | + } else { |
|
7 | + $user = $modx->getUserInfo($userid); |
|
8 | + } |
|
6 | 9 | $modx->filter->cache['ui'][$userid] = $user; |
7 | 10 | } else { |
8 | 11 | $user = $modx->filter->cache['ui'][$userid]; |
@@ -1,43 +1,43 @@ |
||
1 | 1 | <?php |
2 | -if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt); |
|
3 | -elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} |
|
4 | -else {$limit=124;$delim='';} |
|
2 | +if (strpos($opt, ',')) list($limit, $delim) = explode(',', $opt); |
|
3 | +elseif (preg_match('/^[1-9][0-9]*$/', $opt)) {$limit = $opt; $delim = ''; } |
|
4 | +else {$limit = 124; $delim = ''; } |
|
5 | 5 | |
6 | -if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.'; |
|
7 | -$limit = (int)$limit; |
|
6 | +if ($delim === '') $delim = $modx->config['manager_language'] === 'japanese-utf8' ? '。' : '.'; |
|
7 | +$limit = (int) $limit; |
|
8 | 8 | |
9 | 9 | $content = $modx->filter->parseDocumentSource($value); |
10 | 10 | |
11 | 11 | $content = strip_tags($content); |
12 | 12 | |
13 | -$content = str_replace(array("\r\n","\r","\n","\t",' '),' ',$content); |
|
14 | -if(preg_match('/\s+/',$content)) |
|
15 | - $content = preg_replace('/\s+/',' ',$content); |
|
13 | +$content = str_replace(array("\r\n", "\r", "\n", "\t", ' '), ' ', $content); |
|
14 | +if (preg_match('/\s+/', $content)) |
|
15 | + $content = preg_replace('/\s+/', ' ', $content); |
|
16 | 16 | $content = trim($content); |
17 | 17 | |
18 | 18 | $pos = $modx->filter->strpos($content, $delim); |
19 | 19 | |
20 | -if($pos!==false && $pos<$limit) { |
|
20 | +if ($pos !== false && $pos < $limit) { |
|
21 | 21 | $_ = explode($delim, $content); |
22 | 22 | $text = ''; |
23 | - foreach($_ as $v) { |
|
24 | - if($limit <= $modx->filter->strlen($text.$v.$delim)) break; |
|
23 | + foreach ($_ as $v) { |
|
24 | + if ($limit <= $modx->filter->strlen($text.$v.$delim)) break; |
|
25 | 25 | $text .= $v.$delim; |
26 | 26 | } |
27 | - if($text) $content = $text; |
|
27 | + if ($text) $content = $text; |
|
28 | 28 | } |
29 | 29 | |
30 | -if($limit<$modx->filter->strlen($content) && strpos($content,' ')!==false) { |
|
30 | +if ($limit < $modx->filter->strlen($content) && strpos($content, ' ') !== false) { |
|
31 | 31 | $_ = explode(' ', $content); |
32 | 32 | $text = ''; |
33 | - foreach($_ as $v) { |
|
34 | - if($limit <= $modx->filter->strlen($text.$v.' ')) break; |
|
35 | - $text .= $v . ' '; |
|
33 | + foreach ($_ as $v) { |
|
34 | + if ($limit <= $modx->filter->strlen($text.$v.' ')) break; |
|
35 | + $text .= $v.' '; |
|
36 | 36 | } |
37 | - if($text!=='') $content = $text; |
|
37 | + if ($text !== '') $content = $text; |
|
38 | 38 | } |
39 | 39 | |
40 | -if($limit < $modx->filter->strlen($content)) $content = $modx->filter->substr($content, 0, $limit); |
|
41 | -if($modx->filter->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim; |
|
40 | +if ($limit < $modx->filter->strlen($content)) $content = $modx->filter->substr($content, 0, $limit); |
|
41 | +if ($modx->filter->substr($content, -1) == $delim) $content = rtrim($content, $delim).$delim; |
|
42 | 42 | |
43 | 43 | return $content; |
@@ -1,9 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt); |
|
3 | -elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} |
|
4 | -else {$limit=124;$delim='';} |
|
2 | +if(strpos($opt,',')) { |
|
3 | + list($limit,$delim) = explode(',', $opt); |
|
4 | +} elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} else {$limit=124;$delim='';} |
|
5 | 5 | |
6 | -if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.'; |
|
6 | +if($delim==='') { |
|
7 | + $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.'; |
|
8 | +} |
|
7 | 9 | $limit = (int)$limit; |
8 | 10 | |
9 | 11 | $content = $modx->filter->parseDocumentSource($value); |
@@ -11,8 +13,9 @@ discard block |
||
11 | 13 | $content = strip_tags($content); |
12 | 14 | |
13 | 15 | $content = str_replace(array("\r\n","\r","\n","\t",' '),' ',$content); |
14 | -if(preg_match('/\s+/',$content)) |
|
16 | +if(preg_match('/\s+/',$content)) { |
|
15 | 17 | $content = preg_replace('/\s+/',' ',$content); |
18 | +} |
|
16 | 19 | $content = trim($content); |
17 | 20 | |
18 | 21 | $pos = $modx->filter->strpos($content, $delim); |
@@ -21,23 +24,35 @@ discard block |
||
21 | 24 | $_ = explode($delim, $content); |
22 | 25 | $text = ''; |
23 | 26 | foreach($_ as $v) { |
24 | - if($limit <= $modx->filter->strlen($text.$v.$delim)) break; |
|
27 | + if($limit <= $modx->filter->strlen($text.$v.$delim)) { |
|
28 | + break; |
|
29 | + } |
|
25 | 30 | $text .= $v.$delim; |
26 | 31 | } |
27 | - if($text) $content = $text; |
|
28 | -} |
|
32 | + if($text) { |
|
33 | + $content = $text; |
|
34 | + } |
|
35 | + } |
|
29 | 36 | |
30 | 37 | if($limit<$modx->filter->strlen($content) && strpos($content,' ')!==false) { |
31 | 38 | $_ = explode(' ', $content); |
32 | 39 | $text = ''; |
33 | 40 | foreach($_ as $v) { |
34 | - if($limit <= $modx->filter->strlen($text.$v.' ')) break; |
|
41 | + if($limit <= $modx->filter->strlen($text.$v.' ')) { |
|
42 | + break; |
|
43 | + } |
|
35 | 44 | $text .= $v . ' '; |
36 | 45 | } |
37 | - if($text!=='') $content = $text; |
|
38 | -} |
|
46 | + if($text!=='') { |
|
47 | + $content = $text; |
|
48 | + } |
|
49 | + } |
|
39 | 50 | |
40 | -if($limit < $modx->filter->strlen($content)) $content = $modx->filter->substr($content, 0, $limit); |
|
41 | -if($modx->filter->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim; |
|
51 | +if($limit < $modx->filter->strlen($content)) { |
|
52 | + $content = $modx->filter->substr($content, 0, $limit); |
|
53 | +} |
|
54 | +if($modx->filter->substr($content,-1)==$delim) { |
|
55 | + $content = rtrim($content,$delim) . $delim; |
|
56 | +} |
|
42 | 57 | |
43 | 58 | return $content; |