@@ -1,5 +1,5 @@ |
||
| 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 | ?> |
@@ -1,5 +1,5 @@ |
||
| 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 | ?> |
@@ -1,5 +1,5 @@ |
||
| 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 | ?> |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <!-- Template variables --> |
| 2 | 2 | <?php |
| 3 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 4 | 4 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <!-- chunks --> |
| 2 | 2 | <?php |
| 3 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 4 | 4 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -1,5 +1,5 @@ |
||
| 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 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <!-- snippets --> |
| 2 | 2 | <?php |
| 3 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 4 | 4 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -1,239 +1,239 @@ |
||
| 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 | $tpl = array( |
| 7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
| 8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
| 7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
| 8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
| 12 | 12 | ); |
| 13 | 13 | |
| 14 | 14 | function parsePh($tpl, $ph) {
|
| 15 | - global $modx, $_lang; |
|
| 16 | - $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
| 17 | - return $modx->parseText($tpl, $ph); |
|
| 15 | + global $modx, $_lang; |
|
| 16 | + $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
| 17 | + return $modx->parseText($tpl, $ph); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | function renderViewSwitchButtons($cssId) {
|
| 21 | - global $modx, $_lang, $tpl; |
|
| 21 | + global $modx, $_lang, $tpl; |
|
| 22 | 22 | |
| 23 | - return parsePh($tpl['viewForm'], array( |
|
| 24 | - 'cssId' => $cssId |
|
| 25 | - )); |
|
| 23 | + return parsePh($tpl['viewForm'], array( |
|
| 24 | + 'cssId' => $cssId |
|
| 25 | + )); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | function createResourceList($resourceTable, $resources) {
|
| 29 | - global $modx, $_lang, $_style, $modx_textdir, $tpl; |
|
| 30 | - |
|
| 31 | - $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
| 32 | - |
|
| 33 | - if( ! is_array($items) || empty($items)) {
|
|
| 34 | - return $_lang['no_results']; |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - // Prepare elements- and categories-list |
|
| 38 | - $elements = array(); |
|
| 39 | - $categories = array(); |
|
| 40 | - foreach($items as $row) {
|
|
| 41 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 42 | - $categories[$catid] = array('name' => stripslashes($row['category']));
|
|
| 43 | - $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - // Now render categories / panel-collapse |
|
| 47 | - $panelGroup = ''; |
|
| 48 | - foreach($elements as $catid => $elList) {
|
|
| 49 | - // Add panel-heading / category-collapse to output |
|
| 50 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 51 | - 'tab' => $resourceTable, |
|
| 52 | - 'category' => $categories[$catid]['name'], |
|
| 53 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 54 | - 'catid' => $catid, |
|
| 55 | - )); |
|
| 56 | - |
|
| 57 | - // Prepare content for panel-collapse |
|
| 58 | - $panelCollapse = ''; |
|
| 59 | - foreach($elList as $el) {
|
|
| 60 | - $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - // Add panel-collapse with elements to output |
|
| 64 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 65 | - 'tab' => $resourceTable, |
|
| 66 | - 'catid' => $catid, |
|
| 67 | - 'wrapper' => $panelCollapse, |
|
| 68 | - )); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - return parsePh($tpl['panelGroup'], array( |
|
| 72 | - 'resourceTable' => $resourceTable, |
|
| 73 | - 'wrapper' => $panelGroup |
|
| 74 | - )); |
|
| 29 | + global $modx, $_lang, $_style, $modx_textdir, $tpl; |
|
| 30 | + |
|
| 31 | + $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
| 32 | + |
|
| 33 | + if( ! is_array($items) || empty($items)) {
|
|
| 34 | + return $_lang['no_results']; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + // Prepare elements- and categories-list |
|
| 38 | + $elements = array(); |
|
| 39 | + $categories = array(); |
|
| 40 | + foreach($items as $row) {
|
|
| 41 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 42 | + $categories[$catid] = array('name' => stripslashes($row['category']));
|
|
| 43 | + $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + // Now render categories / panel-collapse |
|
| 47 | + $panelGroup = ''; |
|
| 48 | + foreach($elements as $catid => $elList) {
|
|
| 49 | + // Add panel-heading / category-collapse to output |
|
| 50 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 51 | + 'tab' => $resourceTable, |
|
| 52 | + 'category' => $categories[$catid]['name'], |
|
| 53 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 54 | + 'catid' => $catid, |
|
| 55 | + )); |
|
| 56 | + |
|
| 57 | + // Prepare content for panel-collapse |
|
| 58 | + $panelCollapse = ''; |
|
| 59 | + foreach($elList as $el) {
|
|
| 60 | + $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + // Add panel-collapse with elements to output |
|
| 64 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 65 | + 'tab' => $resourceTable, |
|
| 66 | + 'catid' => $catid, |
|
| 67 | + 'wrapper' => $panelCollapse, |
|
| 68 | + )); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + return parsePh($tpl['panelGroup'], array( |
|
| 72 | + 'resourceTable' => $resourceTable, |
|
| 73 | + 'wrapper' => $panelGroup |
|
| 74 | + )); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | function createCombinedView($resources) {
|
| 78 | - global $modx, $_lang, $_style, $modx_textdir; |
|
| 79 | - |
|
| 80 | - $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
| 81 | - $types = isset($resources->types) ? $resources->types : false; |
|
| 82 | - $categories = isset($resources->categories) ? $resources->categories : false; |
|
| 83 | - |
|
| 84 | - if(!$itemsPerCategory) {
|
|
| 85 | - return $_lang['no_results']; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - $tpl = array( |
|
| 89 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 90 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 91 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 92 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
| 93 | - ); |
|
| 94 | - |
|
| 95 | - // Easily loop through $itemsPerCategory-Array |
|
| 96 | - $panelGroup = ''; |
|
| 97 | - foreach($categories as $catid => $category) {
|
|
| 98 | - // Prepare collapse content / elements-list |
|
| 99 | - $panelCollapse = ''; |
|
| 100 | - foreach($itemsPerCategory[$catid] as $el) {
|
|
| 101 | - $resourceTable = $el['type']; |
|
| 102 | - $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
| 103 | - $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - // Add panel-heading / button |
|
| 107 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 108 | - 'tab' => 'categories_list', |
|
| 109 | - 'category' => $categories[$catid], |
|
| 110 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 111 | - 'catid' => $catid, |
|
| 112 | - )); |
|
| 113 | - |
|
| 114 | - // Add panel |
|
| 115 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 116 | - 'tab' => 'categories_list', |
|
| 117 | - 'catid' => $catid, |
|
| 118 | - 'wrapper' => $panelCollapse, |
|
| 119 | - )); |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - return parsePh($tpl['panelGroup'], array( |
|
| 123 | - 'resourceTable' => 'categories_list', |
|
| 124 | - 'wrapper' => $panelGroup |
|
| 125 | - )); |
|
| 78 | + global $modx, $_lang, $_style, $modx_textdir; |
|
| 79 | + |
|
| 80 | + $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
| 81 | + $types = isset($resources->types) ? $resources->types : false; |
|
| 82 | + $categories = isset($resources->categories) ? $resources->categories : false; |
|
| 83 | + |
|
| 84 | + if(!$itemsPerCategory) {
|
|
| 85 | + return $_lang['no_results']; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + $tpl = array( |
|
| 89 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 90 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 91 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 92 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
| 93 | + ); |
|
| 94 | + |
|
| 95 | + // Easily loop through $itemsPerCategory-Array |
|
| 96 | + $panelGroup = ''; |
|
| 97 | + foreach($categories as $catid => $category) {
|
|
| 98 | + // Prepare collapse content / elements-list |
|
| 99 | + $panelCollapse = ''; |
|
| 100 | + foreach($itemsPerCategory[$catid] as $el) {
|
|
| 101 | + $resourceTable = $el['type']; |
|
| 102 | + $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
| 103 | + $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + // Add panel-heading / button |
|
| 107 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 108 | + 'tab' => 'categories_list', |
|
| 109 | + 'category' => $categories[$catid], |
|
| 110 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 111 | + 'catid' => $catid, |
|
| 112 | + )); |
|
| 113 | + |
|
| 114 | + // Add panel |
|
| 115 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 116 | + 'tab' => 'categories_list', |
|
| 117 | + 'catid' => $catid, |
|
| 118 | + 'wrapper' => $panelCollapse, |
|
| 119 | + )); |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + return parsePh($tpl['panelGroup'], array( |
|
| 123 | + 'resourceTable' => 'categories_list', |
|
| 124 | + 'wrapper' => $panelGroup |
|
| 125 | + )); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | function prepareElementRowPh($row, $resourceTable, $resources) {
|
| 129 | - global $modx, $modx_textdir, $_style, $_lang; |
|
| 130 | - |
|
| 131 | - $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
| 132 | - |
|
| 133 | - $class = ''; |
|
| 134 | - $_lang["confirm_delete"] = $_lang["delete"]; |
|
| 135 | - |
|
| 136 | - if($resourceTable == 'site_templates') {
|
|
| 137 | - $class = $row['selectable'] ? '' : 'disabledPlugin'; |
|
| 138 | - $lockElementType = 1; |
|
| 139 | - $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
|
| 140 | - } |
|
| 141 | - if($resourceTable == 'site_tmplvars') {
|
|
| 142 | - $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
|
| 143 | - $lockElementType = 2; |
|
| 144 | - $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
|
| 145 | - } |
|
| 146 | - if($resourceTable == 'site_htmlsnippets') {
|
|
| 129 | + global $modx, $modx_textdir, $_style, $_lang; |
|
| 130 | + |
|
| 131 | + $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
| 132 | + |
|
| 133 | + $class = ''; |
|
| 134 | + $_lang["confirm_delete"] = $_lang["delete"]; |
|
| 135 | + |
|
| 136 | + if($resourceTable == 'site_templates') {
|
|
| 137 | + $class = $row['selectable'] ? '' : 'disabledPlugin'; |
|
| 138 | + $lockElementType = 1; |
|
| 139 | + $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
|
| 140 | + } |
|
| 141 | + if($resourceTable == 'site_tmplvars') {
|
|
| 142 | + $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
|
| 143 | + $lockElementType = 2; |
|
| 144 | + $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
|
| 145 | + } |
|
| 146 | + if($resourceTable == 'site_htmlsnippets') {
|
|
| 147 | 147 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 148 | - $lockElementType = 3; |
|
| 149 | - $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
|
| 150 | - } |
|
| 151 | - if($resourceTable == 'site_snippets') {
|
|
| 148 | + $lockElementType = 3; |
|
| 149 | + $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
|
| 150 | + } |
|
| 151 | + if($resourceTable == 'site_snippets') {
|
|
| 152 | 152 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 153 | - $lockElementType = 4; |
|
| 154 | - $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
|
| 155 | - } |
|
| 156 | - if($resourceTable == 'site_plugins') {
|
|
| 157 | - $class = $row['disabled'] ? 'disabledPlugin' : ''; |
|
| 158 | - $lockElementType = 5; |
|
| 159 | - $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
|
| 160 | - } |
|
| 161 | - if($resourceTable == 'site_modules') {
|
|
| 153 | + $lockElementType = 4; |
|
| 154 | + $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
|
| 155 | + } |
|
| 156 | + if($resourceTable == 'site_plugins') {
|
|
| 157 | + $class = $row['disabled'] ? 'disabledPlugin' : ''; |
|
| 158 | + $lockElementType = 5; |
|
| 159 | + $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
|
| 160 | + } |
|
| 161 | + if($resourceTable == 'site_modules') {
|
|
| 162 | 162 | $class = $row['disabled'] ? '' : 'disabledPlugin'; |
| 163 | - $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - // Prepare displaying user-locks |
|
| 167 | - $lockedByUser = ''; |
|
| 168 | - $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
| 169 | - if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 170 | - if($rowLock['sid'] == $modx->sid) {
|
|
| 171 | - $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
| 172 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 173 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 174 | - )); |
|
| 175 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
| 176 | - } else {
|
|
| 177 | - $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
| 178 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 179 | - 'username' => $rowLock['username'], |
|
| 180 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 181 | - )); |
|
| 182 | - if($modx->hasPermission('remove_locks')) {
|
|
| 183 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
|
| 184 | - } else {
|
|
| 185 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
| 186 | - } |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - if($lockedByUser) {
|
|
| 190 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - // Caption |
|
| 194 | - if($resourceTable == 'site_tmplvars') {
|
|
| 195 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
|
| 196 | - } else {
|
|
| 197 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - // Special marks |
|
| 201 | - $tplInfo = array(); |
|
| 202 | - if($row['locked']) {
|
|
| 203 | - $tplInfo[] = $_lang['locked']; |
|
| 204 | - } |
|
| 205 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 206 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
| 207 | - } |
|
| 208 | - $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
|
|
| 209 | - |
|
| 210 | - /* row buttons */ |
|
| 211 | - $buttons = ''; |
|
| 212 | - if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 213 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
| 214 | - } |
|
| 215 | - if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 216 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
| 217 | - } |
|
| 218 | - if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 219 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
| 220 | - } |
|
| 221 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
| 222 | - |
|
| 223 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 224 | - |
|
| 225 | - // Placeholders for elements-row |
|
| 226 | - return array( |
|
| 227 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
| 228 | - 'lockedByUser' => $lockedByUser, |
|
| 229 | - 'name' => $row['name'], |
|
| 230 | - 'caption' => $caption, |
|
| 231 | - 'buttons' => $buttons, |
|
| 232 | - 'marks' => $marks, |
|
| 233 | - 'id' => $row['id'], |
|
| 234 | - 'resourceTable' => $resourceTable, |
|
| 235 | - 'actionEdit' => $types['actions']['edit'][0], |
|
| 236 | - 'catid' => $catid, |
|
| 237 | - 'textdir' => $modx_textdir ? '‏' : '', |
|
| 238 | - ); |
|
| 163 | + $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + // Prepare displaying user-locks |
|
| 167 | + $lockedByUser = ''; |
|
| 168 | + $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
| 169 | + if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 170 | + if($rowLock['sid'] == $modx->sid) {
|
|
| 171 | + $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
| 172 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 173 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 174 | + )); |
|
| 175 | + $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
| 176 | + } else {
|
|
| 177 | + $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
| 178 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 179 | + 'username' => $rowLock['username'], |
|
| 180 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 181 | + )); |
|
| 182 | + if($modx->hasPermission('remove_locks')) {
|
|
| 183 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
|
| 184 | + } else {
|
|
| 185 | + $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
| 186 | + } |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + if($lockedByUser) {
|
|
| 190 | + $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + // Caption |
|
| 194 | + if($resourceTable == 'site_tmplvars') {
|
|
| 195 | + $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
|
| 196 | + } else {
|
|
| 197 | + $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + // Special marks |
|
| 201 | + $tplInfo = array(); |
|
| 202 | + if($row['locked']) {
|
|
| 203 | + $tplInfo[] = $_lang['locked']; |
|
| 204 | + } |
|
| 205 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 206 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
| 207 | + } |
|
| 208 | + $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
|
|
| 209 | + |
|
| 210 | + /* row buttons */ |
|
| 211 | + $buttons = ''; |
|
| 212 | + if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 213 | + $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
| 214 | + } |
|
| 215 | + if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 216 | + $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
| 217 | + } |
|
| 218 | + if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 219 | + $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
| 220 | + } |
|
| 221 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
| 222 | + |
|
| 223 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 224 | + |
|
| 225 | + // Placeholders for elements-row |
|
| 226 | + return array( |
|
| 227 | + 'class' => $class ? ' class="' . $class . '"' : '', |
|
| 228 | + 'lockedByUser' => $lockedByUser, |
|
| 229 | + 'name' => $row['name'], |
|
| 230 | + 'caption' => $caption, |
|
| 231 | + 'buttons' => $buttons, |
|
| 232 | + 'marks' => $marks, |
|
| 233 | + 'id' => $row['id'], |
|
| 234 | + 'resourceTable' => $resourceTable, |
|
| 235 | + 'actionEdit' => $types['actions']['edit'][0], |
|
| 236 | + 'catid' => $catid, |
|
| 237 | + 'textdir' => $modx_textdir ? '‏' : '', |
|
| 238 | + ); |
|
| 239 | 239 | } |
@@ -1,23 +1,23 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | $tpl = array( |
| 7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
| 8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
| 7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_viewForm.tpl'), |
|
| 8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
| 9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
| 10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
| 11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl') |
|
| 12 | 12 | ); |
| 13 | 13 | |
| 14 | -function parsePh($tpl, $ph) {
|
|
| 14 | +function parsePh($tpl, $ph){
|
|
| 15 | 15 | global $modx, $_lang; |
| 16 | 16 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
| 17 | 17 | return $modx->parseText($tpl, $ph); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -function renderViewSwitchButtons($cssId) {
|
|
| 20 | +function renderViewSwitchButtons($cssId){
|
|
| 21 | 21 | global $modx, $_lang, $tpl; |
| 22 | 22 | |
| 23 | 23 | return parsePh($tpl['viewForm'], array( |
@@ -25,19 +25,19 @@ discard block |
||
| 25 | 25 | )); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | -function createResourceList($resourceTable, $resources) {
|
|
| 28 | +function createResourceList($resourceTable, $resources){
|
|
| 29 | 29 | global $modx, $_lang, $_style, $modx_textdir, $tpl; |
| 30 | 30 | |
| 31 | 31 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
| 32 | 32 | |
| 33 | - if( ! is_array($items) || empty($items)) {
|
|
| 33 | + if (!is_array($items) || empty($items)) {
|
|
| 34 | 34 | return $_lang['no_results']; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // Prepare elements- and categories-list |
| 38 | 38 | $elements = array(); |
| 39 | 39 | $categories = array(); |
| 40 | - foreach($items as $row) {
|
|
| 40 | + foreach ($items as $row) {
|
|
| 41 | 41 | $catid = $row['catid'] ? $row['catid'] : 0; |
| 42 | 42 | $categories[$catid] = array('name' => stripslashes($row['category']));
|
| 43 | 43 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -45,18 +45,18 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | // Now render categories / panel-collapse |
| 47 | 47 | $panelGroup = ''; |
| 48 | - foreach($elements as $catid => $elList) {
|
|
| 48 | + foreach ($elements as $catid => $elList) {
|
|
| 49 | 49 | // Add panel-heading / category-collapse to output |
| 50 | 50 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
| 51 | 51 | 'tab' => $resourceTable, |
| 52 | 52 | 'category' => $categories[$catid]['name'], |
| 53 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 53 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '',
|
|
| 54 | 54 | 'catid' => $catid, |
| 55 | 55 | )); |
| 56 | 56 | |
| 57 | 57 | // Prepare content for panel-collapse |
| 58 | 58 | $panelCollapse = ''; |
| 59 | - foreach($elList as $el) {
|
|
| 59 | + foreach ($elList as $el) {
|
|
| 60 | 60 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -74,30 +74,30 @@ discard block |
||
| 74 | 74 | )); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | -function createCombinedView($resources) {
|
|
| 77 | +function createCombinedView($resources){
|
|
| 78 | 78 | global $modx, $_lang, $_style, $modx_textdir; |
| 79 | 79 | |
| 80 | 80 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
| 81 | 81 | $types = isset($resources->types) ? $resources->types : false; |
| 82 | 82 | $categories = isset($resources->categories) ? $resources->categories : false; |
| 83 | 83 | |
| 84 | - if(!$itemsPerCategory) {
|
|
| 84 | + if (!$itemsPerCategory) {
|
|
| 85 | 85 | return $_lang['no_results']; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $tpl = array( |
| 89 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 90 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 91 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 92 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
| 89 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
| 90 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
| 91 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
| 92 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl'), |
|
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | 95 | // Easily loop through $itemsPerCategory-Array |
| 96 | 96 | $panelGroup = ''; |
| 97 | - foreach($categories as $catid => $category) {
|
|
| 97 | + foreach ($categories as $catid => $category) {
|
|
| 98 | 98 | // Prepare collapse content / elements-list |
| 99 | 99 | $panelCollapse = ''; |
| 100 | - foreach($itemsPerCategory[$catid] as $el) {
|
|
| 100 | + foreach ($itemsPerCategory[$catid] as $el) {
|
|
| 101 | 101 | $resourceTable = $el['type']; |
| 102 | 102 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
| 103 | 103 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
| 108 | 108 | 'tab' => 'categories_list', |
| 109 | 109 | 'category' => $categories[$catid], |
| 110 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 110 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '',
|
|
| 111 | 111 | 'catid' => $catid, |
| 112 | 112 | )); |
| 113 | 113 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | )); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | -function prepareElementRowPh($row, $resourceTable, $resources) {
|
|
| 128 | +function prepareElementRowPh($row, $resourceTable, $resources){
|
|
| 129 | 129 | global $modx, $modx_textdir, $_style, $_lang; |
| 130 | 130 | |
| 131 | 131 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
@@ -133,32 +133,32 @@ discard block |
||
| 133 | 133 | $class = ''; |
| 134 | 134 | $_lang["confirm_delete"] = $_lang["delete"]; |
| 135 | 135 | |
| 136 | - if($resourceTable == 'site_templates') {
|
|
| 136 | + if ($resourceTable == 'site_templates') {
|
|
| 137 | 137 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
| 138 | 138 | $lockElementType = 1; |
| 139 | 139 | $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
| 140 | 140 | } |
| 141 | - if($resourceTable == 'site_tmplvars') {
|
|
| 141 | + if ($resourceTable == 'site_tmplvars') {
|
|
| 142 | 142 | $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
| 143 | 143 | $lockElementType = 2; |
| 144 | 144 | $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
| 145 | 145 | } |
| 146 | - if($resourceTable == 'site_htmlsnippets') {
|
|
| 146 | + if ($resourceTable == 'site_htmlsnippets') {
|
|
| 147 | 147 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 148 | 148 | $lockElementType = 3; |
| 149 | 149 | $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
| 150 | 150 | } |
| 151 | - if($resourceTable == 'site_snippets') {
|
|
| 151 | + if ($resourceTable == 'site_snippets') {
|
|
| 152 | 152 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 153 | 153 | $lockElementType = 4; |
| 154 | 154 | $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
| 155 | 155 | } |
| 156 | - if($resourceTable == 'site_plugins') {
|
|
| 156 | + if ($resourceTable == 'site_plugins') {
|
|
| 157 | 157 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 158 | 158 | $lockElementType = 5; |
| 159 | 159 | $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
| 160 | 160 | } |
| 161 | - if($resourceTable == 'site_modules') {
|
|
| 161 | + if ($resourceTable == 'site_modules') {
|
|
| 162 | 162 | $class = $row['disabled'] ? '' : 'disabledPlugin'; |
| 163 | 163 | $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
| 164 | 164 | } |
@@ -166,65 +166,65 @@ discard block |
||
| 166 | 166 | // Prepare displaying user-locks |
| 167 | 167 | $lockedByUser = ''; |
| 168 | 168 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
| 169 | - if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 170 | - if($rowLock['sid'] == $modx->sid) {
|
|
| 169 | + if ($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 170 | + if ($rowLock['sid'] == $modx->sid) {
|
|
| 171 | 171 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
| 172 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 172 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
| 173 | 173 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 174 | 174 | )); |
| 175 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
| 175 | + $lockedByUser = '<span title="'.$title.'" class="editResource" style="cursor:context-menu;">'.$_style['tree_preview_resource'].'</span> '; |
|
| 176 | 176 | } else {
|
| 177 | 177 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
| 178 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 178 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
| 179 | 179 | 'username' => $rowLock['username'], |
| 180 | 180 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 181 | 181 | )); |
| 182 | - if($modx->hasPermission('remove_locks')) {
|
|
| 183 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
|
| 182 | + if ($modx->hasPermission('remove_locks')) {
|
|
| 183 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement('.$lockElementType.', '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource"><i class="'.$_style['icons_secured'].'"></i></a>';
|
|
| 184 | 184 | } else {
|
| 185 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
| 185 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource" style="cursor:context-menu;"><i class="'.$_style['icons_secured'].'"></i></span>'; |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | - if($lockedByUser) {
|
|
| 190 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
| 189 | + if ($lockedByUser) {
|
|
| 190 | + $lockedByUser = '<div class="lockCell">'.$lockedByUser.'</div>'; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // Caption |
| 194 | - if($resourceTable == 'site_tmplvars') {
|
|
| 195 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
|
| 194 | + if ($resourceTable == 'site_tmplvars') {
|
|
| 195 | + $caption = !empty($row['description']) ? ' '.$row['caption'].' <small>('.$row['description'].')</small>' : ' '.$row['caption'];
|
|
| 196 | 196 | } else {
|
| 197 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
| 197 | + $caption = !empty($row['description']) ? ' '.$row['description'] : ''; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | // Special marks |
| 201 | 201 | $tplInfo = array(); |
| 202 | - if($row['locked']) {
|
|
| 202 | + if ($row['locked']) {
|
|
| 203 | 203 | $tplInfo[] = $_lang['locked']; |
| 204 | 204 | } |
| 205 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 205 | + if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 206 | 206 | $tplInfo[] = $_lang['defaulttemplate_title']; |
| 207 | 207 | } |
| 208 | - $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
|
|
| 208 | + $marks = !empty($tplInfo) ? ' <em>('.join(', ', $tplInfo).')</em>' : '';
|
|
| 209 | 209 | |
| 210 | 210 | /* row buttons */ |
| 211 | 211 | $buttons = ''; |
| 212 | - if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 213 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
| 212 | + if ($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 213 | + $buttons .= '<li><a title="'.$_lang["edit_resource"].'" href="index.php?a='.$types['actions']['edit'][0].'&id='.$row['id'].'"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
| 214 | 214 | } |
| 215 | - if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 216 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
| 215 | + if ($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 216 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_duplicate_record"].'\')" title="'.$_lang["resource_duplicate"].'" href="index.php?a='.$types['actions']['duplicate'][0].'&id='.$row['id'].'"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
| 217 | 217 | } |
| 218 | - if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 219 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
| 218 | + if ($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 219 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_delete"].'\')" title="'.$_lang["delete"].'" href="index.php?a='.$types['actions']['remove'][0].'&id='.$row['id'].'"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
| 220 | 220 | } |
| 221 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
| 221 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">'.$buttons.'</ul></div>' : ''; |
|
| 222 | 222 | |
| 223 | 223 | $catid = $row['catid'] ? $row['catid'] : 0; |
| 224 | 224 | |
| 225 | 225 | // Placeholders for elements-row |
| 226 | 226 | return array( |
| 227 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
| 227 | + 'class' => $class ? ' class="'.$class.'"' : '', |
|
| 228 | 228 | 'lockedByUser' => $lockedByUser, |
| 229 | 229 | 'name' => $row['name'], |
| 230 | 230 | 'caption' => $caption, |
@@ -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 | |
@@ -11,13 +11,15 @@ discard block |
||
| 11 | 11 | 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
| 12 | 12 | ); |
| 13 | 13 | |
| 14 | -function parsePh($tpl, $ph) {
|
|
| 14 | +function parsePh($tpl, $ph) |
|
| 15 | +{ |
|
| 15 | 16 | global $modx, $_lang; |
| 16 | 17 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
| 17 | 18 | return $modx->parseText($tpl, $ph); |
| 18 | 19 | } |
| 19 | 20 | |
| 20 | -function renderViewSwitchButtons($cssId) {
|
|
| 21 | +function renderViewSwitchButtons($cssId) |
|
| 22 | +{ |
|
| 21 | 23 | global $modx, $_lang, $tpl; |
| 22 | 24 | |
| 23 | 25 | return parsePh($tpl['viewForm'], array( |
@@ -25,19 +27,20 @@ discard block |
||
| 25 | 27 | )); |
| 26 | 28 | } |
| 27 | 29 | |
| 28 | -function createResourceList($resourceTable, $resources) {
|
|
| 30 | +function createResourceList($resourceTable, $resources) |
|
| 31 | +{ |
|
| 29 | 32 | global $modx, $_lang, $_style, $modx_textdir, $tpl; |
| 30 | 33 | |
| 31 | 34 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
| 32 | 35 | |
| 33 | - if( ! is_array($items) || empty($items)) {
|
|
| 36 | + if( ! is_array($items) || empty($items)) { |
|
| 34 | 37 | return $_lang['no_results']; |
| 35 | 38 | } |
| 36 | 39 | |
| 37 | 40 | // Prepare elements- and categories-list |
| 38 | 41 | $elements = array(); |
| 39 | 42 | $categories = array(); |
| 40 | - foreach($items as $row) {
|
|
| 43 | + foreach($items as $row) { |
|
| 41 | 44 | $catid = $row['catid'] ? $row['catid'] : 0; |
| 42 | 45 | $categories[$catid] = array('name' => stripslashes($row['category']));
|
| 43 | 46 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -45,7 +48,7 @@ discard block |
||
| 45 | 48 | |
| 46 | 49 | // Now render categories / panel-collapse |
| 47 | 50 | $panelGroup = ''; |
| 48 | - foreach($elements as $catid => $elList) {
|
|
| 51 | + foreach($elements as $catid => $elList) { |
|
| 49 | 52 | // Add panel-heading / category-collapse to output |
| 50 | 53 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
| 51 | 54 | 'tab' => $resourceTable, |
@@ -56,7 +59,7 @@ discard block |
||
| 56 | 59 | |
| 57 | 60 | // Prepare content for panel-collapse |
| 58 | 61 | $panelCollapse = ''; |
| 59 | - foreach($elList as $el) {
|
|
| 62 | + foreach($elList as $el) { |
|
| 60 | 63 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
| 61 | 64 | } |
| 62 | 65 | |
@@ -74,14 +77,15 @@ discard block |
||
| 74 | 77 | )); |
| 75 | 78 | } |
| 76 | 79 | |
| 77 | -function createCombinedView($resources) {
|
|
| 80 | +function createCombinedView($resources) |
|
| 81 | +{ |
|
| 78 | 82 | global $modx, $_lang, $_style, $modx_textdir; |
| 79 | 83 | |
| 80 | 84 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
| 81 | 85 | $types = isset($resources->types) ? $resources->types : false; |
| 82 | 86 | $categories = isset($resources->categories) ? $resources->categories : false; |
| 83 | 87 | |
| 84 | - if(!$itemsPerCategory) {
|
|
| 88 | + if(!$itemsPerCategory) { |
|
| 85 | 89 | return $_lang['no_results']; |
| 86 | 90 | } |
| 87 | 91 | |
@@ -94,10 +98,10 @@ discard block |
||
| 94 | 98 | |
| 95 | 99 | // Easily loop through $itemsPerCategory-Array |
| 96 | 100 | $panelGroup = ''; |
| 97 | - foreach($categories as $catid => $category) {
|
|
| 101 | + foreach($categories as $catid => $category) { |
|
| 98 | 102 | // Prepare collapse content / elements-list |
| 99 | 103 | $panelCollapse = ''; |
| 100 | - foreach($itemsPerCategory[$catid] as $el) {
|
|
| 104 | + foreach($itemsPerCategory[$catid] as $el) { |
|
| 101 | 105 | $resourceTable = $el['type']; |
| 102 | 106 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
| 103 | 107 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -125,7 +129,8 @@ discard block |
||
| 125 | 129 | )); |
| 126 | 130 | } |
| 127 | 131 | |
| 128 | -function prepareElementRowPh($row, $resourceTable, $resources) {
|
|
| 132 | +function prepareElementRowPh($row, $resourceTable, $resources) |
|
| 133 | +{ |
|
| 129 | 134 | global $modx, $modx_textdir, $_style, $_lang; |
| 130 | 135 | |
| 131 | 136 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
@@ -133,32 +138,32 @@ discard block |
||
| 133 | 138 | $class = ''; |
| 134 | 139 | $_lang["confirm_delete"] = $_lang["delete"]; |
| 135 | 140 | |
| 136 | - if($resourceTable == 'site_templates') {
|
|
| 141 | + if($resourceTable == 'site_templates') { |
|
| 137 | 142 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
| 138 | 143 | $lockElementType = 1; |
| 139 | 144 | $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
| 140 | 145 | } |
| 141 | - if($resourceTable == 'site_tmplvars') {
|
|
| 146 | + if($resourceTable == 'site_tmplvars') { |
|
| 142 | 147 | $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
| 143 | 148 | $lockElementType = 2; |
| 144 | 149 | $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
| 145 | 150 | } |
| 146 | - if($resourceTable == 'site_htmlsnippets') {
|
|
| 151 | + if($resourceTable == 'site_htmlsnippets') { |
|
| 147 | 152 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 148 | 153 | $lockElementType = 3; |
| 149 | 154 | $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
| 150 | 155 | } |
| 151 | - if($resourceTable == 'site_snippets') {
|
|
| 156 | + if($resourceTable == 'site_snippets') { |
|
| 152 | 157 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 153 | 158 | $lockElementType = 4; |
| 154 | 159 | $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
| 155 | 160 | } |
| 156 | - if($resourceTable == 'site_plugins') {
|
|
| 161 | + if($resourceTable == 'site_plugins') { |
|
| 157 | 162 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 158 | 163 | $lockElementType = 5; |
| 159 | 164 | $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
| 160 | 165 | } |
| 161 | - if($resourceTable == 'site_modules') {
|
|
| 166 | + if($resourceTable == 'site_modules') { |
|
| 162 | 167 | $class = $row['disabled'] ? '' : 'disabledPlugin'; |
| 163 | 168 | $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
| 164 | 169 | } |
@@ -166,56 +171,56 @@ discard block |
||
| 166 | 171 | // Prepare displaying user-locks |
| 167 | 172 | $lockedByUser = ''; |
| 168 | 173 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
| 169 | - if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 170 | - if($rowLock['sid'] == $modx->sid) {
|
|
| 174 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
| 175 | + if($rowLock['sid'] == $modx->sid) { |
|
| 171 | 176 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
| 172 | 177 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
| 173 | 178 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 174 | 179 | )); |
| 175 | 180 | $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
| 176 | - } else {
|
|
| 181 | + } else { |
|
| 177 | 182 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
| 178 | 183 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
| 179 | 184 | 'username' => $rowLock['username'], |
| 180 | 185 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 181 | 186 | )); |
| 182 | - if($modx->hasPermission('remove_locks')) {
|
|
| 187 | + if($modx->hasPermission('remove_locks')) { |
|
| 183 | 188 | $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
| 184 | - } else {
|
|
| 189 | + } else { |
|
| 185 | 190 | $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
| 186 | 191 | } |
| 187 | 192 | } |
| 188 | 193 | } |
| 189 | - if($lockedByUser) {
|
|
| 194 | + if($lockedByUser) { |
|
| 190 | 195 | $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
| 191 | 196 | } |
| 192 | 197 | |
| 193 | 198 | // Caption |
| 194 | - if($resourceTable == 'site_tmplvars') {
|
|
| 199 | + if($resourceTable == 'site_tmplvars') { |
|
| 195 | 200 | $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
| 196 | - } else {
|
|
| 201 | + } else { |
|
| 197 | 202 | $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
| 198 | 203 | } |
| 199 | 204 | |
| 200 | 205 | // Special marks |
| 201 | 206 | $tplInfo = array(); |
| 202 | - if($row['locked']) {
|
|
| 207 | + if($row['locked']) { |
|
| 203 | 208 | $tplInfo[] = $_lang['locked']; |
| 204 | 209 | } |
| 205 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 210 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
| 206 | 211 | $tplInfo[] = $_lang['defaulttemplate_title']; |
| 207 | 212 | } |
| 208 | 213 | $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
|
| 209 | 214 | |
| 210 | 215 | /* row buttons */ |
| 211 | 216 | $buttons = ''; |
| 212 | - if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 217 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
| 213 | 218 | $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
| 214 | 219 | } |
| 215 | - if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 220 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
| 216 | 221 | $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
| 217 | 222 | } |
| 218 | - if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 223 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
| 219 | 224 | $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
| 220 | 225 | } |
| 221 | 226 | $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
@@ -4,123 +4,123 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | class mgrResources { |
| 7 | - var $types = array(); |
|
| 8 | - var $items = array(); |
|
| 9 | - var $categories = array(); |
|
| 10 | - var $itemsPerCategory = array(); |
|
| 11 | - |
|
| 12 | - function __construct() { |
|
| 13 | - $this->setTypes(); |
|
| 14 | - $this->queryItemsFromDB(); |
|
| 15 | - $this->prepareCategoryArrays(); |
|
| 16 | - } |
|
| 17 | - |
|
| 18 | - function setTypes() { |
|
| 19 | - global $_lang; |
|
| 20 | - $this->types['site_templates'] = array( |
|
| 21 | - 'title'=>$_lang["manage_templates"], |
|
| 22 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 23 | - 'permissions'=>array('new_template','edit_template'), |
|
| 24 | - 'name'=>'templatename' |
|
| 25 | - ); |
|
| 26 | - $this->types['site_tmplvars'] = array( |
|
| 27 | - 'title'=>$_lang["tmplvars"], |
|
| 28 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 29 | - 'permissions'=>array('new_template','edit_template'), |
|
| 30 | - ); |
|
| 31 | - $this->types['site_htmlsnippets'] = array( |
|
| 32 | - 'title'=>$_lang["manage_htmlsnippets"], |
|
| 33 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 34 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 35 | - ); |
|
| 36 | - $this->types['site_snippets'] = array( |
|
| 37 | - 'title'=>$_lang["manage_snippets"], |
|
| 38 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 39 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 40 | - ); |
|
| 41 | - $this->types['site_plugins'] = array( |
|
| 42 | - 'title'=>$_lang["manage_plugins"], |
|
| 43 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 44 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 45 | - ); |
|
| 46 | - $this->types['site_modules'] = array( |
|
| 47 | - 'title'=>$_lang["manage_modules"], |
|
| 48 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 49 | - 'permissions'=>array('new_module','edit_module'), |
|
| 50 | - ); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - function queryItemsFromDB() { |
|
| 54 | - foreach($this->types as $resourceTable=>$type) { |
|
| 55 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
| 56 | - $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
| 57 | - $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - function hasAnyPermissions($permissions) { |
|
| 63 | - global $modx; |
|
| 64 | - |
|
| 65 | - foreach($permissions as $p) |
|
| 66 | - if($modx->hasPermission($p)) return true; |
|
| 67 | - |
|
| 68 | - return false; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - function queryResources($resourceTable, $nameField = 'name') { |
|
| 72 | - global $modx, $_lang; |
|
| 73 | - |
|
| 74 | - $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
|
| 75 | - |
|
| 76 | - $tvsql = ''; |
|
| 77 | - $tvjoin = ''; |
|
| 78 | - if ($resourceTable == 'site_tmplvars') { |
|
| 79 | - $tvsql = 'site_tmplvars.caption, '; |
|
| 80 | - $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
| 81 | - $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
| 82 | - } |
|
| 83 | - else $sttfield = ''; |
|
| 84 | - |
|
| 85 | - $selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
| 86 | - |
|
| 87 | - $rs = $modx->db->select( |
|
| 88 | - "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
| 89 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 7 | + var $types = array(); |
|
| 8 | + var $items = array(); |
|
| 9 | + var $categories = array(); |
|
| 10 | + var $itemsPerCategory = array(); |
|
| 11 | + |
|
| 12 | + function __construct() { |
|
| 13 | + $this->setTypes(); |
|
| 14 | + $this->queryItemsFromDB(); |
|
| 15 | + $this->prepareCategoryArrays(); |
|
| 16 | + } |
|
| 17 | + |
|
| 18 | + function setTypes() { |
|
| 19 | + global $_lang; |
|
| 20 | + $this->types['site_templates'] = array( |
|
| 21 | + 'title'=>$_lang["manage_templates"], |
|
| 22 | + 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 23 | + 'permissions'=>array('new_template','edit_template'), |
|
| 24 | + 'name'=>'templatename' |
|
| 25 | + ); |
|
| 26 | + $this->types['site_tmplvars'] = array( |
|
| 27 | + 'title'=>$_lang["tmplvars"], |
|
| 28 | + 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 29 | + 'permissions'=>array('new_template','edit_template'), |
|
| 30 | + ); |
|
| 31 | + $this->types['site_htmlsnippets'] = array( |
|
| 32 | + 'title'=>$_lang["manage_htmlsnippets"], |
|
| 33 | + 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 34 | + 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 35 | + ); |
|
| 36 | + $this->types['site_snippets'] = array( |
|
| 37 | + 'title'=>$_lang["manage_snippets"], |
|
| 38 | + 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 39 | + 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 40 | + ); |
|
| 41 | + $this->types['site_plugins'] = array( |
|
| 42 | + 'title'=>$_lang["manage_plugins"], |
|
| 43 | + 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 44 | + 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 45 | + ); |
|
| 46 | + $this->types['site_modules'] = array( |
|
| 47 | + 'title'=>$_lang["manage_modules"], |
|
| 48 | + 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 49 | + 'permissions'=>array('new_module','edit_module'), |
|
| 50 | + ); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + function queryItemsFromDB() { |
|
| 54 | + foreach($this->types as $resourceTable=>$type) { |
|
| 55 | + if($this->hasAnyPermissions($type['permissions'])) { |
|
| 56 | + $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
| 57 | + $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + function hasAnyPermissions($permissions) { |
|
| 63 | + global $modx; |
|
| 64 | + |
|
| 65 | + foreach($permissions as $p) |
|
| 66 | + if($modx->hasPermission($p)) return true; |
|
| 67 | + |
|
| 68 | + return false; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + function queryResources($resourceTable, $nameField = 'name') { |
|
| 72 | + global $modx, $_lang; |
|
| 73 | + |
|
| 74 | + $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
|
| 75 | + |
|
| 76 | + $tvsql = ''; |
|
| 77 | + $tvjoin = ''; |
|
| 78 | + if ($resourceTable == 'site_tmplvars') { |
|
| 79 | + $tvsql = 'site_tmplvars.caption, '; |
|
| 80 | + $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
| 81 | + $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
| 82 | + } |
|
| 83 | + else $sttfield = ''; |
|
| 84 | + |
|
| 85 | + $selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
| 86 | + |
|
| 87 | + $rs = $modx->db->select( |
|
| 88 | + "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
| 89 | + $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 90 | 90 | LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
| 91 | - "", |
|
| 92 | - "category,name" |
|
| 93 | - ); |
|
| 94 | - $limit = $modx->db->getRecordCount($rs); |
|
| 95 | - |
|
| 96 | - if($limit < 1) return false; |
|
| 97 | - |
|
| 98 | - $result = array(); |
|
| 99 | - while ($row = $modx->db->getRow($rs)) { |
|
| 100 | - $result[] = $row; |
|
| 101 | - } |
|
| 102 | - return $result; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - function prepareCategoryArrays() { |
|
| 106 | - foreach($this->items as $type=>$items) { |
|
| 107 | - foreach((array)$items as $item) { |
|
| 108 | - $catid = $item['catid'] ? $item['catid'] : 0; |
|
| 109 | - $this->categories[$catid] = $item['category']; |
|
| 110 | - |
|
| 111 | - $item['type'] = $type; |
|
| 112 | - $this->itemsPerCategory[$catid][] = $item; |
|
| 113 | - } |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - // Sort categories by name |
|
| 117 | - natcasesort($this->categories); |
|
| 118 | - |
|
| 119 | - // Now sort by name |
|
| 120 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 121 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 122 | - return strcasecmp($a['name'], $b['name']); |
|
| 123 | - }); |
|
| 124 | - } |
|
| 125 | - } |
|
| 91 | + "", |
|
| 92 | + "category,name" |
|
| 93 | + ); |
|
| 94 | + $limit = $modx->db->getRecordCount($rs); |
|
| 95 | + |
|
| 96 | + if($limit < 1) return false; |
|
| 97 | + |
|
| 98 | + $result = array(); |
|
| 99 | + while ($row = $modx->db->getRow($rs)) { |
|
| 100 | + $result[] = $row; |
|
| 101 | + } |
|
| 102 | + return $result; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + function prepareCategoryArrays() { |
|
| 106 | + foreach($this->items as $type=>$items) { |
|
| 107 | + foreach((array)$items as $item) { |
|
| 108 | + $catid = $item['catid'] ? $item['catid'] : 0; |
|
| 109 | + $this->categories[$catid] = $item['category']; |
|
| 110 | + |
|
| 111 | + $item['type'] = $type; |
|
| 112 | + $this->itemsPerCategory[$catid][] = $item; |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + // Sort categories by name |
|
| 117 | + natcasesort($this->categories); |
|
| 118 | + |
|
| 119 | + // Now sort by name |
|
| 120 | + foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 121 | + usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 122 | + return strcasecmp($a['name'], $b['name']); |
|
| 123 | + }); |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | 126 | } |
@@ -1,77 +1,77 @@ 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 | -class mgrResources { |
|
| 6 | +class mgrResources{ |
|
| 7 | 7 | var $types = array(); |
| 8 | 8 | var $items = array(); |
| 9 | 9 | var $categories = array(); |
| 10 | 10 | var $itemsPerCategory = array(); |
| 11 | 11 | |
| 12 | - function __construct() { |
|
| 12 | + function __construct(){ |
|
| 13 | 13 | $this->setTypes(); |
| 14 | 14 | $this->queryItemsFromDB(); |
| 15 | 15 | $this->prepareCategoryArrays(); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - function setTypes() { |
|
| 18 | + function setTypes(){ |
|
| 19 | 19 | global $_lang; |
| 20 | - $this->types['site_templates'] = array( |
|
| 20 | + $this->types['site_templates'] = array( |
|
| 21 | 21 | 'title'=>$_lang["manage_templates"], |
| 22 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 23 | - 'permissions'=>array('new_template','edit_template'), |
|
| 22 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
| 23 | + 'permissions'=>array('new_template', 'edit_template'), |
|
| 24 | 24 | 'name'=>'templatename' |
| 25 | 25 | ); |
| 26 | - $this->types['site_tmplvars'] = array( |
|
| 26 | + $this->types['site_tmplvars'] = array( |
|
| 27 | 27 | 'title'=>$_lang["tmplvars"], |
| 28 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 29 | - 'permissions'=>array('new_template','edit_template'), |
|
| 28 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
| 29 | + 'permissions'=>array('new_template', 'edit_template'), |
|
| 30 | 30 | ); |
| 31 | 31 | $this->types['site_htmlsnippets'] = array( |
| 32 | 32 | 'title'=>$_lang["manage_htmlsnippets"], |
| 33 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 34 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 33 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
| 34 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
| 35 | 35 | ); |
| 36 | - $this->types['site_snippets'] = array( |
|
| 36 | + $this->types['site_snippets'] = array( |
|
| 37 | 37 | 'title'=>$_lang["manage_snippets"], |
| 38 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 39 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 38 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
| 39 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
| 40 | 40 | ); |
| 41 | - $this->types['site_plugins'] = array( |
|
| 41 | + $this->types['site_plugins'] = array( |
|
| 42 | 42 | 'title'=>$_lang["manage_plugins"], |
| 43 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 44 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 43 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
| 44 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
| 45 | 45 | ); |
| 46 | - $this->types['site_modules'] = array( |
|
| 46 | + $this->types['site_modules'] = array( |
|
| 47 | 47 | 'title'=>$_lang["manage_modules"], |
| 48 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 49 | - 'permissions'=>array('new_module','edit_module'), |
|
| 48 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
| 49 | + 'permissions'=>array('new_module', 'edit_module'), |
|
| 50 | 50 | ); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - function queryItemsFromDB() { |
|
| 54 | - foreach($this->types as $resourceTable=>$type) { |
|
| 55 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
| 53 | + function queryItemsFromDB(){ |
|
| 54 | + foreach ($this->types as $resourceTable=>$type) { |
|
| 55 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
| 56 | 56 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
| 57 | 57 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - function hasAnyPermissions($permissions) { |
|
| 62 | + function hasAnyPermissions($permissions){ |
|
| 63 | 63 | global $modx; |
| 64 | 64 | |
| 65 | - foreach($permissions as $p) |
|
| 66 | - if($modx->hasPermission($p)) return true; |
|
| 65 | + foreach ($permissions as $p) |
|
| 66 | + if ($modx->hasPermission($p)) return true; |
|
| 67 | 67 | |
| 68 | 68 | return false; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - function queryResources($resourceTable, $nameField = 'name') { |
|
| 71 | + function queryResources($resourceTable, $nameField = 'name'){ |
|
| 72 | 72 | global $modx, $_lang; |
| 73 | 73 | |
| 74 | - $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
|
| 74 | + $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable.'.disabled, ' : ''; |
|
| 75 | 75 | |
| 76 | 76 | $tvsql = ''; |
| 77 | 77 | $tvjoin = ''; |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $rs = $modx->db->select( |
| 88 | 88 | "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
| 89 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 90 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
| 89 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
| 90 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
| 91 | 91 | "", |
| 92 | 92 | "category,name" |
| 93 | 93 | ); |
| 94 | 94 | $limit = $modx->db->getRecordCount($rs); |
| 95 | 95 | |
| 96 | - if($limit < 1) return false; |
|
| 96 | + if ($limit < 1) return false; |
|
| 97 | 97 | |
| 98 | 98 | $result = array(); |
| 99 | 99 | while ($row = $modx->db->getRow($rs)) { |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | return $result; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - function prepareCategoryArrays() { |
|
| 106 | - foreach($this->items as $type=>$items) { |
|
| 107 | - foreach((array)$items as $item) { |
|
| 105 | + function prepareCategoryArrays(){ |
|
| 106 | + foreach ($this->items as $type=>$items) { |
|
| 107 | + foreach ((array) $items as $item) { |
|
| 108 | 108 | $catid = $item['catid'] ? $item['catid'] : 0; |
| 109 | 109 | $this->categories[$catid] = $item['category']; |
| 110 | 110 | |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | natcasesort($this->categories); |
| 118 | 118 | |
| 119 | 119 | // Now sort by name |
| 120 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 121 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 120 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
| 121 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
| 122 | 122 | return strcasecmp($a['name'], $b['name']); |
| 123 | 123 | }); |
| 124 | 124 | } |
@@ -3,19 +3,22 @@ discard block |
||
| 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 | -class mgrResources { |
|
| 6 | +class mgrResources |
|
| 7 | +{ |
|
| 7 | 8 | var $types = array(); |
| 8 | 9 | var $items = array(); |
| 9 | 10 | var $categories = array(); |
| 10 | 11 | var $itemsPerCategory = array(); |
| 11 | 12 | |
| 12 | - function __construct() { |
|
| 13 | + function __construct() |
|
| 14 | + { |
|
| 13 | 15 | $this->setTypes(); |
| 14 | 16 | $this->queryItemsFromDB(); |
| 15 | 17 | $this->prepareCategoryArrays(); |
| 16 | 18 | } |
| 17 | 19 | |
| 18 | - function setTypes() { |
|
| 20 | + function setTypes() |
|
| 21 | + { |
|
| 19 | 22 | global $_lang; |
| 20 | 23 | $this->types['site_templates'] = array( |
| 21 | 24 | 'title'=>$_lang["manage_templates"], |
@@ -50,7 +53,8 @@ discard block |
||
| 50 | 53 | ); |
| 51 | 54 | } |
| 52 | 55 | |
| 53 | - function queryItemsFromDB() { |
|
| 56 | + function queryItemsFromDB() |
|
| 57 | + { |
|
| 54 | 58 | foreach($this->types as $resourceTable=>$type) { |
| 55 | 59 | if($this->hasAnyPermissions($type['permissions'])) { |
| 56 | 60 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
@@ -59,16 +63,19 @@ discard block |
||
| 59 | 63 | } |
| 60 | 64 | } |
| 61 | 65 | |
| 62 | - function hasAnyPermissions($permissions) { |
|
| 66 | + function hasAnyPermissions($permissions) |
|
| 67 | + { |
|
| 63 | 68 | global $modx; |
| 64 | 69 | |
| 65 | - foreach($permissions as $p) |
|
| 66 | - if($modx->hasPermission($p)) return true; |
|
| 70 | + foreach($permissions as $p) { |
|
| 71 | + if($modx->hasPermission($p)) return true; |
|
| 72 | + } |
|
| 67 | 73 | |
| 68 | 74 | return false; |
| 69 | 75 | } |
| 70 | 76 | |
| 71 | - function queryResources($resourceTable, $nameField = 'name') { |
|
| 77 | + function queryResources($resourceTable, $nameField = 'name') |
|
| 78 | + { |
|
| 72 | 79 | global $modx, $_lang; |
| 73 | 80 | |
| 74 | 81 | $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
@@ -79,8 +86,9 @@ discard block |
||
| 79 | 86 | $tvsql = 'site_tmplvars.caption, '; |
| 80 | 87 | $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
| 81 | 88 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
| 89 | + } else { |
|
| 90 | + $sttfield = ''; |
|
| 82 | 91 | } |
| 83 | - else $sttfield = ''; |
|
| 84 | 92 | |
| 85 | 93 | $selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
| 86 | 94 | |
@@ -93,7 +101,9 @@ discard block |
||
| 93 | 101 | ); |
| 94 | 102 | $limit = $modx->db->getRecordCount($rs); |
| 95 | 103 | |
| 96 | - if($limit < 1) return false; |
|
| 104 | + if($limit < 1) { |
|
| 105 | + return false; |
|
| 106 | + } |
|
| 97 | 107 | |
| 98 | 108 | $result = array(); |
| 99 | 109 | while ($row = $modx->db->getRow($rs)) { |
@@ -102,7 +112,8 @@ discard block |
||
| 102 | 112 | return $result; |
| 103 | 113 | } |
| 104 | 114 | |
| 105 | - function prepareCategoryArrays() { |
|
| 115 | + function prepareCategoryArrays() |
|
| 116 | + { |
|
| 106 | 117 | foreach($this->items as $type=>$items) { |
| 107 | 118 | foreach((array)$items as $item) { |
| 108 | 119 | $catid = $item['catid'] ? $item['catid'] : 0; |
@@ -118,7 +129,7 @@ discard block |
||
| 118 | 129 | |
| 119 | 130 | // Now sort by name |
| 120 | 131 | foreach($this->itemsPerCategory as $catid=>$items) { |
| 121 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 132 | + usort($this->itemsPerCategory[$catid], function ($a, $b){ |
|
| 122 | 133 | return strcasecmp($a['name'], $b['name']); |
| 123 | 134 | }); |
| 124 | 135 | } |