@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE != "true") { |
|
2 | +if (IN_MANAGER_MODE != "true") { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('view_eventlog')) { |
|
5 | +if (!$modx->hasPermission('view_eventlog')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | ?> |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | <div class="form-group" id="lyr1"> |
18 | 18 | <b><?= $_lang["publish_events"] ?></b> |
19 | 19 | <?php |
20 | - $rs = $modx->db->select('id, pagetitle, pub_date', $modx->getFullTableName('site_content'), "pub_date > " . time() . "", 'pub_date ASC'); |
|
20 | + $rs = $modx->db->select('id, pagetitle, pub_date', $modx->getFullTableName('site_content'), "pub_date > ".time()."", 'pub_date ASC'); |
|
21 | 21 | $limit = $modx->db->getRecordCount($rs); |
22 | - if($limit < 1) { |
|
22 | + if ($limit < 1) { |
|
23 | 23 | ?> |
24 | 24 | <p><?= $_lang["no_docs_pending_publishing"] ?></p> |
25 | 25 | <?php |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | </thead> |
37 | 37 | <tbody> |
38 | 38 | <?php |
39 | - while($row = $modx->db->getRow($rs)) { |
|
39 | + while ($row = $modx->db->getRow($rs)) { |
|
40 | 40 | ?> |
41 | 41 | <tr> |
42 | 42 | <td class="text-right"><?= $row['id'] ?></td> |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | <div class="form-group" id="lyr2"> |
57 | 57 | <b><?= $_lang["unpublish_events"] ?></b> |
58 | 58 | <?php |
59 | - $rs = $modx->db->select('id, pagetitle, unpub_date', $modx->getFullTableName('site_content'), "unpub_date > " . time() . "", 'unpub_date ASC'); |
|
59 | + $rs = $modx->db->select('id, pagetitle, unpub_date', $modx->getFullTableName('site_content'), "unpub_date > ".time()."", 'unpub_date ASC'); |
|
60 | 60 | $limit = $modx->db->getRecordCount($rs); |
61 | - if($limit < 1) { |
|
61 | + if ($limit < 1) { |
|
62 | 62 | ?> |
63 | 63 | <p><?= $_lang["no_docs_pending_unpublishing"] ?></p> |
64 | 64 | <?php |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | </thead> |
76 | 76 | <tbody> |
77 | 77 | <?php |
78 | - while($row = $modx->db->getRow($rs)) { |
|
78 | + while ($row = $modx->db->getRow($rs)) { |
|
79 | 79 | ?> |
80 | 80 | <tr> |
81 | 81 | <td class="text-right"><?= $row['id'] ?></td> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | <?php |
98 | 98 | $rs = $modx->db->select('id, pagetitle, pub_date, unpub_date', $modx->getFullTableName('site_content'), "pub_date > 0 OR unpub_date > 0", "pub_date DESC"); |
99 | 99 | $limit = $modx->db->getRecordCount($rs); |
100 | - if($limit < 1) { |
|
100 | + if ($limit < 1) { |
|
101 | 101 | ?> |
102 | 102 | <p><?= $_lang["no_docs_pending_pubunpub"] ?></p> |
103 | 103 | <?php |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | </thead> |
116 | 116 | <tbody> |
117 | 117 | <?php |
118 | - while($row = $modx->db->getRow($rs)) { |
|
118 | + while ($row = $modx->db->getRow($rs)) { |
|
119 | 119 | ?> |
120 | 120 | <tr> |
121 | 121 | <td class="text-right"><?= $row['id'] ?></td> |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE != "true") { |
|
2 | +if (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; |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | $tbl_site_templates = $modx->getFullTableName('site_templates'); |
30 | 30 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
31 | 31 | // create globally unique identifiers (guid) |
32 | -function createGUID() { |
|
32 | +function createGUID(){ |
|
33 | 33 | srand((double) microtime() * 1000000); |
34 | 34 | $r = rand(); |
35 | - $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
35 | + $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1); |
|
36 | 36 | $m = md5($u); |
37 | 37 | return $m; |
38 | 38 | } |
39 | 39 | |
40 | 40 | // check to see the module editor isn't locked |
41 | -if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
41 | +if ($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
42 | 42 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
43 | 43 | } |
44 | 44 | // end check for lock |
@@ -46,29 +46,29 @@ discard block |
||
46 | 46 | // Lock snippet for other users to edit |
47 | 47 | $modx->lockElement(6, $id); |
48 | 48 | |
49 | -if(isset($_GET['id'])) { |
|
49 | +if (isset($_GET['id'])) { |
|
50 | 50 | $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
51 | 51 | $content = $modx->db->getRow($rs); |
52 | - if(!$content) { |
|
52 | + if (!$content) { |
|
53 | 53 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
54 | 54 | } |
55 | 55 | $content['properties'] = str_replace("&", "&", $content['properties']); |
56 | 56 | $_SESSION['itemname'] = $content['name']; |
57 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
57 | + if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
58 | 58 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
59 | 59 | } |
60 | 60 | } else { |
61 | 61 | $_SESSION['itemname'] = $_lang["new_module"]; |
62 | 62 | $content['wrap'] = '1'; |
63 | 63 | } |
64 | -if($modx->manager->hasFormValues()) { |
|
64 | +if ($modx->manager->hasFormValues()) { |
|
65 | 65 | $modx->manager->loadFormValues(); |
66 | 66 | } |
67 | 67 | |
68 | 68 | // Add lock-element JS-Script |
69 | 69 | $lockElementId = $id; |
70 | 70 | $lockElementType = 6; |
71 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
71 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
72 | 72 | ?> |
73 | 73 | <script type="text/javascript"> |
74 | 74 | function loadDependencies() { |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | function BrowseServer() { |
416 | 416 | var w = screen.width * 0.7; |
417 | 417 | var h = screen.height * 0.7; |
418 | - OpenServerBrowser("<?= MODX_MANAGER_URL;?>media/browser/<?= $which_browser;?>/browser.php?Type=images", w, h); |
|
418 | + OpenServerBrowser("<?= MODX_MANAGER_URL; ?>media/browser/<?= $which_browser; ?>/browser.php?Type=images", w, h); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | function SetUrl(url, width, height, alt) { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | <?php |
436 | 436 | // invoke OnModFormPrerender event |
437 | 437 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
438 | - if(is_array($evtOut)) { |
|
438 | + if (is_array($evtOut)) { |
|
439 | 439 | echo implode('', $evtOut); |
440 | 440 | } |
441 | 441 | |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
450 | 450 | |
451 | 451 | <h1> |
452 | - <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> |
|
452 | + <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> |
|
453 | 453 | </h1> |
454 | 454 | |
455 | 455 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | <div class="col-md-9 col-lg-10"> |
475 | 475 | <div class="form-control-name clearfix"> |
476 | 476 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
477 | - <?php if($modx->hasPermission('save_role')): ?> |
|
478 | - <label class="custom-control" title="<?= $_lang['lock_module'] . "\n" . $_lang['lock_module_msg'] ?>" tooltip> |
|
477 | + <?php if ($modx->hasPermission('save_role')): ?> |
|
478 | + <label class="custom-control" title="<?= $_lang['lock_module']."\n".$_lang['lock_module_msg'] ?>" tooltip> |
|
479 | 479 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
480 | 480 | <i class="fa fa-lock"></i> |
481 | 481 | </label> |
@@ -497,9 +497,9 @@ discard block |
||
497 | 497 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
498 | 498 | <option> </option> |
499 | 499 | <?php |
500 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
501 | - foreach(getCategories() as $n => $v) { |
|
502 | - echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
500 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
501 | + foreach (getCategories() as $n => $v) { |
|
502 | + echo "\t\t\t".'<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category'])."</option>\n"; |
|
503 | 503 | } |
504 | 504 | ?> |
505 | 505 | </select> |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | <div class="form-group"> |
532 | 532 | <div class="form-row"> |
533 | 533 | <label for="disabled"><input name="disabled" id="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> |
534 | - <?= ($content['disabled'] == 1 ? '<span class="text-danger">' . $_lang['module_disabled'] . '</span>' : $_lang['module_disabled']) ?></label> |
|
534 | + <?= ($content['disabled'] == 1 ? '<span class="text-danger">'.$_lang['module_disabled'].'</span>' : $_lang['module_disabled']) ?></label> |
|
535 | 535 | </div> |
536 | 536 | <div class="form-row"> |
537 | 537 | <label for="parse_docblock"> |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | </div> |
597 | 597 | <!-- HTML text editor end --> |
598 | 598 | </div> |
599 | - <?php if($modx->manager->action == '108'): ?> |
|
599 | + <?php if ($modx->manager->action == '108'): ?> |
|
600 | 600 | <!-- Dependencies --> |
601 | 601 | <div class="tab-page" id="tabDepend"> |
602 | 602 | <h2 class="tab"><?= $_lang['settings_dependencies'] ?></h2> |
@@ -624,14 +624,14 @@ discard block |
||
624 | 624 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50 |
625 | 625 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name'); |
626 | 626 | |
627 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
627 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
628 | 628 | $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
629 | 629 | $grd->noRecordMsg = $_lang['no_records_found']; |
630 | 630 | $grd->cssClass = 'grid'; |
631 | 631 | $grd->columnHeaderClass = 'gridHeader'; |
632 | 632 | $grd->itemClass = 'gridItem'; |
633 | 633 | $grd->altItemClass = 'gridAltItem'; |
634 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
634 | + $grd->columns = $_lang['element_name']." ,".$_lang['type']; |
|
635 | 635 | $grd->fields = "name,type"; |
636 | 636 | echo $grd->render(); |
637 | 637 | ?> |
@@ -644,13 +644,13 @@ discard block |
||
644 | 644 | <h2 class="tab"><?= $_lang['access_permissions'] ?></h2> |
645 | 645 | <script type="text/javascript">tp.addTabPage(document.getElementById("tabPermissions"));</script> |
646 | 646 | <div class="container container-body"> |
647 | - <?php if($use_udperms == 1) : ?> |
|
647 | + <?php if ($use_udperms == 1) : ?> |
|
648 | 648 | <?php |
649 | 649 | // fetch user access permissions for the module |
650 | 650 | $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
651 | 651 | $groupsarray = $modx->db->getColumn('usergroup', $rs); |
652 | 652 | |
653 | - if($modx->hasPermission('access_permissions')) { |
|
653 | + if ($modx->hasPermission('access_permissions')) { |
|
654 | 654 | ?> |
655 | 655 | <!-- User Group Access Permissions --> |
656 | 656 | <script type="text/javascript"> |
@@ -678,22 +678,22 @@ discard block |
||
678 | 678 | } |
679 | 679 | $chk = ''; |
680 | 680 | $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
681 | - while($row = $modx->db->getRow($rs)) { |
|
681 | + while ($row = $modx->db->getRow($rs)) { |
|
682 | 682 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
683 | 683 | $checked = in_array($row['id'], $groupsarray); |
684 | - if($modx->hasPermission('access_permissions')) { |
|
685 | - if($checked) { |
|
684 | + if ($modx->hasPermission('access_permissions')) { |
|
685 | + if ($checked) { |
|
686 | 686 | $notPublic = true; |
687 | 687 | } |
688 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
688 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="'.$row['id'].'"'.($checked ? ' checked="checked"' : '').' onclick="makePublic(false)" /> '.$row['name']."</label><br />\n"; |
|
689 | 689 | } else { |
690 | - if($checked) { |
|
691 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
690 | + if ($checked) { |
|
691 | + $chks = '<input type="hidden" name="usrgroups[]" value="'.$row['id'].'" />'."\n".$chks; |
|
692 | 692 | } |
693 | 693 | } |
694 | 694 | } |
695 | - if($modx->hasPermission('access_permissions')) { |
|
696 | - $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; |
|
695 | + if ($modx->hasPermission('access_permissions')) { |
|
696 | + $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; |
|
697 | 697 | } |
698 | 698 | echo $chks; |
699 | 699 | ?> |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | <?php |
715 | 715 | // invoke OnModFormRender event |
716 | 716 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
717 | - if(is_array($evtOut)) { |
|
717 | + if (is_array($evtOut)) { |
|
718 | 718 | echo implode('', $evtOut); |
719 | 719 | } |
720 | 720 | ?> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE != "true") { |
|
2 | +if (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_web_user')) { |
|
5 | +if (!$modx->hasPermission('edit_web_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $modx->manager->initPageViewState(); |
11 | 11 | |
12 | 12 | // get and save search string |
13 | -if($_REQUEST['op'] == 'reset') { |
|
13 | +if ($_REQUEST['op'] == 'reset') { |
|
14 | 14 | $query = ''; |
15 | 15 | $_PAGE['vs']['search'] = ''; |
16 | 16 | } else { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | // context menu |
28 | -include_once MODX_MANAGER_PATH . "includes/controls/contextmenu.php"; |
|
28 | +include_once MODX_MANAGER_PATH."includes/controls/contextmenu.php"; |
|
29 | 29 | $cm = new ContextMenu("cntxm", 150); |
30 | 30 | $cm->addItem($_lang["edit"], "js:menuAction(1)", $_style["actions_edit"], (!$modx->hasPermission('edit_user') ? 1 : 0)); |
31 | 31 | $cm->addItem($_lang["delete"], "js:menuAction(2)", $_style["actions_delete"], (!$modx->hasPermission('delete_user') ? 1 : 0)); |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | <div class="row"> |
121 | 121 | <div class="table-responsive"> |
122 | 122 | <?php |
123 | - $ds = $modx->db->select("wu.id, wu.username, wua.fullname, wua.email, ELT(wua.gender, '{$_lang['user_male']}', '{$_lang['user_female']}', '{$_lang['user_other']}') AS gender, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getFullTableName("web_users") . " wu |
|
124 | - INNER JOIN " . $modx->getFullTableName("web_user_attributes") . " wua ON wua.internalKey=wu.id", ($sqlQuery ? "(wu.username LIKE '{$sqlQuery}%') OR (wua.fullname LIKE '%{$sqlQuery}%') OR (wua.email LIKE '%{$sqlQuery}%')" : ""), 'username'); |
|
125 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
123 | + $ds = $modx->db->select("wu.id, wu.username, wua.fullname, wua.email, ELT(wua.gender, '{$_lang['user_male']}', '{$_lang['user_female']}', '{$_lang['user_other']}') AS gender, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getFullTableName("web_users")." wu |
|
124 | + INNER JOIN " . $modx->getFullTableName("web_user_attributes")." wua ON wua.internalKey=wu.id", ($sqlQuery ? "(wu.username LIKE '{$sqlQuery}%') OR (wua.fullname LIKE '%{$sqlQuery}%') OR (wua.email LIKE '%{$sqlQuery}%')" : ""), 'username'); |
|
125 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
126 | 126 | $grd = new DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items |
127 | 127 | $grd->noRecordMsg = $_lang["no_records_found"]; |
128 | 128 | $grd->cssClass = "table data"; |
@@ -130,14 +130,14 @@ discard block |
||
130 | 130 | $grd->itemClass = "tableItem"; |
131 | 131 | $grd->altItemClass = "tableAltItem"; |
132 | 132 | $grd->fields = "id,username,fullname,email,gender,blocked"; |
133 | - $grd->columns = $_lang["icon"] . " ," . $_lang["name"] . " ," . $_lang["user_full_name"] . " ," . $_lang["email"] . " ," . $_lang["user_gender"] . " ," . $_lang["user_block"]; |
|
133 | + $grd->columns = $_lang["icon"]." ,".$_lang["name"]." ,".$_lang["user_full_name"]." ,".$_lang["email"]." ,".$_lang["user_gender"]." ,".$_lang["user_block"]; |
|
134 | 134 | $grd->colWidths = "1%,,,,1%,1%"; |
135 | 135 | $grd->colAligns = "center,,,,center,right' nowrap='nowrap"; |
136 | - $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='" . $_style["icons_user"] . "'></i></a>||template:<a href='index.php?a=88&id=[+id+]' title='" . $_lang["click_to_edit_title"] . "'>[+value+]</a>"; |
|
137 | - if($listmode == '1') { |
|
136 | + $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='".$_lang["click_to_context"]."'><i class='".$_style["icons_user"]."'></i></a>||template:<a href='index.php?a=88&id=[+id+]' title='".$_lang["click_to_edit_title"]."'>[+value+]</a>"; |
|
137 | + if ($listmode == '1') { |
|
138 | 138 | $grd->pageSize = 0; |
139 | 139 | } |
140 | - if($_REQUEST['op'] == 'reset') { |
|
140 | + if ($_REQUEST['op'] == 'reset') { |
|
141 | 141 | $grd->pageNumber = 1; |
142 | 142 | } |
143 | 143 | // render grid |
@@ -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 | function bold($cond = false) |
62 | 62 | { |
@@ -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 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $option[] = '<option value="">No selected</option>'; |
44 | 44 | $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? intval($_REQUEST['templateid']) : ''; |
45 | 45 | $selected = $templateid === 0 ? ' selected="selected"' : ''; |
46 | - $option[] = '<option value="0"' . $selected . '>(blank)</option>'; |
|
46 | + $option[] = '<option value="0"'.$selected.'>(blank)</option>'; |
|
47 | 47 | while ($row = $modx->db->getRow($rs)) { |
48 | 48 | $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']); |
49 | 49 | $selected = $row['id'] == $templateid ? ' selected="selected"' : ''; |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | $friendly_url_suffix = $modx->config['friendly_url_suffix']; |
101 | 101 | $base_url = $modx->config['base_url']; |
102 | 102 | $site_url = $modx->config['site_url']; |
103 | - $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url); |
|
103 | + $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url); |
|
104 | 104 | if ($url[0] === '/') { |
105 | - $url = preg_replace('@^' . $base_url . '@', '', $url); |
|
105 | + $url = preg_replace('@^'.$base_url.'@', '', $url); |
|
106 | 106 | } |
107 | 107 | if (substr($url, 0, 4) === 'http') { |
108 | - $url = preg_replace('@^' . $site_url . '@', '', $url); |
|
108 | + $url = preg_replace('@^'.$site_url.'@', '', $url); |
|
109 | 109 | } |
110 | 110 | $idFromAlias = $modx->getIdFromAlias($url); |
111 | 111 | } |
@@ -118,18 +118,18 @@ discard block |
||
118 | 118 | $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
119 | 119 | $articul_result = $modx->db->query($articul_query); |
120 | 120 | $articul_id_array = $modx->db->makeArray($articul_result); |
121 | - if(count($articul_id_array)>0){ |
|
121 | + if (count($articul_id_array) > 0) { |
|
122 | 122 | $articul_id = ''; |
123 | 123 | $i = 1; |
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
124 | + foreach ($articul_id_array as $articul) { |
|
125 | + $articul_id .= $articul['contentid']; |
|
126 | + if ($i !== count($articul_id_array)) { |
|
127 | + $articul_id .= ','; |
|
128 | 128 | } |
129 | 129 | $i++; |
130 | 130 | } |
131 | 131 | $articul_id_query = " OR sc.id IN ({$articul_id})"; |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $articul_id_query = ''; |
134 | 134 | } |
135 | 135 | /*end search by TV*/ |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query; //search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'"; |
158 | 158 | $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'"; |
159 | 159 | $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'"; |
160 | - $sqladd .= $articul_id_query;//search by TV |
|
160 | + $sqladd .= $articul_id_query; //search by TV |
|
161 | 161 | } |
162 | 162 | } else if ($idFromAlias) { |
163 | 163 | $sqladd .= " sc.id='{$idFromAlias}'"; |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
181 | 181 | $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0; |
182 | 182 | $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : ''; |
183 | - $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess'; |
|
184 | - $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
183 | + $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess'; |
|
184 | + $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | if ($sqladd) { |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $where = $sqladd; |
192 | 192 | |
193 | 193 | if ($where) { |
194 | - $rs = $modx->db->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
194 | + $rs = $modx->db->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
195 | 195 | $limit = $modx->db->getRecordCount($rs); |
196 | 196 | } else { |
197 | 197 | $limit = 0; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if ($limit < 1) { |
211 | 211 | echo $_lang['search_empty']; |
212 | 212 | } else { |
213 | - printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit); |
|
213 | + printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit); |
|
214 | 214 | ?> |
215 | 215 | <script type="text/javascript" src="media/script/tablesort.js"></script> |
216 | 216 | <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1"> |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | if (function_exists('mb_strlen') && function_exists('mb_substr')) { |
271 | 271 | ?> |
272 | 272 | <td<?= $tdClass ?>> |
273 | - <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset) . "..." : $row['pagetitle'] ?></a> |
|
273 | + <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset)."..." : $row['pagetitle'] ?></a> |
|
274 | 274 | </td> |
275 | - <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset) . "..." : $row['description'] ?></td> |
|
275 | + <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset)."..." : $row['description'] ?></td> |
|
276 | 276 | <?php |
277 | 277 | } else { |
278 | 278 | ?> |
279 | - <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td> |
|
280 | - <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td> |
|
279 | + <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td> |
|
280 | + <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td> |
|
281 | 281 | <?php |
282 | 282 | } |
283 | 283 | ?> |
@@ -297,115 +297,115 @@ discard block |
||
297 | 297 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
298 | 298 | $docscounts = $modx->db->getRecordCount($rs); |
299 | 299 | if ($docscounts > 0) { |
300 | - $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>'; |
|
300 | + $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>'; |
|
301 | 301 | while ($row = $modx->db->getRow($rs)) { |
302 | - $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '><a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['pagetitle'] . ' <small>(' . $row['id'] . ')</small>', $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
302 | + $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'><a href="index.php?a=27&id='.$row['id'].'" id="content_'.$row['id'].'" target="main">'.highlightingCoincidence($row['pagetitle'].' <small>('.$row['id'].')</small>', $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | 307 | //templates |
308 | 308 | if ($modx->hasPermission('edit_template')) { |
309 | - $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' |
|
310 | - OR `templatename` like '%" . $searchfields . "%' |
|
311 | - OR `description` like '%" . $searchfields . "%' |
|
312 | - OR `content` like '%" . $searchfields . "%'"); |
|
309 | + $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' |
|
310 | + OR `templatename` like '%" . $searchfields."%' |
|
311 | + OR `description` like '%" . $searchfields."%' |
|
312 | + OR `content` like '%" . $searchfields."%'"); |
|
313 | 313 | $templatecounts = $modx->db->getRecordCount($rs); |
314 | 314 | if ($templatecounts > 0) { |
315 | - $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>'; |
|
315 | + $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>'; |
|
316 | 316 | while ($row = $modx->db->getRow($rs)) { |
317 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
317 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | 322 | //tvs |
323 | 323 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
324 | - $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%" . $searchfields . "%' |
|
325 | - OR `name` like '%" . $searchfields . "%' |
|
326 | - OR `description` like '%" . $searchfields . "%' |
|
327 | - OR `type` like '%" . $searchfields . "%' |
|
328 | - OR `elements` like '%" . $searchfields . "%' |
|
329 | - OR `display` like '%" . $searchfields . "%' |
|
330 | - OR `display_params` like '%" . $searchfields . "%' |
|
331 | - OR `default_text` like '%" . $searchfields . "%'"); |
|
324 | + $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%".$searchfields."%' |
|
325 | + OR `name` like '%" . $searchfields."%' |
|
326 | + OR `description` like '%" . $searchfields."%' |
|
327 | + OR `type` like '%" . $searchfields."%' |
|
328 | + OR `elements` like '%" . $searchfields."%' |
|
329 | + OR `display` like '%" . $searchfields."%' |
|
330 | + OR `display_params` like '%" . $searchfields."%' |
|
331 | + OR `default_text` like '%" . $searchfields."%'"); |
|
332 | 332 | $tvscounts = $modx->db->getRecordCount($rs); |
333 | 333 | if ($tvscounts > 0) { |
334 | - $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>'; |
|
334 | + $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>'; |
|
335 | 335 | while ($row = $modx->db->getRow($rs)) { |
336 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
336 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
341 | 341 | //Chunks |
342 | 342 | if ($modx->hasPermission('edit_chunk')) { |
343 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%" . $searchfields . "%' |
|
344 | - OR `name` like '%" . $searchfields . "%' |
|
345 | - OR `description` like '%" . $searchfields . "%' |
|
346 | - OR `snippet` like '%" . $searchfields . "%'"); |
|
343 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%".$searchfields."%' |
|
344 | + OR `name` like '%" . $searchfields."%' |
|
345 | + OR `description` like '%" . $searchfields."%' |
|
346 | + OR `snippet` like '%" . $searchfields."%'"); |
|
347 | 347 | $chunkscounts = $modx->db->getRecordCount($rs); |
348 | 348 | if ($chunkscounts > 0) { |
349 | - $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>'; |
|
349 | + $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>'; |
|
350 | 350 | while ($row = $modx->db->getRow($rs)) { |
351 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
351 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | 356 | //Snippets |
357 | 357 | if ($modx->hasPermission('edit_snippet')) { |
358 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%" . $searchfields . "%' |
|
359 | - OR `name` like '%" . $searchfields . "%' |
|
360 | - OR `description` like '%" . $searchfields . "%' |
|
361 | - OR `snippet` like '%" . $searchfields . "%' |
|
362 | - OR `properties` like '%" . $searchfields . "%' |
|
363 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
358 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%".$searchfields."%' |
|
359 | + OR `name` like '%" . $searchfields."%' |
|
360 | + OR `description` like '%" . $searchfields."%' |
|
361 | + OR `snippet` like '%" . $searchfields."%' |
|
362 | + OR `properties` like '%" . $searchfields."%' |
|
363 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
364 | 364 | $snippetscounts = $modx->db->getRecordCount($rs); |
365 | 365 | if ($snippetscounts > 0) { |
366 | - $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>'; |
|
366 | + $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>'; |
|
367 | 367 | while ($row = $modx->db->getRow($rs)) { |
368 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
368 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | 373 | //plugins |
374 | 374 | if ($modx->hasPermission('edit_plugin')) { |
375 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%" . $searchfields . "%' |
|
376 | - OR `name` like '%" . $searchfields . "%' |
|
377 | - OR `description` like '%" . $searchfields . "%' |
|
378 | - OR `plugincode` like '%" . $searchfields . "%' |
|
379 | - OR `properties` like '%" . $searchfields . "%' |
|
380 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
375 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%".$searchfields."%' |
|
376 | + OR `name` like '%" . $searchfields."%' |
|
377 | + OR `description` like '%" . $searchfields."%' |
|
378 | + OR `plugincode` like '%" . $searchfields."%' |
|
379 | + OR `properties` like '%" . $searchfields."%' |
|
380 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
381 | 381 | $pluginscounts = $modx->db->getRecordCount($rs); |
382 | 382 | if ($pluginscounts > 0) { |
383 | - $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>'; |
|
383 | + $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>'; |
|
384 | 384 | while ($row = $modx->db->getRow($rs)) { |
385 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
385 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
390 | 390 | //modules |
391 | 391 | if ($modx->hasPermission('edit_module')) { |
392 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%" . $searchfields . "%' |
|
393 | - OR `name` like '%" . $searchfields . "%' |
|
394 | - OR `description` like '%" . $searchfields . "%' |
|
395 | - OR `modulecode` like '%" . $searchfields . "%' |
|
396 | - OR `properties` like '%" . $searchfields . "%' |
|
397 | - OR `guid` like '%" . $searchfields . "%' |
|
398 | - OR `resourcefile` like '%" . $searchfields . "%'"); |
|
392 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%".$searchfields."%' |
|
393 | + OR `name` like '%" . $searchfields."%' |
|
394 | + OR `description` like '%" . $searchfields."%' |
|
395 | + OR `modulecode` like '%" . $searchfields."%' |
|
396 | + OR `properties` like '%" . $searchfields."%' |
|
397 | + OR `guid` like '%" . $searchfields."%' |
|
398 | + OR `resourcefile` like '%" . $searchfields."%'"); |
|
399 | 399 | $modulescounts = $modx->db->getRecordCount($rs); |
400 | 400 | if ($modulescounts > 0) { |
401 | - $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>'; |
|
401 | + $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>'; |
|
402 | 402 | while ($row = $modx->db->getRow($rs)) { |
403 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
403 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
408 | - echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1'; |
|
408 | + echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1'; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | ?> |
@@ -416,13 +416,13 @@ discard block |
||
416 | 416 | |
417 | 417 | function highlightingCoincidence($text, $search) |
418 | 418 | { |
419 | - $regexp = '!(' . str_replace(array( |
|
419 | + $regexp = '!('.str_replace(array( |
|
420 | 420 | '(', |
421 | 421 | ')' |
422 | 422 | ), array( |
423 | 423 | '\(', |
424 | 424 | '\)' |
425 | - ), trim($search)) . ')!isu'; |
|
425 | + ), trim($search)).')!isu'; |
|
426 | 426 | return preg_replace($regexp, '<span class="text-danger">$1</span>', $text); |
427 | 427 | } |
428 | 428 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $class .= ' deleted'; |
440 | 440 | } |
441 | 441 | if ($class) { |
442 | - $class = ' class="' . trim($class) . '"'; |
|
442 | + $class = ' class="'.trim($class).'"'; |
|
443 | 443 | } |
444 | 444 | return $class; |
445 | 445 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | $updateMsg = ''; |
12 | 12 | |
13 | 13 | if (isset($_POST['listSubmitted'])) { |
14 | - $updateMsg .= '<span class="text-success" id="updated">' . $_lang['sort_updated'] . '</span>'; |
|
14 | + $updateMsg .= '<span class="text-success" id="updated">'.$_lang['sort_updated'].'</span>'; |
|
15 | 15 | $tbl = $modx->getFullTableName('site_plugin_events'); |
16 | 16 | |
17 | 17 | foreach ($_POST as $listName => $listValue) { |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | $modx->clearCache('full'); |
35 | 35 | } |
36 | 36 | |
37 | -$rs = $modx->db->select("sysevt.name as evtname, sysevt.id as evtid, pe.pluginid, plugs.name, pe.priority, plugs.disabled", $modx->getFullTableName('system_eventnames') . " sysevt |
|
38 | - INNER JOIN " . $modx->getFullTableName('site_plugin_events') . " pe ON pe.evtid = sysevt.id |
|
39 | - INNER JOIN " . $modx->getFullTableName('site_plugins') . " plugs ON plugs.id = pe.pluginid", '', 'sysevt.name,pe.priority'); |
|
37 | +$rs = $modx->db->select("sysevt.name as evtname, sysevt.id as evtid, pe.pluginid, plugs.name, pe.priority, plugs.disabled", $modx->getFullTableName('system_eventnames')." sysevt |
|
38 | + INNER JOIN " . $modx->getFullTableName('site_plugin_events')." pe ON pe.evtid = sysevt.id |
|
39 | + INNER JOIN " . $modx->getFullTableName('site_plugins')." plugs ON plugs.id = pe.pluginid", '', 'sysevt.name,pe.priority'); |
|
40 | 40 | |
41 | 41 | $insideUl = 0; |
42 | 42 | $preEvt = ''; |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | if ($preEvt !== $plugins['evtid']) { |
48 | 48 | $sortables[] = $plugins['evtid']; |
49 | 49 | $sortableList .= $insideUl ? '</ul></div>' : ''; |
50 | - $sortableList .= '<div class="form-group clearfix"><strong>' . $plugins['evtname'] . '</strong><ul id="' . $plugins['evtid'] . '" class="sortableList">'; |
|
50 | + $sortableList .= '<div class="form-group clearfix"><strong>'.$plugins['evtname'].'</strong><ul id="'.$plugins['evtid'].'" class="sortableList">'; |
|
51 | 51 | $insideUl = 1; |
52 | 52 | } |
53 | - $sortableList .= '<li id="item_' . $plugins['pluginid'] . '"' . ($plugins['disabled'] ? ' class="disabledPlugin"' : '') . '><i class="fa fa-plug"></i> ' . $plugins['name'] . ($plugins['disabled'] ? ' (hide)' : '') . '</li>'; |
|
53 | + $sortableList .= '<li id="item_'.$plugins['pluginid'].'"'.($plugins['disabled'] ? ' class="disabledPlugin"' : '').'><i class="fa fa-plug"></i> '.$plugins['name'].($plugins['disabled'] ? ' (hide)' : '').'</li>'; |
|
54 | 54 | $preEvt = $plugins['evtid']; |
55 | 55 | } |
56 | 56 | if ($insideUl) { |
57 | 57 | $sortableList .= '</ul></div>'; |
58 | 58 | } |
59 | 59 | |
60 | -require_once(MODX_MANAGER_PATH . 'includes/header.inc.php'); |
|
60 | +require_once(MODX_MANAGER_PATH.'includes/header.inc.php'); |
|
61 | 61 | ?> |
62 | 62 | |
63 | 63 | <script type="text/javascript"> |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Class for MODx Categories Manager |
4 | 4 | */ |
5 | -if( !is_object( $modx ) |
|
6 | - || $modx->isBackend() === false ) |
|
5 | +if (!is_object($modx) |
|
6 | + || $modx->isBackend() === false) |
|
7 | 7 | { |
8 | 8 | die('Please use the MODx Backend.'); |
9 | 9 | } |
10 | 10 | |
11 | -require_once realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'Categories.php'; |
|
11 | +require_once realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Categories.php'; |
|
12 | 12 | |
13 | 13 | class Module_Categories_Manager extends Categories |
14 | 14 | { |
@@ -37,19 +37,19 @@ discard block |
||
37 | 37 | * @return mixed return the parameter value if exists, otherwise false |
38 | 38 | * @param string $key Paramter-key |
39 | 39 | */ |
40 | - function get( $key ) |
|
40 | + function get($key) |
|
41 | 41 | { |
42 | 42 | global $modx; |
43 | 43 | |
44 | - if( isset( $this->params[$key] ) ) |
|
44 | + if (isset($this->params[$key])) |
|
45 | 45 | { |
46 | 46 | return $this->params[$key]; |
47 | 47 | } |
48 | - elseif( isset( $modx->config[$key] ) ) |
|
48 | + elseif (isset($modx->config[$key])) |
|
49 | 49 | { |
50 | 50 | return $modx->config[$key]; |
51 | 51 | } |
52 | - elseif( isset( $modx->event->params[$key] ) ) |
|
52 | + elseif (isset($modx->event->params[$key])) |
|
53 | 53 | { |
54 | 54 | return $modx->event->params[$key]; |
55 | 55 | } |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | - function addMessage( $message, $namespace = 'default' ) |
|
60 | + function addMessage($message, $namespace = 'default') |
|
61 | 61 | { |
62 | 62 | $this->params['messages'][$namespace][] = $message; |
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | - function getMessages( $namespace = 'default' ) |
|
66 | + function getMessages($namespace = 'default') |
|
67 | 67 | { |
68 | - if( isset( $this->params['messages'][$namespace] ) ) |
|
68 | + if (isset($this->params['messages'][$namespace])) |
|
69 | 69 | { |
70 | 70 | return $this->params['messages'][$namespace]; |
71 | 71 | } |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | - function renderView( $view_name, $data = array() ) |
|
76 | + function renderView($view_name, $data = array()) |
|
77 | 77 | { |
78 | 78 | global $_lang, $_style; |
79 | 79 | |
80 | - $filename = trim( $view_name ) . '.tpl.phtml'; |
|
81 | - $file = self::get('views_dir') . $filename; |
|
80 | + $filename = trim($view_name).'.tpl.phtml'; |
|
81 | + $file = self::get('views_dir').$filename; |
|
82 | 82 | $view = & $this; |
83 | 83 | |
84 | - if( is_file( $file ) |
|
85 | - && is_readable( $file ) ) |
|
84 | + if (is_file($file) |
|
85 | + && is_readable($file)) |
|
86 | 86 | { |
87 | 87 | include $file; |
88 | 88 | } |
@@ -96,21 +96,21 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - function updateElement( $element, $element_id, $category_id ) |
|
99 | + function updateElement($element, $element_id, $category_id) |
|
100 | 100 | { |
101 | 101 | |
102 | 102 | $_update = array( |
103 | - 'id' => (int)$element_id, |
|
104 | - 'category' => (int)$category_id |
|
103 | + 'id' => (int) $element_id, |
|
104 | + 'category' => (int) $category_id |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | $this->db->update( |
108 | 108 | $_update, |
109 | 109 | $this->db_tbl[$element], |
110 | - "`id` = '" . (int)$element_id . "'" |
|
110 | + "`id` = '".(int) $element_id."'" |
|
111 | 111 | ); |
112 | 112 | |
113 | - if( $this->db->getAffectedRows() === 1 ) |
|
113 | + if ($this->db->getAffectedRows() === 1) |
|
114 | 114 | { |
115 | 115 | return true; |
116 | 116 | } |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | |
121 | - function txt( $txt ) |
|
121 | + function txt($txt) |
|
122 | 122 | { |
123 | 123 | global $_lang; |
124 | - if(isset($_lang[$txt])) return $_lang[$txt]; |
|
124 | + if (isset($_lang[$txt])) return $_lang[$txt]; |
|
125 | 125 | return $txt; |
126 | 126 | } |
127 | 127 | } |
128 | 128 | \ No newline at end of file |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | { |
7 | 7 | var $db = ''; |
8 | 8 | var $db_tbl = array(); |
9 | - var $elements = array( 'templates', 'tmplvars', 'htmlsnippets', 'snippets', 'plugins', 'modules' ); |
|
9 | + var $elements = array('templates', 'tmplvars', 'htmlsnippets', 'snippets', 'plugins', 'modules'); |
|
10 | 10 | |
11 | 11 | function __construct() |
12 | 12 | { |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $this->db = & $modx->db; |
16 | 16 | $this->db_tbl['categories'] = $modx->getFullTableName('categories'); |
17 | 17 | |
18 | - foreach( $this->elements as $element ) |
|
18 | + foreach ($this->elements as $element) |
|
19 | 19 | { |
20 | - $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element ); |
|
20 | + $this->db_tbl[$element] = $modx->getFullTableName('site_'.$element); |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
@@ -37,44 +37,44 @@ discard block |
||
37 | 37 | ) |
38 | 38 | ); |
39 | 39 | |
40 | - if( !empty( $categories ) ) |
|
40 | + if (!empty($categories)) |
|
41 | 41 | { |
42 | 42 | return $categories; |
43 | 43 | } |
44 | 44 | return false; |
45 | 45 | } |
46 | 46 | |
47 | - function getCategory( $search, $where = 'category' ) |
|
47 | + function getCategory($search, $where = 'category') |
|
48 | 48 | { |
49 | 49 | $category = $this->db->getRow( |
50 | 50 | $this->db->select( |
51 | 51 | '*', |
52 | 52 | $this->db_tbl['categories'], |
53 | - "`" . $where . "` = '" . $search . "'" |
|
53 | + "`".$where."` = '".$search."'" |
|
54 | 54 | ) |
55 | 55 | ); |
56 | 56 | return $category; |
57 | 57 | } |
58 | 58 | |
59 | - function getCategoryValue( $value, $search, $where = 'category' ) |
|
59 | + function getCategoryValue($value, $search, $where = 'category') |
|
60 | 60 | { |
61 | 61 | $_value = $this->db->getValue( |
62 | 62 | $this->db->select( |
63 | - '`' . $value . '`', |
|
63 | + '`'.$value.'`', |
|
64 | 64 | $this->db_tbl['categories'], |
65 | - "`" . $where . "` = '" . $search . "'" |
|
65 | + "`".$where."` = '".$search."'" |
|
66 | 66 | ) |
67 | 67 | ); |
68 | 68 | return $_value; |
69 | 69 | } |
70 | 70 | |
71 | - function getAssignedElements( $category_id, $element ) |
|
71 | + function getAssignedElements($category_id, $element) |
|
72 | 72 | { |
73 | - if( in_array( $element, $this->elements, true ) ) |
|
73 | + if (in_array($element, $this->elements, true)) |
|
74 | 74 | { |
75 | 75 | |
76 | 76 | $fields = '`name`,`description`'; |
77 | - if( $element === 'templates' ) |
|
77 | + if ($element === 'templates') |
|
78 | 78 | { |
79 | 79 | $fields = '`templatename`,`description`'; |
80 | 80 | } |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | $this->db->select( |
86 | 86 | $fields, |
87 | 87 | $this->db_tbl[$element], |
88 | - "`category` = '" . $category_id . "'" |
|
88 | + "`category` = '".$category_id."'" |
|
89 | 89 | ) |
90 | 90 | ); |
91 | 91 | |
92 | 92 | // correct the name of templates |
93 | - if( $element === 'templates' ) |
|
93 | + if ($element === 'templates') |
|
94 | 94 | { |
95 | 95 | $_elements_count = count($elements); |
96 | - for( $i=0; $i < $_elements_count; $i++ ) |
|
96 | + for ($i = 0; $i < $_elements_count; $i++) |
|
97 | 97 | { |
98 | 98 | $elements[$i]['name'] = $elements[$i]['templatename']; |
99 | 99 | } |
@@ -103,60 +103,60 @@ discard block |
||
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | |
106 | - function getAllAssignedElements( $category_id ) |
|
106 | + function getAllAssignedElements($category_id) |
|
107 | 107 | { |
108 | 108 | $elements = array(); |
109 | - foreach( $this->elements as $element ) |
|
109 | + foreach ($this->elements as $element) |
|
110 | 110 | { |
111 | - $elements[$element] = $this->getAssignedElements( $category_id, $element ); |
|
111 | + $elements[$element] = $this->getAssignedElements($category_id, $element); |
|
112 | 112 | } |
113 | 113 | return $elements; |
114 | 114 | } |
115 | 115 | |
116 | - function deleteCategory( $category_id ) |
|
116 | + function deleteCategory($category_id) |
|
117 | 117 | { |
118 | 118 | $_update = array('category' => 0); |
119 | - foreach( $this->elements as $element ) |
|
119 | + foreach ($this->elements as $element) |
|
120 | 120 | { |
121 | 121 | $this->db->update( |
122 | 122 | $_update, |
123 | 123 | $this->db_tbl[$element], |
124 | - "`category` = '" . $category_id . "'" |
|
124 | + "`category` = '".$category_id."'" |
|
125 | 125 | ); |
126 | 126 | } |
127 | 127 | |
128 | 128 | $this->db->delete( |
129 | 129 | $this->db_tbl['categories'], |
130 | - "`id` = '" . $category_id . "'" |
|
130 | + "`id` = '".$category_id."'" |
|
131 | 131 | ); |
132 | 132 | |
133 | - if( $this->db->getAffectedRows() === 1 ) |
|
133 | + if ($this->db->getAffectedRows() === 1) |
|
134 | 134 | { |
135 | 135 | return true; |
136 | 136 | } |
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | |
140 | - function updateCategory( $category_id, $data = array() ) |
|
140 | + function updateCategory($category_id, $data = array()) |
|
141 | 141 | { |
142 | - if( empty( $data ) |
|
143 | - || empty( $category_id ) ) |
|
142 | + if (empty($data) |
|
143 | + || empty($category_id)) |
|
144 | 144 | { |
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | |
148 | 148 | $_update = array( |
149 | - 'category' => $this->db->escape( $data['category'] ), |
|
150 | - 'rank' => (int)$data['rank'] |
|
149 | + 'category' => $this->db->escape($data['category']), |
|
150 | + 'rank' => (int) $data['rank'] |
|
151 | 151 | ); |
152 | 152 | |
153 | 153 | $this->db->update( |
154 | 154 | $_update, |
155 | 155 | $this->db_tbl['categories'], |
156 | - "`id` = '" . (int)$category_id . "'" |
|
156 | + "`id` = '".(int) $category_id."'" |
|
157 | 157 | ); |
158 | 158 | |
159 | - if( $this->db->getAffectedRows() === 1 ) |
|
159 | + if ($this->db->getAffectedRows() === 1) |
|
160 | 160 | { |
161 | 161 | return true; |
162 | 162 | } |
@@ -164,16 +164,16 @@ discard block |
||
164 | 164 | return false; |
165 | 165 | } |
166 | 166 | |
167 | - function addCategory( $category_name, $category_rank ) |
|
167 | + function addCategory($category_name, $category_rank) |
|
168 | 168 | { |
169 | - if( $this->isCategoryExists( $category_name ) ) |
|
169 | + if ($this->isCategoryExists($category_name)) |
|
170 | 170 | { |
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | |
174 | 174 | $_insert = array( |
175 | - 'category' => $this->db->escape( $category_name ), |
|
176 | - 'rank' => (int)$category_rank |
|
175 | + 'category' => $this->db->escape($category_name), |
|
176 | + 'rank' => (int) $category_rank |
|
177 | 177 | ); |
178 | 178 | |
179 | 179 | $this->db->insert( |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $this->db_tbl['categories'] |
182 | 182 | ); |
183 | 183 | |
184 | - if( $this->db->getAffectedRows() === 1 ) |
|
184 | + if ($this->db->getAffectedRows() === 1) |
|
185 | 185 | { |
186 | 186 | return $this->db->getInsertId(); |
187 | 187 | } |
@@ -190,19 +190,19 @@ discard block |
||
190 | 190 | return false; |
191 | 191 | } |
192 | 192 | |
193 | - function isCategoryExists( $category_name ) |
|
193 | + function isCategoryExists($category_name) |
|
194 | 194 | { |
195 | - $category = $this->db->escape( $category_name ); |
|
195 | + $category = $this->db->escape($category_name); |
|
196 | 196 | |
197 | 197 | $category_id = $this->db->getValue( |
198 | 198 | $this->db->select( |
199 | 199 | '`id`', |
200 | 200 | $this->db_tbl['categories'], |
201 | - "`category` = '" . $category . "'" |
|
201 | + "`category` = '".$category."'" |
|
202 | 202 | ) |
203 | 203 | ); |
204 | 204 | |
205 | - if( $this->db->getAffectedRows() === 1 ) |
|
205 | + if ($this->db->getAffectedRows() === 1) |
|
206 | 206 | { |
207 | 207 | return $category_id; |
208 | 208 | } |
@@ -2,16 +2,16 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Ajax Requests |
4 | 4 | */ |
5 | -if(IN_MANAGER_MODE != "true") { |
|
5 | +if (IN_MANAGER_MODE != "true") { |
|
6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
7 | 7 | } |
8 | 8 | |
9 | -if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) |
|
9 | +if (isset($_REQUEST[$cm->get('request_key')]['ajax'])) |
|
10 | 10 | { |
11 | 11 | $_data = $_REQUEST[$cm->get('request_key')]; |
12 | 12 | $output = ''; |
13 | 13 | $task = $_data['task']; |
14 | - switch( $task ) |
|
14 | + switch ($task) |
|
15 | 15 | { |
16 | 16 | /** |
17 | 17 | * get categories |
@@ -19,19 +19,19 @@ discard block |
||
19 | 19 | case 'categorize_load_elements': |
20 | 20 | $elements = $_data['elements']; |
21 | 21 | |
22 | - if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
|
22 | + if ($uncategorized_elements = $cm->getAssignedElements(0, $_data['elements'])) |
|
23 | 23 | { |
24 | 24 | $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
25 | 25 | } |
26 | 26 | |
27 | - foreach( $cm->getCategories() as $category ) |
|
27 | + foreach ($cm->getCategories() as $category) |
|
28 | 28 | { |
29 | - $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] ); |
|
29 | + $category['elements'] = $cm->getAssignedElements($category['id'], $_data['elements']); |
|
30 | 30 | $output .= $cm->renderView('chunks/categorize/category', $category); |
31 | 31 | } |
32 | 32 | break; |
33 | 33 | } |
34 | - exit( $output ); |
|
34 | + exit($output); |
|
35 | 35 | } |
36 | 36 | /** |
37 | 37 | * Categorize elements |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476 |
42 | 42 | * |
43 | 43 | */ |
44 | -if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) |
|
44 | +if (isset($_POST[$cm->get('request_key')]['categorize']['submit'])) |
|
45 | 45 | { |
46 | 46 | $_data = $_POST[$cm->get('request_key')]['categorize']; |
47 | 47 | $_changes = 0; |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | 'categorize' |
55 | 55 | ); |
56 | 56 | |
57 | - if( !isset( $_data['elements'] ) ) |
|
57 | + if (!isset($_data['elements'])) |
|
58 | 58 | { |
59 | - $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' ); |
|
59 | + $cm->addMessage($cm->txt('cm_unknown_error'), 'categorize'); |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | - foreach( $_data['elements'] as $element_id => $data ) |
|
63 | + foreach ($_data['elements'] as $element_id => $data) |
|
64 | 64 | { |
65 | - if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) |
|
65 | + if ($cm->updateElement($_data['elementsgroup'], $element_id, $data['category_id'])) |
|
66 | 66 | { |
67 | 67 | $cm->addMessage( |
68 | 68 | sprintf( |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - if( $_changes === 0 ) |
|
81 | + if ($_changes === 0) |
|
82 | 82 | { |
83 | - $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' ); |
|
83 | + $cm->addMessage($cm->txt('cm_no_categorization'), 'categorize'); |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | else |
@@ -98,29 +98,29 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Add a new category |
100 | 100 | */ |
101 | -if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) |
|
101 | +if (isset($_POST[$cm->get('request_key')]['add']['submit'])) |
|
102 | 102 | { |
103 | 103 | $_data = $_POST[$cm->get('request_key')]['add']['data']; |
104 | - $category = trim( html_entity_decode($_data['name']) ); |
|
104 | + $category = trim(html_entity_decode($_data['name'])); |
|
105 | 105 | $rank = (int) $_data['rank']; |
106 | 106 | |
107 | - if( empty( $category ) ) |
|
107 | + if (empty($category)) |
|
108 | 108 | { |
109 | - $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
109 | + $cm->addMessage($cm->txt('cm_enter_name_for_category'), 'add'); |
|
110 | 110 | return; |
111 | 111 | } |
112 | 112 | |
113 | - if( $cm->isCategoryExists( $category ) ) |
|
113 | + if ($cm->isCategoryExists($category)) |
|
114 | 114 | { |
115 | - $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
115 | + $cm->addMessage(sprintf($cm->txt('cm_category_x_exists'), $category), 'add'); |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | |
119 | - if( $cm->addCategory( $category, $rank ) !== 0 ) |
|
119 | + if ($cm->addCategory($category, $rank) !== 0) |
|
120 | 120 | { |
121 | 121 | $cm->addMessage( |
122 | 122 | sprintf( |
123 | - $cm->txt( 'cm_category_x_saved_at_position_y' ), |
|
123 | + $cm->txt('cm_category_x_saved_at_position_y'), |
|
124 | 124 | $category, |
125 | 125 | $rank |
126 | 126 | ), |
@@ -129,26 +129,26 @@ discard block |
||
129 | 129 | } |
130 | 130 | else |
131 | 131 | { |
132 | - $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' ); |
|
132 | + $cm->addMessage($cm->txt('cm_unknown_error'), 'add'); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Sort categories |
138 | 138 | */ |
139 | -if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) |
|
139 | +if (isset($_POST[$cm->get('request_key')]['sort']['submit'])) |
|
140 | 140 | { |
141 | 141 | $categories = $_POST[$cm->get('request_key')]['sort']['data']; |
142 | 142 | $_changes = 0; |
143 | 143 | |
144 | - foreach( $categories as $category_id => $_data ) |
|
144 | + foreach ($categories as $category_id => $_data) |
|
145 | 145 | { |
146 | 146 | $data = array( |
147 | - 'category' => urldecode( $_data['category'] ), |
|
147 | + 'category' => urldecode($_data['category']), |
|
148 | 148 | 'rank' => $_data['rank'] |
149 | 149 | ); |
150 | 150 | |
151 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
151 | + if ($cm->updateCategory($category_id, $data)) |
|
152 | 152 | { |
153 | 153 | $cm->addMessage( |
154 | 154 | sprintf( |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - if( $_changes === 0 ) |
|
165 | + if ($_changes === 0) |
|
166 | 166 | { |
167 | - $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort'); |
|
167 | + $cm->addMessage($cm->txt('cm_no_changes'), 'sort'); |
|
168 | 168 | } |
169 | 169 | else |
170 | 170 | { |
@@ -181,21 +181,21 @@ discard block |
||
181 | 181 | /** |
182 | 182 | * Edit categories |
183 | 183 | */ |
184 | -if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) |
|
184 | +if (isset($_POST[$cm->get('request_key')]['edit']['submit'])) |
|
185 | 185 | { |
186 | 186 | $categories = $_POST[$cm->get('request_key')]['edit']['data']; |
187 | 187 | $_changes = 0; |
188 | 188 | |
189 | - foreach( $categories as $category_id => $_data ) |
|
189 | + foreach ($categories as $category_id => $_data) |
|
190 | 190 | { |
191 | - if( isset( $_data['delete'] ) ) |
|
191 | + if (isset($_data['delete'])) |
|
192 | 192 | { |
193 | - if( $cm->deleteCategory( $category_id ) ) |
|
193 | + if ($cm->deleteCategory($category_id)) |
|
194 | 194 | { |
195 | 195 | $cm->addMessage( |
196 | 196 | sprintf( |
197 | 197 | $cm->txt('cm_category_x_deleted'), |
198 | - urldecode( $_data['origin'] ) |
|
198 | + urldecode($_data['origin']) |
|
199 | 199 | ), |
200 | 200 | 'edit' |
201 | 201 | ); |
@@ -205,16 +205,16 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | $data = array( |
208 | - 'category' => trim( html_entity_decode( $_data['category'] ) ), |
|
208 | + 'category' => trim(html_entity_decode($_data['category'])), |
|
209 | 209 | 'rank' => $_data['rank'] |
210 | 210 | ); |
211 | 211 | |
212 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
212 | + if ($cm->updateCategory($category_id, $data)) |
|
213 | 213 | { |
214 | 214 | $cm->addMessage( |
215 | 215 | sprintf( |
216 | 216 | $cm->txt('cm_category_x_renamed_to_y'), |
217 | - urldecode( $_data['origin'] ), |
|
217 | + urldecode($_data['origin']), |
|
218 | 218 | $data['category'] |
219 | 219 | ), |
220 | 220 | 'edit' |
@@ -223,26 +223,26 @@ discard block |
||
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | - if( $_changes === 0 ) |
|
226 | + if ($_changes === 0) |
|
227 | 227 | { |
228 | - $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit'); |
|
228 | + $cm->addMessage($cm->txt('cm_no_changes'), 'edit'); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Delete singel category by $_GET |
234 | 234 | */ |
235 | -if( isset( $_GET[$cm->get('request_key')]['delete'] ) |
|
236 | - && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) |
|
235 | +if (isset($_GET[$cm->get('request_key')]['delete']) |
|
236 | + && !empty($_GET[$cm->get('request_key')]['delete'])) |
|
237 | 237 | { |
238 | - $category_id = (int)$_GET[$cm->get('request_key')]['delete']; |
|
238 | + $category_id = (int) $_GET[$cm->get('request_key')]['delete']; |
|
239 | 239 | |
240 | - if( $cm->deleteCategory( $category_id ) ) |
|
240 | + if ($cm->deleteCategory($category_id)) |
|
241 | 241 | { |
242 | 242 | $cm->addMessage( |
243 | 243 | sprintf( |
244 | 244 | $cm->txt('cm_category_x_deleted'), |
245 | - urldecode( $_GET[$cm->get('request_key')]['category'] ) |
|
245 | + urldecode($_GET[$cm->get('request_key')]['category']) |
|
246 | 246 | ), |
247 | 247 | 'edit' |
248 | 248 | ); |
@@ -251,15 +251,15 @@ discard block |
||
251 | 251 | /** |
252 | 252 | * Translate phrases |
253 | 253 | */ |
254 | -if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) |
|
254 | +if (isset($_POST[$cm->get('request_key')]['translate']['submit'])) |
|
255 | 255 | { |
256 | 256 | $translations = $_POST[$cm->get('request_key')]['translate']['data']; |
257 | 257 | |
258 | - foreach( $translations as $native_phrase => $translation ) |
|
258 | + foreach ($translations as $native_phrase => $translation) |
|
259 | 259 | { |
260 | - $native_phrase = urldecode( $native_phrase ); |
|
260 | + $native_phrase = urldecode($native_phrase); |
|
261 | 261 | |
262 | - if( empty( $translation ) ) |
|
262 | + if (empty($translation)) |
|
263 | 263 | { |
264 | 264 | $translation = $native_phrase; |
265 | 265 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | //$cm->c('Translator')->setType('phrase'); |
276 | - $cm->c('Translator')->addTranslation( $native_phrase, $translation, 'phrase' ); |
|
276 | + $cm->c('Translator')->addTranslation($native_phrase, $translation, 'phrase'); |
|
277 | 277 | |
278 | 278 | $cm->addMessage( |
279 | 279 | sprintf( |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | ); |
286 | 286 | } |
287 | 287 | |
288 | - if( empty( $cm->new_translations ) ) |
|
288 | + if (empty($cm->new_translations)) |
|
289 | 289 | { |
290 | 290 | //$_REQUEST['webfxtab_manage-categories-pane'] = 0; |
291 | 291 | // unset( $_COOKIE['webfxtab_manage-categories-pane'] ); |