@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(IN_MANAGER_MODE != "true") { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | if(!$modx->hasPermission('edit_module')) { |
| 7 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -26,91 +26,91 @@ discard block |
||
| 26 | 26 | // check to see the editor isn't locked |
| 27 | 27 | $rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
| 28 | 28 | if($username = $modx->db->getValue($rs)) { |
| 29 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
| 29 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
| 30 | 30 | } |
| 31 | 31 | // end check for lock |
| 32 | 32 | |
| 33 | 33 | // take action |
| 34 | 34 | switch($_REQUEST['op']) { |
| 35 | - case 'add': |
|
| 36 | - // convert ids to numbers |
|
| 37 | - $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
| 38 | - |
|
| 39 | - if(count($opids) > 0) { |
|
| 40 | - // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
| 41 | - $rt = strtolower($_REQUEST["rt"]); |
|
| 42 | - if($rt == 'chunk') { |
|
| 43 | - $type = 10; |
|
| 44 | - } |
|
| 45 | - if($rt == 'doc') { |
|
| 46 | - $type = 20; |
|
| 47 | - } |
|
| 48 | - if($rt == 'plug') { |
|
| 49 | - $type = 30; |
|
| 50 | - } |
|
| 51 | - if($rt == 'snip') { |
|
| 52 | - $type = 40; |
|
| 53 | - } |
|
| 54 | - if($rt == 'tpl') { |
|
| 55 | - $type = 50; |
|
| 56 | - } |
|
| 57 | - if($rt == 'tv') { |
|
| 58 | - $type = 60; |
|
| 59 | - } |
|
| 60 | - $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
| 61 | - foreach($opids as $opid) { |
|
| 62 | - $modx->db->insert(array( |
|
| 63 | - 'module' => $id, |
|
| 64 | - 'resource' => $opid, |
|
| 65 | - 'type' => $type, |
|
| 66 | - ), $tbl_site_module_depobj); |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - break; |
|
| 70 | - case 'del': |
|
| 71 | - // convert ids to numbers |
|
| 72 | - $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
| 73 | - |
|
| 74 | - // get resources that needs to be removed |
|
| 75 | - $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
| 76 | - // loop through resources and look for plugins and snippets |
|
| 77 | - $plids = array(); |
|
| 78 | - $snid = array(); |
|
| 79 | - while($row = $modx->db->getRow($ds)) { |
|
| 80 | - if($row['type'] == '30') { |
|
| 81 | - $plids[$i] = $row['resource']; |
|
| 82 | - } |
|
| 83 | - if($row['type'] == '40') { |
|
| 84 | - $snids[$i] = $row['resource']; |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - // get guid |
|
| 88 | - $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
| 89 | - $guid = $modx->db->getValue($ds); |
|
| 90 | - // reset moduleguid for deleted resources |
|
| 91 | - if(($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | - if($cp) { |
|
| 93 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
| 94 | - } |
|
| 95 | - if($cs) { |
|
| 96 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
| 97 | - } |
|
| 98 | - // reset cache |
|
| 99 | - $modx->clearCache('full'); |
|
| 100 | - } |
|
| 101 | - $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
| 102 | - break; |
|
| 35 | + case 'add': |
|
| 36 | + // convert ids to numbers |
|
| 37 | + $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
| 38 | + |
|
| 39 | + if(count($opids) > 0) { |
|
| 40 | + // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
| 41 | + $rt = strtolower($_REQUEST["rt"]); |
|
| 42 | + if($rt == 'chunk') { |
|
| 43 | + $type = 10; |
|
| 44 | + } |
|
| 45 | + if($rt == 'doc') { |
|
| 46 | + $type = 20; |
|
| 47 | + } |
|
| 48 | + if($rt == 'plug') { |
|
| 49 | + $type = 30; |
|
| 50 | + } |
|
| 51 | + if($rt == 'snip') { |
|
| 52 | + $type = 40; |
|
| 53 | + } |
|
| 54 | + if($rt == 'tpl') { |
|
| 55 | + $type = 50; |
|
| 56 | + } |
|
| 57 | + if($rt == 'tv') { |
|
| 58 | + $type = 60; |
|
| 59 | + } |
|
| 60 | + $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
| 61 | + foreach($opids as $opid) { |
|
| 62 | + $modx->db->insert(array( |
|
| 63 | + 'module' => $id, |
|
| 64 | + 'resource' => $opid, |
|
| 65 | + 'type' => $type, |
|
| 66 | + ), $tbl_site_module_depobj); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + break; |
|
| 70 | + case 'del': |
|
| 71 | + // convert ids to numbers |
|
| 72 | + $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
| 73 | + |
|
| 74 | + // get resources that needs to be removed |
|
| 75 | + $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
| 76 | + // loop through resources and look for plugins and snippets |
|
| 77 | + $plids = array(); |
|
| 78 | + $snid = array(); |
|
| 79 | + while($row = $modx->db->getRow($ds)) { |
|
| 80 | + if($row['type'] == '30') { |
|
| 81 | + $plids[$i] = $row['resource']; |
|
| 82 | + } |
|
| 83 | + if($row['type'] == '40') { |
|
| 84 | + $snids[$i] = $row['resource']; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + // get guid |
|
| 88 | + $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
| 89 | + $guid = $modx->db->getValue($ds); |
|
| 90 | + // reset moduleguid for deleted resources |
|
| 91 | + if(($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | + if($cp) { |
|
| 93 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
| 94 | + } |
|
| 95 | + if($cs) { |
|
| 96 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
| 97 | + } |
|
| 98 | + // reset cache |
|
| 99 | + $modx->clearCache('full'); |
|
| 100 | + } |
|
| 101 | + $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
| 102 | + break; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // load record |
| 106 | 106 | $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'"); |
| 107 | 107 | $content = $modx->db->getRow($rs); |
| 108 | 108 | if(!$content) { |
| 109 | - $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
| 109 | + $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
| 110 | 110 | } |
| 111 | 111 | $_SESSION['itemname'] = $content['name']; |
| 112 | 112 | if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
| 113 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 113 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | ?> |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | <tr> |
| 204 | 204 | <td valign="top" align="left"> |
| 205 | 205 | <?php |
| 206 | - $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
| 206 | + $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
| 207 | 207 | CASE smd.type |
| 208 | 208 | WHEN 10 THEN 'Chunk' |
| 209 | 209 | WHEN 20 THEN 'Document' |
@@ -218,18 +218,18 @@ discard block |
||
| 218 | 218 | LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40' |
| 219 | 219 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50' |
| 220 | 220 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name"); |
| 221 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 222 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
| 223 | - $grd->noRecordMsg = $_lang["no_records_found"]; |
|
| 224 | - $grd->cssClass = "grid"; |
|
| 225 | - $grd->columnHeaderClass = "gridHeader"; |
|
| 226 | - $grd->itemClass = "gridItem"; |
|
| 227 | - $grd->altItemClass = "gridAltItem"; |
|
| 228 | - $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
| 229 | - $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
| 230 | - $grd->fields = "name,type"; |
|
| 231 | - echo $grd->render(); |
|
| 232 | - ?> |
|
| 221 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 222 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
| 223 | + $grd->noRecordMsg = $_lang["no_records_found"]; |
|
| 224 | + $grd->cssClass = "grid"; |
|
| 225 | + $grd->columnHeaderClass = "gridHeader"; |
|
| 226 | + $grd->itemClass = "gridItem"; |
|
| 227 | + $grd->altItemClass = "gridAltItem"; |
|
| 228 | + $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
| 229 | + $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
| 230 | + $grd->fields = "name,type"; |
|
| 231 | + echo $grd->render(); |
|
| 232 | + ?> |
|
| 233 | 233 | </td> |
| 234 | 234 | <td valign="top" style="width: 150px;"> |
| 235 | 235 | <a class="btn btn-block btn-danger text-left" style="margin-bottom:10px;" href="javascript:;" onclick="removeDependencies();return false;"><i class="<?php echo $_style["actions_delete"] ?>"></i> <?php echo $_lang['remove']; ?></a> |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(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 | 5 | |
| 6 | -if(!$modx->hasPermission('edit_module')) { |
|
| 6 | +if (!$modx->hasPermission('edit_module')) { |
|
| 7 | 7 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 8 | 8 | } |
| 9 | 9 | |
@@ -24,41 +24,41 @@ discard block |
||
| 24 | 24 | $modx->manager->initPageViewState(); |
| 25 | 25 | |
| 26 | 26 | // check to see the editor isn't locked |
| 27 | -$rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
|
| 28 | -if($username = $modx->db->getValue($rs)) { |
|
| 27 | +$rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
| 28 | +if ($username = $modx->db->getValue($rs)) { |
|
| 29 | 29 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
| 30 | 30 | } |
| 31 | 31 | // end check for lock |
| 32 | 32 | |
| 33 | 33 | // take action |
| 34 | -switch($_REQUEST['op']) { |
|
| 34 | +switch ($_REQUEST['op']) { |
|
| 35 | 35 | case 'add': |
| 36 | 36 | // convert ids to numbers |
| 37 | 37 | $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
| 38 | 38 | |
| 39 | - if(count($opids) > 0) { |
|
| 39 | + if (count($opids) > 0) { |
|
| 40 | 40 | // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
| 41 | 41 | $rt = strtolower($_REQUEST["rt"]); |
| 42 | - if($rt == 'chunk') { |
|
| 42 | + if ($rt == 'chunk') { |
|
| 43 | 43 | $type = 10; |
| 44 | 44 | } |
| 45 | - if($rt == 'doc') { |
|
| 45 | + if ($rt == 'doc') { |
|
| 46 | 46 | $type = 20; |
| 47 | 47 | } |
| 48 | - if($rt == 'plug') { |
|
| 48 | + if ($rt == 'plug') { |
|
| 49 | 49 | $type = 30; |
| 50 | 50 | } |
| 51 | - if($rt == 'snip') { |
|
| 51 | + if ($rt == 'snip') { |
|
| 52 | 52 | $type = 40; |
| 53 | 53 | } |
| 54 | - if($rt == 'tpl') { |
|
| 54 | + if ($rt == 'tpl') { |
|
| 55 | 55 | $type = 50; |
| 56 | 56 | } |
| 57 | - if($rt == 'tv') { |
|
| 57 | + if ($rt == 'tv') { |
|
| 58 | 58 | $type = 60; |
| 59 | 59 | } |
| 60 | - $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
| 61 | - foreach($opids as $opid) { |
|
| 60 | + $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (".implode(',', $opids).") AND type='{$type}'"); |
|
| 61 | + foreach ($opids as $opid) { |
|
| 62 | 62 | $modx->db->insert(array( |
| 63 | 63 | 'module' => $id, |
| 64 | 64 | 'resource' => $opid, |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
| 73 | 73 | |
| 74 | 74 | // get resources that needs to be removed |
| 75 | - $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
| 75 | + $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (".implode(",", $opids).")"); |
|
| 76 | 76 | // loop through resources and look for plugins and snippets |
| 77 | 77 | $plids = array(); |
| 78 | 78 | $snid = array(); |
| 79 | - while($row = $modx->db->getRow($ds)) { |
|
| 80 | - if($row['type'] == '30') { |
|
| 79 | + while ($row = $modx->db->getRow($ds)) { |
|
| 80 | + if ($row['type'] == '30') { |
|
| 81 | 81 | $plids[$i] = $row['resource']; |
| 82 | 82 | } |
| 83 | - if($row['type'] == '40') { |
|
| 83 | + if ($row['type'] == '40') { |
|
| 84 | 84 | $snids[$i] = $row['resource']; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -88,28 +88,28 @@ discard block |
||
| 88 | 88 | $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
| 89 | 89 | $guid = $modx->db->getValue($ds); |
| 90 | 90 | // reset moduleguid for deleted resources |
| 91 | - if(($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | - if($cp) { |
|
| 93 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
| 91 | + if (($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | + if ($cp) { |
|
| 93 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (".implode(',', $plids).") AND moduleguid='{$guid}'"); |
|
| 94 | 94 | } |
| 95 | - if($cs) { |
|
| 96 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
| 95 | + if ($cs) { |
|
| 96 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (".implode(',', $snids).") AND moduleguid='{$guid}'"); |
|
| 97 | 97 | } |
| 98 | 98 | // reset cache |
| 99 | 99 | $modx->clearCache('full'); |
| 100 | 100 | } |
| 101 | - $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
| 101 | + $modx->db->delete($tbl_site_module_depobj, "id IN (".implode(',', $opids).")"); |
|
| 102 | 102 | break; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // load record |
| 106 | 106 | $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'"); |
| 107 | 107 | $content = $modx->db->getRow($rs); |
| 108 | -if(!$content) { |
|
| 108 | +if (!$content) { |
|
| 109 | 109 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
| 110 | 110 | } |
| 111 | 111 | $_SESSION['itemname'] = $content['name']; |
| 112 | -if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 112 | +if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 113 | 113 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -188,13 +188,13 @@ discard block |
||
| 188 | 188 | <input type="hidden" name="id" value="<?php echo $content['id']; ?>" /> |
| 189 | 189 | |
| 190 | 190 | <h1> |
| 191 | - <i class="fa fa-cogs"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['module_resource_title']) ?> |
|
| 191 | + <i class="fa fa-cogs"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['module_resource_title']) ?> |
|
| 192 | 192 | </h1> |
| 193 | 193 | |
| 194 | 194 | <?php echo $_style['actionbuttons']['dynamic']['close'] ?> |
| 195 | 195 | |
| 196 | 196 | <div class="section"> |
| 197 | - <div class="sectionHeader"><?php echo $content["name"] . " - " . $_lang['module_resource_title']; ?></div> |
|
| 197 | + <div class="sectionHeader"><?php echo $content["name"]." - ".$_lang['module_resource_title']; ?></div> |
|
| 198 | 198 | <div class="sectionBody"> |
| 199 | 199 | <p><?php echo $_lang['module_resource_msg']; ?></p> |
| 200 | 200 | <br /> |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40' |
| 219 | 219 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50' |
| 220 | 220 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name"); |
| 221 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 221 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
| 222 | 222 | $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
| 223 | 223 | $grd->noRecordMsg = $_lang["no_records_found"]; |
| 224 | 224 | $grd->cssClass = "grid"; |
| 225 | 225 | $grd->columnHeaderClass = "gridHeader"; |
| 226 | 226 | $grd->itemClass = "gridItem"; |
| 227 | 227 | $grd->altItemClass = "gridAltItem"; |
| 228 | - $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
| 228 | + $grd->columns = $_lang["element_name"]." ,".$_lang["type"]; |
|
| 229 | 229 | $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
| 230 | 230 | $grd->fields = "name,type"; |
| 231 | 231 | echo $grd->render(); |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(IN_MANAGER_MODE != "true") { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('edit_template') && $modx->manager->action == '301') { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | if(!$modx->hasPermission('new_template') && $modx->manager->action == '300') { |
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | // check to see the snippet editor isn't locked |
| 22 | 22 | if($lockedEl = $modx->elementIsLocked(2, $id)) { |
| 23 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
|
| 23 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
|
| 24 | 24 | } |
| 25 | 25 | // end check for lock |
| 26 | 26 | |
@@ -30,25 +30,25 @@ discard block |
||
| 30 | 30 | global $content; |
| 31 | 31 | $content = array(); |
| 32 | 32 | if(isset($_GET['id'])) { |
| 33 | - $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
|
| 34 | - $content = $modx->db->getRow($rs); |
|
| 35 | - if(!$content) { |
|
| 36 | - header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - $_SESSION['itemname'] = $content['caption']; |
|
| 40 | - if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
| 41 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 42 | - } |
|
| 33 | + $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
|
| 34 | + $content = $modx->db->getRow($rs); |
|
| 35 | + if(!$content) { |
|
| 36 | + header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + $_SESSION['itemname'] = $content['caption']; |
|
| 40 | + if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
| 41 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 42 | + } |
|
| 43 | 43 | } else if(isset($_REQUEST['itemname'])) { |
| 44 | - $content['name'] = $_REQUEST['itemname']; |
|
| 44 | + $content['name'] = $_REQUEST['itemname']; |
|
| 45 | 45 | } else { |
| 46 | - $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
|
| 47 | - $content['category'] = intval($_REQUEST['catid']); |
|
| 46 | + $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
|
| 47 | + $content['category'] = intval($_REQUEST['catid']); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | if($modx->manager->hasFormValues()) { |
| 51 | - $modx->manager->loadFormValues(); |
|
| 51 | + $modx->manager->loadFormValues(); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $content = array_merge($content, $_POST); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $RTEditors = ''; |
| 63 | 63 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister', array('forfrontend' => 1)); |
| 64 | 64 | if(is_array($evtOut)) { |
| 65 | - $RTEditors = implode(',', $evtOut); |
|
| 65 | + $RTEditors = implode(',', $evtOut); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | ?> |
@@ -277,12 +277,12 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | <form name="mutate" method="post" action="index.php" enctype="multipart/form-data"> |
| 279 | 279 | <?php |
| 280 | - // invoke OnTVFormPrerender event |
|
| 281 | - $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
|
| 282 | - if(is_array($evtOut)) { |
|
| 283 | - echo implode("", $evtOut); |
|
| 284 | - } |
|
| 285 | - ?> |
|
| 280 | + // invoke OnTVFormPrerender event |
|
| 281 | + $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
|
| 282 | + if(is_array($evtOut)) { |
|
| 283 | + echo implode("", $evtOut); |
|
| 284 | + } |
|
| 285 | + ?> |
|
| 286 | 286 | <input type="hidden" name="id" value="<?= $content['id'] ?>"> |
| 287 | 287 | <input type="hidden" name="a" value="302"> |
| 288 | 288 | <input type="hidden" name="or" value="<?= $origin ?>"> |
@@ -343,11 +343,11 @@ discard block |
||
| 343 | 343 | <select name="categoryid" class="form-control" onChange="documentDirty=true;"> |
| 344 | 344 | <option> </option> |
| 345 | 345 | <?php |
| 346 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 347 | - foreach(getCategories() as $n => $v) { |
|
| 348 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
| 349 | - } |
|
| 350 | - ?> |
|
| 346 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 347 | + foreach(getCategories() as $n => $v) { |
|
| 348 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
| 349 | + } |
|
| 350 | + ?> |
|
| 351 | 351 | </select> |
| 352 | 352 | </div> |
| 353 | 353 | </div> |
@@ -383,14 +383,14 @@ discard block |
||
| 383 | 383 | <optgroup label="Custom Type"> |
| 384 | 384 | <option value="custom_tv" <?= ($content['type'] == 'custom_tv' ? "selected='selected'" : "") ?>>Custom Input</option> |
| 385 | 385 | <?php |
| 386 | - $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
| 387 | - foreach($custom_tvs as $ctv) { |
|
| 388 | - if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
| 389 | - $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
| 390 | - echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
| 391 | - } |
|
| 392 | - } |
|
| 393 | - ?> |
|
| 386 | + $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
| 387 | + foreach($custom_tvs as $ctv) { |
|
| 388 | + if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
| 389 | + $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
| 390 | + echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
| 391 | + } |
|
| 392 | + } |
|
| 393 | + ?> |
|
| 394 | 394 | </optgroup> |
| 395 | 395 | </select> |
| 396 | 396 | </div> |
@@ -455,63 +455,63 @@ discard block |
||
| 455 | 455 | <a class="btn btn-secondary btn-sm" href="javascript:;" onClick="check_toggle(); return false;"><?= $_lang['check_toggle'] ?></a> |
| 456 | 456 | </div> |
| 457 | 457 | <?php |
| 458 | - $rs = $modx->db->select(sprintf("tpl.id AS id, templatename, tpl.description AS tpldescription, tpl.locked AS tpllocked, tpl.selectable AS selectable, tmplvarid, if(isnull(cat.category),'%s',cat.category) AS category, cat.id AS catid", $_lang['no_category']), sprintf("%s as tpl |
|
| 458 | + $rs = $modx->db->select(sprintf("tpl.id AS id, templatename, tpl.description AS tpldescription, tpl.locked AS tpllocked, tpl.selectable AS selectable, tmplvarid, if(isnull(cat.category),'%s',cat.category) AS category, cat.id AS catid", $_lang['no_category']), sprintf("%s as tpl |
|
| 459 | 459 | LEFT JOIN %s as stt ON stt.templateid=tpl.id AND stt.tmplvarid='%s' |
| 460 | 460 | LEFT JOIN %s as cat ON tpl.category=cat.id", $modx->getFullTableName('site_templates'), $modx->getFullTableName('site_tmplvar_templates'), $id, $modx->getFullTableName('categories')), '', "category, templatename"); |
| 461 | 461 | |
| 462 | - $tplList = '<ul>'; |
|
| 463 | - $preCat = ''; |
|
| 464 | - $insideUl = 0; |
|
| 465 | - while($row = $modx->db->getRow($rs)) { |
|
| 466 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
| 467 | - if($preCat !== $row['category']) { |
|
| 468 | - $tplList .= $insideUl ? '</ul>' : ''; |
|
| 469 | - $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
| 470 | - $insideUl = 1; |
|
| 471 | - } |
|
| 472 | - |
|
| 473 | - if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
| 474 | - $checked = true; |
|
| 475 | - } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
| 476 | - $checked = true; |
|
| 477 | - } elseif($id == 0 && is_array($_POST['template'])) { |
|
| 478 | - $checked = in_array($row['id'], $_POST['template']); |
|
| 479 | - } else { |
|
| 480 | - $checked = $row['tmplvarid']; |
|
| 481 | - } |
|
| 482 | - $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
|
| 483 | - $checked = $checked ? ' checked="checked"' : ''; |
|
| 484 | - $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
| 485 | - $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
| 486 | - |
|
| 487 | - $tplInfo = array(); |
|
| 488 | - if($row['tpllocked']) { |
|
| 489 | - $tplInfo[] = $_lang['locked']; |
|
| 490 | - } |
|
| 491 | - if($row['id'] == $modx->config['default_template']) { |
|
| 492 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
| 493 | - } |
|
| 494 | - $tplInfo = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : ''; |
|
| 495 | - |
|
| 496 | - $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
|
| 497 | - $tplList .= '</li>'; |
|
| 498 | - |
|
| 499 | - $preCat = $row['category']; |
|
| 500 | - } |
|
| 501 | - $tplList .= $insideUl ? '</ul>' : ''; |
|
| 502 | - $tplList .= '</ul>'; |
|
| 503 | - echo $tplList; |
|
| 504 | - |
|
| 505 | - ?> |
|
| 462 | + $tplList = '<ul>'; |
|
| 463 | + $preCat = ''; |
|
| 464 | + $insideUl = 0; |
|
| 465 | + while($row = $modx->db->getRow($rs)) { |
|
| 466 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
| 467 | + if($preCat !== $row['category']) { |
|
| 468 | + $tplList .= $insideUl ? '</ul>' : ''; |
|
| 469 | + $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
| 470 | + $insideUl = 1; |
|
| 471 | + } |
|
| 472 | + |
|
| 473 | + if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
| 474 | + $checked = true; |
|
| 475 | + } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
| 476 | + $checked = true; |
|
| 477 | + } elseif($id == 0 && is_array($_POST['template'])) { |
|
| 478 | + $checked = in_array($row['id'], $_POST['template']); |
|
| 479 | + } else { |
|
| 480 | + $checked = $row['tmplvarid']; |
|
| 481 | + } |
|
| 482 | + $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
|
| 483 | + $checked = $checked ? ' checked="checked"' : ''; |
|
| 484 | + $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
| 485 | + $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
| 486 | + |
|
| 487 | + $tplInfo = array(); |
|
| 488 | + if($row['tpllocked']) { |
|
| 489 | + $tplInfo[] = $_lang['locked']; |
|
| 490 | + } |
|
| 491 | + if($row['id'] == $modx->config['default_template']) { |
|
| 492 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
| 493 | + } |
|
| 494 | + $tplInfo = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : ''; |
|
| 495 | + |
|
| 496 | + $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
|
| 497 | + $tplList .= '</li>'; |
|
| 498 | + |
|
| 499 | + $preCat = $row['category']; |
|
| 500 | + } |
|
| 501 | + $tplList .= $insideUl ? '</ul>' : ''; |
|
| 502 | + $tplList .= '</ul>'; |
|
| 503 | + echo $tplList; |
|
| 504 | + |
|
| 505 | + ?> |
|
| 506 | 506 | |
| 507 | 507 | <!-- Access Permissions --> |
| 508 | 508 | <?php |
| 509 | - if($use_udperms == 1) { |
|
| 510 | - // fetch permissions for the variable |
|
| 511 | - $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
|
| 512 | - $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
|
| 509 | + if($use_udperms == 1) { |
|
| 510 | + // fetch permissions for the variable |
|
| 511 | + $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
|
| 512 | + $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
|
| 513 | 513 | |
| 514 | - ?> |
|
| 514 | + ?> |
|
| 515 | 515 | <?php if($modx->hasPermission('access_permissions')) { ?> |
| 516 | 516 | <script type="text/javascript"> |
| 517 | 517 | function makePublic(b) { |
@@ -539,29 +539,29 @@ discard block |
||
| 539 | 539 | <!--<b><?php /*echo $_lang['access_permissions']; */ ?></b>--> |
| 540 | 540 | <p><?= $_lang['tmplvar_access_msg'] ?></p> |
| 541 | 541 | <?php |
| 542 | - $chk = ''; |
|
| 543 | - $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
|
| 544 | - if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
| 545 | - $groupsarray = $_POST['docgroups']; |
|
| 546 | - } |
|
| 547 | - while($row = $modx->db->getRow($rs)) { |
|
| 548 | - $checked = in_array($row['id'], $groupsarray); |
|
| 549 | - if($modx->hasPermission('access_permissions')) { |
|
| 550 | - if($checked) { |
|
| 551 | - $notPublic = true; |
|
| 552 | - } |
|
| 553 | - $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
| 554 | - } else { |
|
| 555 | - if($checked) { |
|
| 556 | - echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
| 557 | - } |
|
| 558 | - } |
|
| 559 | - } |
|
| 560 | - if($modx->hasPermission('access_permissions')) { |
|
| 561 | - $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
| 562 | - } |
|
| 563 | - echo '<ul>' . $chks . '</ul>'; |
|
| 564 | - ?> |
|
| 542 | + $chk = ''; |
|
| 543 | + $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
|
| 544 | + if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
| 545 | + $groupsarray = $_POST['docgroups']; |
|
| 546 | + } |
|
| 547 | + while($row = $modx->db->getRow($rs)) { |
|
| 548 | + $checked = in_array($row['id'], $groupsarray); |
|
| 549 | + if($modx->hasPermission('access_permissions')) { |
|
| 550 | + if($checked) { |
|
| 551 | + $notPublic = true; |
|
| 552 | + } |
|
| 553 | + $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
| 554 | + } else { |
|
| 555 | + if($checked) { |
|
| 556 | + echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
| 557 | + } |
|
| 558 | + } |
|
| 559 | + } |
|
| 560 | + if($modx->hasPermission('access_permissions')) { |
|
| 561 | + $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
| 562 | + } |
|
| 563 | + echo '<ul>' . $chks . '</ul>'; |
|
| 564 | + ?> |
|
| 565 | 565 | <?php } ?> |
| 566 | 566 | <?php } ?> |
| 567 | 567 | |
@@ -571,12 +571,12 @@ discard block |
||
| 571 | 571 | <input type="submit" name="save" style="display:none"> |
| 572 | 572 | |
| 573 | 573 | <?php |
| 574 | - // invoke OnTVFormRender event |
|
| 575 | - $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
|
| 576 | - if(is_array($evtOut)) { |
|
| 577 | - echo implode('', $evtOut); |
|
| 578 | - } |
|
| 579 | - ?> |
|
| 574 | + // invoke OnTVFormRender event |
|
| 575 | + $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
|
| 576 | + if(is_array($evtOut)) { |
|
| 577 | + echo implode('', $evtOut); |
|
| 578 | + } |
|
| 579 | + ?> |
|
| 580 | 580 | </div> |
| 581 | 581 | </form> |
| 582 | 582 | <script type="text/javascript">setTimeout('showParameters()', 10);</script> |
@@ -1,11 +1,11 @@ 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_template') && $modx->manager->action == '301') { |
|
| 5 | +if (!$modx->hasPermission('edit_template') && $modx->manager->action == '301') { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | -if(!$modx->hasPermission('new_template') && $modx->manager->action == '300') { |
|
| 8 | +if (!$modx->hasPermission('new_template') && $modx->manager->action == '300') { |
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 10 | 10 | } |
| 11 | 11 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $tbl_documentgroup_names = $modx->getFullTableName('documentgroup_names'); |
| 20 | 20 | |
| 21 | 21 | // check to see the snippet editor isn't locked |
| 22 | -if($lockedEl = $modx->elementIsLocked(2, $id)) { |
|
| 22 | +if ($lockedEl = $modx->elementIsLocked(2, $id)) { |
|
| 23 | 23 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
| 24 | 24 | } |
| 25 | 25 | // end check for lock |
@@ -29,25 +29,25 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | global $content; |
| 31 | 31 | $content = array(); |
| 32 | -if(isset($_GET['id'])) { |
|
| 32 | +if (isset($_GET['id'])) { |
|
| 33 | 33 | $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
| 34 | 34 | $content = $modx->db->getRow($rs); |
| 35 | - if(!$content) { |
|
| 36 | - header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
| 35 | + if (!$content) { |
|
| 36 | + header("Location: ".MODX_SITE_URL."index.php?id={$site_start}"); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $_SESSION['itemname'] = $content['caption']; |
| 40 | - if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
| 40 | + if ($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
| 41 | 41 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 42 | 42 | } |
| 43 | -} else if(isset($_REQUEST['itemname'])) { |
|
| 43 | +} else if (isset($_REQUEST['itemname'])) { |
|
| 44 | 44 | $content['name'] = $_REQUEST['itemname']; |
| 45 | 45 | } else { |
| 46 | 46 | $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
| 47 | 47 | $content['category'] = intval($_REQUEST['catid']); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -if($modx->manager->hasFormValues()) { |
|
| 50 | +if ($modx->manager->hasFormValues()) { |
|
| 51 | 51 | $modx->manager->loadFormValues(); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | // Add lock-element JS-Script |
| 57 | 57 | $lockElementId = $id; |
| 58 | 58 | $lockElementType = 2; |
| 59 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
| 59 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
| 60 | 60 | |
| 61 | 61 | // get available RichText Editors |
| 62 | 62 | $RTEditors = ''; |
| 63 | 63 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister', array('forfrontend' => 1)); |
| 64 | -if(is_array($evtOut)) { |
|
| 64 | +if (is_array($evtOut)) { |
|
| 65 | 65 | $RTEditors = implode(',', $evtOut); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | }, |
| 108 | 108 | cancel: function() { |
| 109 | 109 | documentDirty = false; |
| 110 | - document.location.href = 'index.php?a=<?= $origin ?><?=($originId != NULL ? '&id=' . $originId : '') ?>'; |
|
| 110 | + document.location.href = 'index.php?a=<?= $origin ?><?=($originId != NULL ? '&id='.$originId : '') ?>'; |
|
| 111 | 111 | } |
| 112 | 112 | }; |
| 113 | 113 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | <?php |
| 280 | 280 | // invoke OnTVFormPrerender event |
| 281 | 281 | $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
| 282 | - if(is_array($evtOut)) { |
|
| 282 | + if (is_array($evtOut)) { |
|
| 283 | 283 | echo implode("", $evtOut); |
| 284 | 284 | } |
| 285 | 285 | ?> |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | <input type="hidden" name="params" value="<?= $modx->htmlspecialchars($content['display_params']) ?>"> |
| 292 | 292 | |
| 293 | 293 | <h1> |
| 294 | - <i class="fa fa-list-alt"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_tmplvars']) ?><i class="fa fa-question-circle help"></i> |
|
| 294 | + <i class="fa fa-list-alt"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_tmplvars']) ?><i class="fa fa-question-circle help"></i> |
|
| 295 | 295 | </h1> |
| 296 | 296 | |
| 297 | 297 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | <div class="col-md-9 col-lg-10"> |
| 315 | 315 | <div class="form-control-name clearfix"> |
| 316 | 316 | <input name="name" type="text" maxlength="50" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
| 317 | - <?php if($modx->hasPermission('save_role')): ?> |
|
| 318 | - <label class="custom-control" title="<?= $_lang['lock_tmplvars'] . "\n" . $_lang['lock_tmplvars_msg'] ?>" tooltip> |
|
| 317 | + <?php if ($modx->hasPermission('save_role')): ?> |
|
| 318 | + <label class="custom-control" title="<?= $_lang['lock_tmplvars']."\n".$_lang['lock_tmplvars_msg'] ?>" tooltip> |
|
| 319 | 319 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
| 320 | 320 | <i class="fa fa-lock"></i> |
| 321 | 321 | </label> |
@@ -343,9 +343,9 @@ discard block |
||
| 343 | 343 | <select name="categoryid" class="form-control" onChange="documentDirty=true;"> |
| 344 | 344 | <option> </option> |
| 345 | 345 | <?php |
| 346 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 347 | - foreach(getCategories() as $n => $v) { |
|
| 348 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
| 346 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 347 | + foreach (getCategories() as $n => $v) { |
|
| 348 | + echo "<option value='".$v['id']."'".($content["category"] == $v["id"] ? " selected='selected'" : "").">".$modx->htmlspecialchars($v["category"])."</option>"; |
|
| 349 | 349 | } |
| 350 | 350 | ?> |
| 351 | 351 | </select> |
@@ -383,11 +383,11 @@ discard block |
||
| 383 | 383 | <optgroup label="Custom Type"> |
| 384 | 384 | <option value="custom_tv" <?= ($content['type'] == 'custom_tv' ? "selected='selected'" : "") ?>>Custom Input</option> |
| 385 | 385 | <?php |
| 386 | - $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
| 387 | - foreach($custom_tvs as $ctv) { |
|
| 388 | - if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
| 389 | - $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
| 390 | - echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
| 386 | + $custom_tvs = scandir(MODX_BASE_PATH.'assets/tvs'); |
|
| 387 | + foreach ($custom_tvs as $ctv) { |
|
| 388 | + if (strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
| 389 | + $selected = ($content['type'] == 'custom_tv:'.$ctv ? "selected='selected'" : ""); |
|
| 390 | + echo '<option value="custom_tv:'.$ctv.'" '.$selected.'>'.$ctv.'</option>'; |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | ?> |
@@ -462,36 +462,36 @@ discard block |
||
| 462 | 462 | $tplList = '<ul>'; |
| 463 | 463 | $preCat = ''; |
| 464 | 464 | $insideUl = 0; |
| 465 | - while($row = $modx->db->getRow($rs)) { |
|
| 465 | + while ($row = $modx->db->getRow($rs)) { |
|
| 466 | 466 | $row['category'] = stripslashes($row['category']); //pixelchutes |
| 467 | - if($preCat !== $row['category']) { |
|
| 467 | + if ($preCat !== $row['category']) { |
|
| 468 | 468 | $tplList .= $insideUl ? '</ul>' : ''; |
| 469 | - $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
| 469 | + $tplList .= '<li><strong>'.$row['category'].($row['catid'] != '' ? ' <small>('.$row['catid'].')</small>' : '').'</strong><ul>'; |
|
| 470 | 470 | $insideUl = 1; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
| 473 | + if ($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
| 474 | 474 | $checked = true; |
| 475 | - } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
| 475 | + } elseif (isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
| 476 | 476 | $checked = true; |
| 477 | - } elseif($id == 0 && is_array($_POST['template'])) { |
|
| 477 | + } elseif ($id == 0 && is_array($_POST['template'])) { |
|
| 478 | 478 | $checked = in_array($row['id'], $_POST['template']); |
| 479 | 479 | } else { |
| 480 | 480 | $checked = $row['tmplvarid']; |
| 481 | 481 | } |
| 482 | 482 | $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
| 483 | 483 | $checked = $checked ? ' checked="checked"' : ''; |
| 484 | - $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
| 485 | - $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
| 484 | + $tplId = ' <small>('.$row['id'].')</small>'; |
|
| 485 | + $desc = !empty($row['tpldescription']) ? ' - '.$row['tpldescription'] : ''; |
|
| 486 | 486 | |
| 487 | 487 | $tplInfo = array(); |
| 488 | - if($row['tpllocked']) { |
|
| 488 | + if ($row['tpllocked']) { |
|
| 489 | 489 | $tplInfo[] = $_lang['locked']; |
| 490 | 490 | } |
| 491 | - if($row['id'] == $modx->config['default_template']) { |
|
| 491 | + if ($row['id'] == $modx->config['default_template']) { |
|
| 492 | 492 | $tplInfo[] = $_lang['defaulttemplate_title']; |
| 493 | 493 | } |
| 494 | - $tplInfo = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : ''; |
|
| 494 | + $tplInfo = !empty($tplInfo) ? ' <em>('.join(', ', $tplInfo).')</em>' : ''; |
|
| 495 | 495 | |
| 496 | 496 | $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
| 497 | 497 | $tplList .= '</li>'; |
@@ -506,13 +506,13 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | <!-- Access Permissions --> |
| 508 | 508 | <?php |
| 509 | - if($use_udperms == 1) { |
|
| 509 | + if ($use_udperms == 1) { |
|
| 510 | 510 | // fetch permissions for the variable |
| 511 | 511 | $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
| 512 | 512 | $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
| 513 | 513 | |
| 514 | 514 | ?> |
| 515 | - <?php if($modx->hasPermission('access_permissions')) { ?> |
|
| 515 | + <?php if ($modx->hasPermission('access_permissions')) { ?> |
|
| 516 | 516 | <script type="text/javascript"> |
| 517 | 517 | function makePublic(b) { |
| 518 | 518 | var notPublic = false; |
@@ -541,26 +541,26 @@ discard block |
||
| 541 | 541 | <?php |
| 542 | 542 | $chk = ''; |
| 543 | 543 | $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
| 544 | - if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
| 544 | + if (empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
| 545 | 545 | $groupsarray = $_POST['docgroups']; |
| 546 | 546 | } |
| 547 | - while($row = $modx->db->getRow($rs)) { |
|
| 547 | + while ($row = $modx->db->getRow($rs)) { |
|
| 548 | 548 | $checked = in_array($row['id'], $groupsarray); |
| 549 | - if($modx->hasPermission('access_permissions')) { |
|
| 550 | - if($checked) { |
|
| 549 | + if ($modx->hasPermission('access_permissions')) { |
|
| 550 | + if ($checked) { |
|
| 551 | 551 | $notPublic = true; |
| 552 | 552 | } |
| 553 | - $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
| 553 | + $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='".$row['id']."' ".($checked ? "checked='checked'" : '')." onclick=\"makePublic(false)\" /> ".$row['name']."</label></li>"; |
|
| 554 | 554 | } else { |
| 555 | - if($checked) { |
|
| 556 | - echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
| 555 | + if ($checked) { |
|
| 556 | + echo "<input type='hidden' name='docgroups[]' value='".$row['id']."' />"; |
|
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | - if($modx->hasPermission('access_permissions')) { |
|
| 561 | - $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
| 560 | + if ($modx->hasPermission('access_permissions')) { |
|
| 561 | + $chks = "<li><label><input type='checkbox' name='chkalldocs' ".(!$notPublic ? "checked='checked'" : '')." onclick=\"makePublic(true)\" /> <span class='warning'>".$_lang['all_doc_groups']."</span></label></li>".$chks; |
|
| 562 | 562 | } |
| 563 | - echo '<ul>' . $chks . '</ul>'; |
|
| 563 | + echo '<ul>'.$chks.'</ul>'; |
|
| 564 | 564 | ?> |
| 565 | 565 | <?php } ?> |
| 566 | 566 | <?php } ?> |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | <?php |
| 574 | 574 | // invoke OnTVFormRender event |
| 575 | 575 | $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
| 576 | - if(is_array($evtOut)) { |
|
| 576 | + if (is_array($evtOut)) { |
|
| 577 | 577 | echo implode('', $evtOut); |
| 578 | 578 | } |
| 579 | 579 | ?> |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
| 13 | 13 | $origin = isset($_REQUEST['or']) ? intval($_REQUEST['or']) : 76; |
| 14 | -$originId = isset($_REQUEST['oid']) ? intval($_REQUEST['oid']) : NULL; |
|
| 14 | +$originId = isset($_REQUEST['oid']) ? intval($_REQUEST['oid']) : null; |
|
| 15 | 15 | |
| 16 | 16 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
| 17 | 17 | $tbl_site_templates = $modx->getFullTableName('site_templates'); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | }, |
| 108 | 108 | cancel: function() { |
| 109 | 109 | documentDirty = false; |
| 110 | - document.location.href = 'index.php?a=<?= $origin ?><?=($originId != NULL ? '&id=' . $originId : '') ?>'; |
|
| 110 | + document.location.href = 'index.php?a=<?= $origin ?><?=($originId != null ? '&id=' . $originId : '') ?>'; |
|
| 111 | 111 | } |
| 112 | 112 | }; |
| 113 | 113 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $updateMsg = ''; |
| 16 | 16 | |
| 17 | 17 | if (isset($_POST['listSubmitted'])) { |
| 18 | - $updateMsg .= '<span class="text-success" id="updated">' . $_lang['sort_updated'] . '</span>'; |
|
| 18 | + $updateMsg .= '<span class="text-success" id="updated">'.$_lang['sort_updated'].'</span>'; |
|
| 19 | 19 | foreach ($_POST as $listName => $listValue) { |
| 20 | 20 | if ($listName == 'listSubmitted' || $listName == 'reset') { |
| 21 | 21 | continue; |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | $sortableList = '<div class="clearfix"><ul id="sortlist" class="sortableList">'; |
| 41 | 41 | while ($row = $modx->db->getRow($rs)) { |
| 42 | 42 | $caption = $row['caption'] != '' ? $row['caption'] : $row['name']; |
| 43 | - $sortableList .= '<li id="item_' . $row['id'] . '"><i class="fa fa-list-alt"></i> ' . $caption . ' <small class="protectedNode" style="float:right">[*' . $row['name'] . '*]</small></li>'; |
|
| 43 | + $sortableList .= '<li id="item_'.$row['id'].'"><i class="fa fa-list-alt"></i> '.$caption.' <small class="protectedNode" style="float:right">[*'.$row['name'].'*]</small></li>'; |
|
| 44 | 44 | } |
| 45 | 45 | $sortableList .= '</ul></div>'; |
| 46 | 46 | } else { |
| 47 | - $updateMsg = '<p class="text-danger">' . $_lang['tmplvars_novars'] . '</p>'; |
|
| 47 | + $updateMsg = '<p class="text-danger">'.$_lang['tmplvars_novars'].'</p>'; |
|
| 48 | 48 | } |
| 49 | 49 | ?> |
| 50 | 50 | |
@@ -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["run_module"], "js:menuAction(1)", $_style['actions_run'], (!$modx->hasPermission('exec_module') ? 1 : 0));
|
| 31 | 31 | if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) {
|
@@ -108,24 +108,24 @@ discard block |
||
| 108 | 108 | <div class="table-responsive"> |
| 109 | 109 | <?php |
| 110 | 110 | if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
|
| 111 | - $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.description, mg.member, IF(disabled,"' . $_lang['yes'] . '","-") as disabled, IF(sm.icon<>"",sm.icon,"' . $_style['icons_modules'] . '") as icon
|
|
| 112 | - FROM ' . $modx->getFullTableName('site_modules') . ' AS sm
|
|
| 113 | - LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
|
|
| 114 | - LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
|
|
| 115 | - WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1 |
|
| 111 | + $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.description, mg.member, IF(disabled,"'.$_lang['yes'].'","-") as disabled, IF(sm.icon<>"",sm.icon,"'.$_style['icons_modules'].'") as icon
|
|
| 112 | + FROM ' . $modx->getFullTableName('site_modules').' AS sm
|
|
| 113 | + LEFT JOIN ' . $modx->getFullTableName('site_module_access').' AS sma ON sma.module = sm.id
|
|
| 114 | + LEFT JOIN ' . $modx->getFullTableName('member_groups').' AS mg ON sma.usergroup = mg.user_group
|
|
| 115 | + WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID().') AND sm.disabled != 1 AND sm.locked != 1 |
|
| 116 | 116 | ORDER BY sm.name'); |
| 117 | 117 | if ($modx->hasPermission('edit_module')) {
|
| 118 | - $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>"; |
|
| 118 | + $title = "<a href='index.php?a=108&id=[+id+]' title='".$_lang["module_edit_click_title"]."'>[+value+]</a>"; |
|
| 119 | 119 | } else if ($modx->hasPermission('exec_module')) {
|
| 120 | - $title = "<a href='index.php?a=112&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>"; |
|
| 120 | + $title = "<a href='index.php?a=112&id=[+id+]' title='".$_lang["module_edit_click_title"]."'>[+value+]</a>"; |
|
| 121 | 121 | } else {
|
| 122 | 122 | $title = '[+value+]'; |
| 123 | 123 | } |
| 124 | 124 | } else {
|
| 125 | 125 | $rs = $modx->db->select("id, name, description, IF(locked,'{$_lang['yes']}','-') as locked, IF(disabled,'{$_lang['yes']}','-') as disabled, IF(icon<>'',icon,'{$_style['icons_module']}') as icon", $modx->getFullTableName("site_modules"), (!empty($sqlQuery) ? "(name LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "name");
|
| 126 | - $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>"; |
|
| 126 | + $title = "<a href='index.php?a=108&id=[+id+]' title='".$_lang["module_edit_click_title"]."'>[+value+]</a>"; |
|
| 127 | 127 | } |
| 128 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 128 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
| 129 | 129 | $grd = new DataGrid('', $rs, $number_of_results); // set page size to 0 t show all items
|
| 130 | 130 | $grd->noRecordMsg = $_lang["no_records_found"]; |
| 131 | 131 | $grd->cssClass = "table data"; |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | $grd->itemClass = "tableItem"; |
| 134 | 134 | $grd->altItemClass = "tableAltItem"; |
| 135 | 135 | $grd->fields = "icon,name,description,locked,disabled"; |
| 136 | - $grd->columns = $_lang["icon"] . " ," . $_lang["name"] . " ," . $_lang["description"] . " ," . $_lang["locked"] . " ," . $_lang["disabled"]; |
|
| 136 | + $grd->columns = $_lang["icon"]." ,".$_lang["name"]." ,".$_lang["description"]." ,".$_lang["locked"]." ,".$_lang["disabled"]; |
|
| 137 | 137 | $grd->colWidths = "34,,,60,60"; |
| 138 | 138 | $grd->colAligns = "center,,,center,center"; |
| 139 | - $grd->colTypes = "template:<a class='tableRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='[+value+]'></i></a>||template:" . $title; |
|
| 139 | + $grd->colTypes = "template:<a class='tableRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='".$_lang["click_to_context"]."'><i class='[+value+]'></i></a>||template:".$title; |
|
| 140 | 140 | if ($listmode == '1') {
|
| 141 | 141 | $grd->pageSize = 0; |
| 142 | 142 | } |
@@ -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('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) {
|
|
| 5 | +if (!($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -10,10 +10,10 @@ 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 | -} else {
|
|
| 16 | +} else { |
|
| 17 | 17 | $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
| 18 | 18 | $sqlQuery = $modx->db->escape($query); |
| 19 | 19 | $_PAGE['vs']['search'] = $query; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | include_once MODX_MANAGER_PATH . "includes/controls/contextmenu.php"; |
| 29 | 29 | $cm = new ContextMenu("cntxm", 150);
|
| 30 | 30 | $cm->addItem($_lang["run_module"], "js:menuAction(1)", $_style['actions_run'], (!$modx->hasPermission('exec_module') ? 1 : 0));
|
| 31 | -if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) {
|
|
| 31 | +if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) { |
|
| 32 | 32 | $cm->addSeparator(); |
| 33 | 33 | } |
| 34 | 34 | $cm->addItem($_lang["edit"], "js:menuAction(2)", $_style['actions_edit'], (!$modx->hasPermission('edit_module') ? 1 : 0));
|
@@ -107,21 +107,21 @@ discard block |
||
| 107 | 107 | <div class="tab-page"> |
| 108 | 108 | <div class="table-responsive"> |
| 109 | 109 | <?php |
| 110 | - if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
|
|
| 110 | + if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
| 111 | 111 | $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.description, mg.member, IF(disabled,"' . $_lang['yes'] . '","-") as disabled, IF(sm.icon<>"",sm.icon,"' . $_style['icons_modules'] . '") as icon
|
| 112 | 112 | FROM ' . $modx->getFullTableName('site_modules') . ' AS sm
|
| 113 | 113 | LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
|
| 114 | 114 | LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
|
| 115 | 115 | WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1 |
| 116 | 116 | ORDER BY sm.name'); |
| 117 | - if ($modx->hasPermission('edit_module')) {
|
|
| 117 | + if ($modx->hasPermission('edit_module')) { |
|
| 118 | 118 | $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>"; |
| 119 | - } else if ($modx->hasPermission('exec_module')) {
|
|
| 119 | + } else if ($modx->hasPermission('exec_module')) { |
|
| 120 | 120 | $title = "<a href='index.php?a=112&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>"; |
| 121 | - } else {
|
|
| 121 | + } else { |
|
| 122 | 122 | $title = '[+value+]'; |
| 123 | 123 | } |
| 124 | - } else {
|
|
| 124 | + } else { |
|
| 125 | 125 | $rs = $modx->db->select("id, name, description, IF(locked,'{$_lang['yes']}','-') as locked, IF(disabled,'{$_lang['yes']}','-') as disabled, IF(icon<>'',icon,'{$_style['icons_module']}') as icon", $modx->getFullTableName("site_modules"), (!empty($sqlQuery) ? "(name LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "name");
|
| 126 | 126 | $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>"; |
| 127 | 127 | } |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | $grd->colWidths = "34,,,60,60"; |
| 138 | 138 | $grd->colAligns = "center,,,center,center"; |
| 139 | 139 | $grd->colTypes = "template:<a class='tableRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='[+value+]'></i></a>||template:" . $title; |
| 140 | - if ($listmode == '1') {
|
|
| 140 | + if ($listmode == '1') { |
|
| 141 | 141 | $grd->pageSize = 0; |
| 142 | 142 | } |
| 143 | - if ($_REQUEST['op'] == 'reset') {
|
|
| 143 | + if ($_REQUEST['op'] == 'reset') { |
|
| 144 | 144 | $grd->pageNumber = 1; |
| 145 | 145 | } |
| 146 | 146 | // render grid |
@@ -1,240 +1,240 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if(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 | - $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
| 33 | - |
|
| 34 | - if(!$items) {
|
|
| 35 | - return $_lang['no_results']; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - // Prepare elements- and categories-list |
|
| 39 | - $elements = array(); |
|
| 40 | - $categories = array(); |
|
| 41 | - foreach($items as $row) {
|
|
| 42 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 43 | - $categories[$catid] = array('name' => stripslashes($row['category']));
|
|
| 44 | - $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - // Now render categories / panel-collapse |
|
| 48 | - $panelGroup = ''; |
|
| 49 | - foreach($elements as $catid => $elList) {
|
|
| 50 | - // Add panel-heading / category-collapse to output |
|
| 51 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 52 | - 'tab' => $resourceTable, |
|
| 53 | - 'category' => $categories[$catid]['name'], |
|
| 54 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 55 | - 'catid' => $catid, |
|
| 56 | - )); |
|
| 57 | - |
|
| 58 | - // Prepare content for panel-collapse |
|
| 59 | - $panelCollapse = ''; |
|
| 60 | - foreach($elList as $el) {
|
|
| 61 | - $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - // Add panel-collapse with elements to output |
|
| 65 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 66 | - 'tab' => $resourceTable, |
|
| 67 | - 'catid' => $catid, |
|
| 68 | - 'wrapper' => $panelCollapse, |
|
| 69 | - )); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - return parsePh($tpl['panelGroup'], array( |
|
| 73 | - 'resourceTable' => $resourceTable, |
|
| 74 | - 'wrapper' => $panelGroup |
|
| 75 | - )); |
|
| 29 | + global $modx, $_lang, $_style, $modx_textdir, $tpl; |
|
| 30 | + |
|
| 31 | + $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
| 32 | + $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
| 33 | + |
|
| 34 | + if(!$items) {
|
|
| 35 | + return $_lang['no_results']; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + // Prepare elements- and categories-list |
|
| 39 | + $elements = array(); |
|
| 40 | + $categories = array(); |
|
| 41 | + foreach($items as $row) {
|
|
| 42 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 43 | + $categories[$catid] = array('name' => stripslashes($row['category']));
|
|
| 44 | + $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + // Now render categories / panel-collapse |
|
| 48 | + $panelGroup = ''; |
|
| 49 | + foreach($elements as $catid => $elList) {
|
|
| 50 | + // Add panel-heading / category-collapse to output |
|
| 51 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 52 | + 'tab' => $resourceTable, |
|
| 53 | + 'category' => $categories[$catid]['name'], |
|
| 54 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 55 | + 'catid' => $catid, |
|
| 56 | + )); |
|
| 57 | + |
|
| 58 | + // Prepare content for panel-collapse |
|
| 59 | + $panelCollapse = ''; |
|
| 60 | + foreach($elList as $el) {
|
|
| 61 | + $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + // Add panel-collapse with elements to output |
|
| 65 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 66 | + 'tab' => $resourceTable, |
|
| 67 | + 'catid' => $catid, |
|
| 68 | + 'wrapper' => $panelCollapse, |
|
| 69 | + )); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + return parsePh($tpl['panelGroup'], array( |
|
| 73 | + 'resourceTable' => $resourceTable, |
|
| 74 | + 'wrapper' => $panelGroup |
|
| 75 | + )); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | function createCombinedView($resources) {
|
| 79 | - global $modx, $_lang, $_style, $modx_textdir; |
|
| 80 | - |
|
| 81 | - $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
| 82 | - $types = isset($resources->types) ? $resources->types : false; |
|
| 83 | - $categories = isset($resources->categories) ? $resources->categories : false; |
|
| 84 | - |
|
| 85 | - if(!$itemsPerCategory) {
|
|
| 86 | - return $_lang['no_results']; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $tpl = array( |
|
| 90 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 91 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 92 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 93 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
| 94 | - ); |
|
| 95 | - |
|
| 96 | - // Easily loop through $itemsPerCategory-Array |
|
| 97 | - $panelGroup = ''; |
|
| 98 | - foreach($categories as $catid => $category) {
|
|
| 99 | - // Prepare collapse content / elements-list |
|
| 100 | - $panelCollapse = ''; |
|
| 101 | - foreach($itemsPerCategory[$catid] as $el) {
|
|
| 102 | - $resourceTable = $el['type']; |
|
| 103 | - $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
| 104 | - $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - // Add panel-heading / button |
|
| 108 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 109 | - 'tab' => 'categories_list', |
|
| 110 | - 'category' => $categories[$catid], |
|
| 111 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 112 | - 'catid' => $catid, |
|
| 113 | - )); |
|
| 114 | - |
|
| 115 | - // Add panel |
|
| 116 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 117 | - 'tab' => 'categories_list', |
|
| 118 | - 'catid' => $catid, |
|
| 119 | - 'wrapper' => $panelCollapse, |
|
| 120 | - )); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - return parsePh($tpl['panelGroup'], array( |
|
| 124 | - 'resourceTable' => 'categories_list', |
|
| 125 | - 'wrapper' => $panelGroup |
|
| 126 | - )); |
|
| 79 | + global $modx, $_lang, $_style, $modx_textdir; |
|
| 80 | + |
|
| 81 | + $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
| 82 | + $types = isset($resources->types) ? $resources->types : false; |
|
| 83 | + $categories = isset($resources->categories) ? $resources->categories : false; |
|
| 84 | + |
|
| 85 | + if(!$itemsPerCategory) {
|
|
| 86 | + return $_lang['no_results']; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $tpl = array( |
|
| 90 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 91 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 92 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 93 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
| 94 | + ); |
|
| 95 | + |
|
| 96 | + // Easily loop through $itemsPerCategory-Array |
|
| 97 | + $panelGroup = ''; |
|
| 98 | + foreach($categories as $catid => $category) {
|
|
| 99 | + // Prepare collapse content / elements-list |
|
| 100 | + $panelCollapse = ''; |
|
| 101 | + foreach($itemsPerCategory[$catid] as $el) {
|
|
| 102 | + $resourceTable = $el['type']; |
|
| 103 | + $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
| 104 | + $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + // Add panel-heading / button |
|
| 108 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
| 109 | + 'tab' => 'categories_list', |
|
| 110 | + 'category' => $categories[$catid], |
|
| 111 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 112 | + 'catid' => $catid, |
|
| 113 | + )); |
|
| 114 | + |
|
| 115 | + // Add panel |
|
| 116 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
| 117 | + 'tab' => 'categories_list', |
|
| 118 | + 'catid' => $catid, |
|
| 119 | + 'wrapper' => $panelCollapse, |
|
| 120 | + )); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + return parsePh($tpl['panelGroup'], array( |
|
| 124 | + 'resourceTable' => 'categories_list', |
|
| 125 | + 'wrapper' => $panelGroup |
|
| 126 | + )); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | function prepareElementRowPh($row, $resourceTable, $resources) {
|
| 130 | - global $modx, $modx_textdir, $_style, $_lang; |
|
| 131 | - |
|
| 132 | - $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
| 133 | - |
|
| 134 | - $class = ''; |
|
| 135 | - $_lang["confirm_delete"] = $_lang["delete"]; |
|
| 136 | - |
|
| 137 | - if($resourceTable == 'site_templates') {
|
|
| 138 | - $class = $row['selectable'] ? '' : 'disabledPlugin'; |
|
| 139 | - $lockElementType = 1; |
|
| 140 | - $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
|
| 141 | - } |
|
| 142 | - if($resourceTable == 'site_tmplvars') {
|
|
| 143 | - $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
|
| 144 | - $lockElementType = 2; |
|
| 145 | - $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
|
| 146 | - } |
|
| 147 | - if($resourceTable == 'site_htmlsnippets') {
|
|
| 130 | + global $modx, $modx_textdir, $_style, $_lang; |
|
| 131 | + |
|
| 132 | + $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
| 133 | + |
|
| 134 | + $class = ''; |
|
| 135 | + $_lang["confirm_delete"] = $_lang["delete"]; |
|
| 136 | + |
|
| 137 | + if($resourceTable == 'site_templates') {
|
|
| 138 | + $class = $row['selectable'] ? '' : 'disabledPlugin'; |
|
| 139 | + $lockElementType = 1; |
|
| 140 | + $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
|
| 141 | + } |
|
| 142 | + if($resourceTable == 'site_tmplvars') {
|
|
| 143 | + $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
|
| 144 | + $lockElementType = 2; |
|
| 145 | + $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
|
| 146 | + } |
|
| 147 | + if($resourceTable == 'site_htmlsnippets') {
|
|
| 148 | 148 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 149 | - $lockElementType = 3; |
|
| 150 | - $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
|
| 151 | - } |
|
| 152 | - if($resourceTable == 'site_snippets') {
|
|
| 149 | + $lockElementType = 3; |
|
| 150 | + $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
|
| 151 | + } |
|
| 152 | + if($resourceTable == 'site_snippets') {
|
|
| 153 | 153 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 154 | - $lockElementType = 4; |
|
| 155 | - $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
|
| 156 | - } |
|
| 157 | - if($resourceTable == 'site_plugins') {
|
|
| 158 | - $class = $row['disabled'] ? 'disabledPlugin' : ''; |
|
| 159 | - $lockElementType = 5; |
|
| 160 | - $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
|
| 161 | - } |
|
| 162 | - if($resourceTable == 'site_modules') {
|
|
| 154 | + $lockElementType = 4; |
|
| 155 | + $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
|
| 156 | + } |
|
| 157 | + if($resourceTable == 'site_plugins') {
|
|
| 158 | + $class = $row['disabled'] ? 'disabledPlugin' : ''; |
|
| 159 | + $lockElementType = 5; |
|
| 160 | + $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
|
| 161 | + } |
|
| 162 | + if($resourceTable == 'site_modules') {
|
|
| 163 | 163 | $class = $row['disabled'] ? '' : 'disabledPlugin'; |
| 164 | - $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - // Prepare displaying user-locks |
|
| 168 | - $lockedByUser = ''; |
|
| 169 | - $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
| 170 | - if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 171 | - if($rowLock['sid'] == $modx->sid) {
|
|
| 172 | - $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
| 173 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 174 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 175 | - )); |
|
| 176 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
| 177 | - } else {
|
|
| 178 | - $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
| 179 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 180 | - 'username' => $rowLock['username'], |
|
| 181 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 182 | - )); |
|
| 183 | - if($modx->hasPermission('remove_locks')) {
|
|
| 184 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
|
| 185 | - } else {
|
|
| 186 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - if($lockedByUser) {
|
|
| 191 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - // Caption |
|
| 195 | - if($resourceTable == 'site_tmplvars') {
|
|
| 196 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
|
| 197 | - } else {
|
|
| 198 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - // Special marks |
|
| 202 | - $tplInfo = array(); |
|
| 203 | - if($row['locked']) {
|
|
| 204 | - $tplInfo[] = $_lang['locked']; |
|
| 205 | - } |
|
| 206 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 207 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
| 208 | - } |
|
| 209 | - $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
|
|
| 210 | - |
|
| 211 | - /* row buttons */ |
|
| 212 | - $buttons = ''; |
|
| 213 | - if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 214 | - $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>'; |
|
| 215 | - } |
|
| 216 | - if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 217 | - $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>'; |
|
| 218 | - } |
|
| 219 | - if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 220 | - $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>'; |
|
| 221 | - } |
|
| 222 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
| 223 | - |
|
| 224 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 225 | - |
|
| 226 | - // Placeholders for elements-row |
|
| 227 | - return array( |
|
| 228 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
| 229 | - 'lockedByUser' => $lockedByUser, |
|
| 230 | - 'name' => $row['name'], |
|
| 231 | - 'caption' => $caption, |
|
| 232 | - 'buttons' => $buttons, |
|
| 233 | - 'marks' => $marks, |
|
| 234 | - 'id' => $row['id'], |
|
| 235 | - 'resourceTable' => $resourceTable, |
|
| 236 | - 'actionEdit' => $types['actions']['edit'][0], |
|
| 237 | - 'catid' => $catid, |
|
| 238 | - 'textdir' => $modx_textdir ? '‏' : '', |
|
| 239 | - ); |
|
| 164 | + $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + // Prepare displaying user-locks |
|
| 168 | + $lockedByUser = ''; |
|
| 169 | + $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
| 170 | + if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 171 | + if($rowLock['sid'] == $modx->sid) {
|
|
| 172 | + $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
| 173 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 174 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 175 | + )); |
|
| 176 | + $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
| 177 | + } else {
|
|
| 178 | + $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
| 179 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 180 | + 'username' => $rowLock['username'], |
|
| 181 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
| 182 | + )); |
|
| 183 | + if($modx->hasPermission('remove_locks')) {
|
|
| 184 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
|
| 185 | + } else {
|
|
| 186 | + $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + if($lockedByUser) {
|
|
| 191 | + $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + // Caption |
|
| 195 | + if($resourceTable == 'site_tmplvars') {
|
|
| 196 | + $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
|
| 197 | + } else {
|
|
| 198 | + $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + // Special marks |
|
| 202 | + $tplInfo = array(); |
|
| 203 | + if($row['locked']) {
|
|
| 204 | + $tplInfo[] = $_lang['locked']; |
|
| 205 | + } |
|
| 206 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 207 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
| 208 | + } |
|
| 209 | + $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
|
|
| 210 | + |
|
| 211 | + /* row buttons */ |
|
| 212 | + $buttons = ''; |
|
| 213 | + if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 214 | + $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>'; |
|
| 215 | + } |
|
| 216 | + if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 217 | + $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>'; |
|
| 218 | + } |
|
| 219 | + if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 220 | + $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>'; |
|
| 221 | + } |
|
| 222 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
| 223 | + |
|
| 224 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
| 225 | + |
|
| 226 | + // Placeholders for elements-row |
|
| 227 | + return array( |
|
| 228 | + 'class' => $class ? ' class="' . $class . '"' : '', |
|
| 229 | + 'lockedByUser' => $lockedByUser, |
|
| 230 | + 'name' => $row['name'], |
|
| 231 | + 'caption' => $caption, |
|
| 232 | + 'buttons' => $buttons, |
|
| 233 | + 'marks' => $marks, |
|
| 234 | + 'id' => $row['id'], |
|
| 235 | + 'resourceTable' => $resourceTable, |
|
| 236 | + 'actionEdit' => $types['actions']['edit'][0], |
|
| 237 | + 'catid' => $catid, |
|
| 238 | + 'textdir' => $modx_textdir ? '‏' : '', |
|
| 239 | + ); |
|
| 240 | 240 | } |
@@ -1,23 +1,23 @@ 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 | 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,20 +25,20 @@ 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 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
| 33 | 33 | |
| 34 | - if(!$items) {
|
|
| 34 | + if (!$items) {
|
|
| 35 | 35 | return $_lang['no_results']; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Prepare elements- and categories-list |
| 39 | 39 | $elements = array(); |
| 40 | 40 | $categories = array(); |
| 41 | - foreach($items as $row) {
|
|
| 41 | + foreach ($items as $row) {
|
|
| 42 | 42 | $catid = $row['catid'] ? $row['catid'] : 0; |
| 43 | 43 | $categories[$catid] = array('name' => stripslashes($row['category']));
|
| 44 | 44 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -46,18 +46,18 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | // Now render categories / panel-collapse |
| 48 | 48 | $panelGroup = ''; |
| 49 | - foreach($elements as $catid => $elList) {
|
|
| 49 | + foreach ($elements as $catid => $elList) {
|
|
| 50 | 50 | // Add panel-heading / category-collapse to output |
| 51 | 51 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
| 52 | 52 | 'tab' => $resourceTable, |
| 53 | 53 | 'category' => $categories[$catid]['name'], |
| 54 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 54 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '',
|
|
| 55 | 55 | 'catid' => $catid, |
| 56 | 56 | )); |
| 57 | 57 | |
| 58 | 58 | // Prepare content for panel-collapse |
| 59 | 59 | $panelCollapse = ''; |
| 60 | - foreach($elList as $el) {
|
|
| 60 | + foreach ($elList as $el) {
|
|
| 61 | 61 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -75,30 +75,30 @@ discard block |
||
| 75 | 75 | )); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | -function createCombinedView($resources) {
|
|
| 78 | +function createCombinedView($resources){
|
|
| 79 | 79 | global $modx, $_lang, $_style, $modx_textdir; |
| 80 | 80 | |
| 81 | 81 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
| 82 | 82 | $types = isset($resources->types) ? $resources->types : false; |
| 83 | 83 | $categories = isset($resources->categories) ? $resources->categories : false; |
| 84 | 84 | |
| 85 | - if(!$itemsPerCategory) {
|
|
| 85 | + if (!$itemsPerCategory) {
|
|
| 86 | 86 | return $_lang['no_results']; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $tpl = array( |
| 90 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
| 91 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
| 92 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
| 93 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
| 90 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
| 91 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
| 92 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
| 93 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl'), |
|
| 94 | 94 | ); |
| 95 | 95 | |
| 96 | 96 | // Easily loop through $itemsPerCategory-Array |
| 97 | 97 | $panelGroup = ''; |
| 98 | - foreach($categories as $catid => $category) {
|
|
| 98 | + foreach ($categories as $catid => $category) {
|
|
| 99 | 99 | // Prepare collapse content / elements-list |
| 100 | 100 | $panelCollapse = ''; |
| 101 | - foreach($itemsPerCategory[$catid] as $el) {
|
|
| 101 | + foreach ($itemsPerCategory[$catid] as $el) {
|
|
| 102 | 102 | $resourceTable = $el['type']; |
| 103 | 103 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
| 104 | 104 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
| 109 | 109 | 'tab' => 'categories_list', |
| 110 | 110 | 'category' => $categories[$catid], |
| 111 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
|
|
| 111 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '',
|
|
| 112 | 112 | 'catid' => $catid, |
| 113 | 113 | )); |
| 114 | 114 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | )); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | -function prepareElementRowPh($row, $resourceTable, $resources) {
|
|
| 129 | +function prepareElementRowPh($row, $resourceTable, $resources){
|
|
| 130 | 130 | global $modx, $modx_textdir, $_style, $_lang; |
| 131 | 131 | |
| 132 | 132 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
@@ -134,32 +134,32 @@ discard block |
||
| 134 | 134 | $class = ''; |
| 135 | 135 | $_lang["confirm_delete"] = $_lang["delete"]; |
| 136 | 136 | |
| 137 | - if($resourceTable == 'site_templates') {
|
|
| 137 | + if ($resourceTable == 'site_templates') {
|
|
| 138 | 138 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
| 139 | 139 | $lockElementType = 1; |
| 140 | 140 | $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
| 141 | 141 | } |
| 142 | - if($resourceTable == 'site_tmplvars') {
|
|
| 142 | + if ($resourceTable == 'site_tmplvars') {
|
|
| 143 | 143 | $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
| 144 | 144 | $lockElementType = 2; |
| 145 | 145 | $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
| 146 | 146 | } |
| 147 | - if($resourceTable == 'site_htmlsnippets') {
|
|
| 147 | + if ($resourceTable == 'site_htmlsnippets') {
|
|
| 148 | 148 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 149 | 149 | $lockElementType = 3; |
| 150 | 150 | $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
| 151 | 151 | } |
| 152 | - if($resourceTable == 'site_snippets') {
|
|
| 152 | + if ($resourceTable == 'site_snippets') {
|
|
| 153 | 153 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 154 | 154 | $lockElementType = 4; |
| 155 | 155 | $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
| 156 | 156 | } |
| 157 | - if($resourceTable == 'site_plugins') {
|
|
| 157 | + if ($resourceTable == 'site_plugins') {
|
|
| 158 | 158 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 159 | 159 | $lockElementType = 5; |
| 160 | 160 | $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
| 161 | 161 | } |
| 162 | - if($resourceTable == 'site_modules') {
|
|
| 162 | + if ($resourceTable == 'site_modules') {
|
|
| 163 | 163 | $class = $row['disabled'] ? '' : 'disabledPlugin'; |
| 164 | 164 | $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
| 165 | 165 | } |
@@ -167,65 +167,65 @@ discard block |
||
| 167 | 167 | // Prepare displaying user-locks |
| 168 | 168 | $lockedByUser = ''; |
| 169 | 169 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
| 170 | - if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 171 | - if($rowLock['sid'] == $modx->sid) {
|
|
| 170 | + if ($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 171 | + if ($rowLock['sid'] == $modx->sid) {
|
|
| 172 | 172 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
| 173 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 173 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
| 174 | 174 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 175 | 175 | )); |
| 176 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
| 176 | + $lockedByUser = '<span title="'.$title.'" class="editResource" style="cursor:context-menu;">'.$_style['tree_preview_resource'].'</span> '; |
|
| 177 | 177 | } else {
|
| 178 | 178 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
| 179 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
| 179 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
| 180 | 180 | 'username' => $rowLock['username'], |
| 181 | 181 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 182 | 182 | )); |
| 183 | - if($modx->hasPermission('remove_locks')) {
|
|
| 184 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
|
| 183 | + if ($modx->hasPermission('remove_locks')) {
|
|
| 184 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement('.$lockElementType.', '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource"><i class="'.$_style['icons_secured'].'"></i></a>';
|
|
| 185 | 185 | } else {
|
| 186 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
| 186 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource" style="cursor:context-menu;"><i class="'.$_style['icons_secured'].'"></i></span>'; |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | - if($lockedByUser) {
|
|
| 191 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
| 190 | + if ($lockedByUser) {
|
|
| 191 | + $lockedByUser = '<div class="lockCell">'.$lockedByUser.'</div>'; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | // Caption |
| 195 | - if($resourceTable == 'site_tmplvars') {
|
|
| 196 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
|
| 195 | + if ($resourceTable == 'site_tmplvars') {
|
|
| 196 | + $caption = !empty($row['description']) ? ' '.$row['caption'].' <small>('.$row['description'].')</small>' : ' '.$row['caption'];
|
|
| 197 | 197 | } else {
|
| 198 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
| 198 | + $caption = !empty($row['description']) ? ' '.$row['description'] : ''; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | // Special marks |
| 202 | 202 | $tplInfo = array(); |
| 203 | - if($row['locked']) {
|
|
| 203 | + if ($row['locked']) {
|
|
| 204 | 204 | $tplInfo[] = $_lang['locked']; |
| 205 | 205 | } |
| 206 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 206 | + if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 207 | 207 | $tplInfo[] = $_lang['defaulttemplate_title']; |
| 208 | 208 | } |
| 209 | - $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
|
|
| 209 | + $marks = !empty($tplInfo) ? ' <em>('.join(', ', $tplInfo).')</em>' : '';
|
|
| 210 | 210 | |
| 211 | 211 | /* row buttons */ |
| 212 | 212 | $buttons = ''; |
| 213 | - if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 214 | - $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>'; |
|
| 213 | + if ($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 214 | + $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>'; |
|
| 215 | 215 | } |
| 216 | - if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 217 | - $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>'; |
|
| 216 | + if ($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 217 | + $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>'; |
|
| 218 | 218 | } |
| 219 | - if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 220 | - $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>'; |
|
| 219 | + if ($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 220 | + $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>'; |
|
| 221 | 221 | } |
| 222 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
| 222 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">'.$buttons.'</ul></div>' : ''; |
|
| 223 | 223 | |
| 224 | 224 | $catid = $row['catid'] ? $row['catid'] : 0; |
| 225 | 225 | |
| 226 | 226 | // Placeholders for elements-row |
| 227 | 227 | return array( |
| 228 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
| 228 | + 'class' => $class ? ' class="'.$class.'"' : '', |
|
| 229 | 229 | 'lockedByUser' => $lockedByUser, |
| 230 | 230 | 'name' => $row['name'], |
| 231 | 231 | 'caption' => $caption, |
@@ -1,5 +1,5 @@ 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 | 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,20 +27,21 @@ 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 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
| 33 | 36 | |
| 34 | - if(!$items) {
|
|
| 37 | + if(!$items) { |
|
| 35 | 38 | return $_lang['no_results']; |
| 36 | 39 | } |
| 37 | 40 | |
| 38 | 41 | // Prepare elements- and categories-list |
| 39 | 42 | $elements = array(); |
| 40 | 43 | $categories = array(); |
| 41 | - foreach($items as $row) {
|
|
| 44 | + foreach($items as $row) { |
|
| 42 | 45 | $catid = $row['catid'] ? $row['catid'] : 0; |
| 43 | 46 | $categories[$catid] = array('name' => stripslashes($row['category']));
|
| 44 | 47 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -46,7 +49,7 @@ discard block |
||
| 46 | 49 | |
| 47 | 50 | // Now render categories / panel-collapse |
| 48 | 51 | $panelGroup = ''; |
| 49 | - foreach($elements as $catid => $elList) {
|
|
| 52 | + foreach($elements as $catid => $elList) { |
|
| 50 | 53 | // Add panel-heading / category-collapse to output |
| 51 | 54 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
| 52 | 55 | 'tab' => $resourceTable, |
@@ -57,7 +60,7 @@ discard block |
||
| 57 | 60 | |
| 58 | 61 | // Prepare content for panel-collapse |
| 59 | 62 | $panelCollapse = ''; |
| 60 | - foreach($elList as $el) {
|
|
| 63 | + foreach($elList as $el) { |
|
| 61 | 64 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
| 62 | 65 | } |
| 63 | 66 | |
@@ -75,14 +78,15 @@ discard block |
||
| 75 | 78 | )); |
| 76 | 79 | } |
| 77 | 80 | |
| 78 | -function createCombinedView($resources) {
|
|
| 81 | +function createCombinedView($resources) |
|
| 82 | +{ |
|
| 79 | 83 | global $modx, $_lang, $_style, $modx_textdir; |
| 80 | 84 | |
| 81 | 85 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
| 82 | 86 | $types = isset($resources->types) ? $resources->types : false; |
| 83 | 87 | $categories = isset($resources->categories) ? $resources->categories : false; |
| 84 | 88 | |
| 85 | - if(!$itemsPerCategory) {
|
|
| 89 | + if(!$itemsPerCategory) { |
|
| 86 | 90 | return $_lang['no_results']; |
| 87 | 91 | } |
| 88 | 92 | |
@@ -95,10 +99,10 @@ discard block |
||
| 95 | 99 | |
| 96 | 100 | // Easily loop through $itemsPerCategory-Array |
| 97 | 101 | $panelGroup = ''; |
| 98 | - foreach($categories as $catid => $category) {
|
|
| 102 | + foreach($categories as $catid => $category) { |
|
| 99 | 103 | // Prepare collapse content / elements-list |
| 100 | 104 | $panelCollapse = ''; |
| 101 | - foreach($itemsPerCategory[$catid] as $el) {
|
|
| 105 | + foreach($itemsPerCategory[$catid] as $el) { |
|
| 102 | 106 | $resourceTable = $el['type']; |
| 103 | 107 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
| 104 | 108 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -126,7 +130,8 @@ discard block |
||
| 126 | 130 | )); |
| 127 | 131 | } |
| 128 | 132 | |
| 129 | -function prepareElementRowPh($row, $resourceTable, $resources) {
|
|
| 133 | +function prepareElementRowPh($row, $resourceTable, $resources) |
|
| 134 | +{ |
|
| 130 | 135 | global $modx, $modx_textdir, $_style, $_lang; |
| 131 | 136 | |
| 132 | 137 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
@@ -134,32 +139,32 @@ discard block |
||
| 134 | 139 | $class = ''; |
| 135 | 140 | $_lang["confirm_delete"] = $_lang["delete"]; |
| 136 | 141 | |
| 137 | - if($resourceTable == 'site_templates') {
|
|
| 142 | + if($resourceTable == 'site_templates') { |
|
| 138 | 143 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
| 139 | 144 | $lockElementType = 1; |
| 140 | 145 | $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
| 141 | 146 | } |
| 142 | - if($resourceTable == 'site_tmplvars') {
|
|
| 147 | + if($resourceTable == 'site_tmplvars') { |
|
| 143 | 148 | $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
| 144 | 149 | $lockElementType = 2; |
| 145 | 150 | $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
| 146 | 151 | } |
| 147 | - if($resourceTable == 'site_htmlsnippets') {
|
|
| 152 | + if($resourceTable == 'site_htmlsnippets') { |
|
| 148 | 153 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 149 | 154 | $lockElementType = 3; |
| 150 | 155 | $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
| 151 | 156 | } |
| 152 | - if($resourceTable == 'site_snippets') {
|
|
| 157 | + if($resourceTable == 'site_snippets') { |
|
| 153 | 158 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 154 | 159 | $lockElementType = 4; |
| 155 | 160 | $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
| 156 | 161 | } |
| 157 | - if($resourceTable == 'site_plugins') {
|
|
| 162 | + if($resourceTable == 'site_plugins') { |
|
| 158 | 163 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
| 159 | 164 | $lockElementType = 5; |
| 160 | 165 | $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
| 161 | 166 | } |
| 162 | - if($resourceTable == 'site_modules') {
|
|
| 167 | + if($resourceTable == 'site_modules') { |
|
| 163 | 168 | $class = $row['disabled'] ? '' : 'disabledPlugin'; |
| 164 | 169 | $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
| 165 | 170 | } |
@@ -167,56 +172,56 @@ discard block |
||
| 167 | 172 | // Prepare displaying user-locks |
| 168 | 173 | $lockedByUser = ''; |
| 169 | 174 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
| 170 | - if($rowLock && $modx->hasPermission('display_locks')) {
|
|
| 171 | - if($rowLock['sid'] == $modx->sid) {
|
|
| 175 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
| 176 | + if($rowLock['sid'] == $modx->sid) { |
|
| 172 | 177 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
| 173 | 178 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
| 174 | 179 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 175 | 180 | )); |
| 176 | 181 | $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
| 177 | - } else {
|
|
| 182 | + } else { |
|
| 178 | 183 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
| 179 | 184 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
| 180 | 185 | 'username' => $rowLock['username'], |
| 181 | 186 | 'lasthit_df' => $rowLock['lasthit_df'] |
| 182 | 187 | )); |
| 183 | - if($modx->hasPermission('remove_locks')) {
|
|
| 188 | + if($modx->hasPermission('remove_locks')) { |
|
| 184 | 189 | $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
|
| 185 | - } else {
|
|
| 190 | + } else { |
|
| 186 | 191 | $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
| 187 | 192 | } |
| 188 | 193 | } |
| 189 | 194 | } |
| 190 | - if($lockedByUser) {
|
|
| 195 | + if($lockedByUser) { |
|
| 191 | 196 | $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
| 192 | 197 | } |
| 193 | 198 | |
| 194 | 199 | // Caption |
| 195 | - if($resourceTable == 'site_tmplvars') {
|
|
| 200 | + if($resourceTable == 'site_tmplvars') { |
|
| 196 | 201 | $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
|
| 197 | - } else {
|
|
| 202 | + } else { |
|
| 198 | 203 | $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
| 199 | 204 | } |
| 200 | 205 | |
| 201 | 206 | // Special marks |
| 202 | 207 | $tplInfo = array(); |
| 203 | - if($row['locked']) {
|
|
| 208 | + if($row['locked']) { |
|
| 204 | 209 | $tplInfo[] = $_lang['locked']; |
| 205 | 210 | } |
| 206 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
|
|
| 211 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
| 207 | 212 | $tplInfo[] = $_lang['defaulttemplate_title']; |
| 208 | 213 | } |
| 209 | 214 | $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
|
| 210 | 215 | |
| 211 | 216 | /* row buttons */ |
| 212 | 217 | $buttons = ''; |
| 213 | - if($modx->hasPermission($types['actions']['edit'][1])) {
|
|
| 218 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
| 214 | 219 | $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>'; |
| 215 | 220 | } |
| 216 | - if($modx->hasPermission($types['actions']['duplicate'][1])) {
|
|
| 221 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
| 217 | 222 | $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>'; |
| 218 | 223 | } |
| 219 | - if($modx->hasPermission($types['actions']['remove'][1])) {
|
|
| 224 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
| 220 | 225 | $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>'; |
| 221 | 226 | } |
| 222 | 227 | $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
@@ -2,123 +2,123 @@ |
||
| 2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 3 | 3 | |
| 4 | 4 | class mgrResources { |
| 5 | - var $types = array(); |
|
| 6 | - var $items = array(); |
|
| 7 | - var $categories = array(); |
|
| 8 | - var $itemsPerCategory = array(); |
|
| 5 | + var $types = array(); |
|
| 6 | + var $items = array(); |
|
| 7 | + var $categories = array(); |
|
| 8 | + var $itemsPerCategory = array(); |
|
| 9 | 9 | |
| 10 | - function __construct() { |
|
| 11 | - $this->setTypes(); |
|
| 12 | - $this->queryItemsFromDB(); |
|
| 13 | - $this->prepareCategoryArrays(); |
|
| 14 | - } |
|
| 10 | + function __construct() { |
|
| 11 | + $this->setTypes(); |
|
| 12 | + $this->queryItemsFromDB(); |
|
| 13 | + $this->prepareCategoryArrays(); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - function setTypes() { |
|
| 17 | - global $_lang; |
|
| 18 | - $this->types['site_templates'] = array( |
|
| 19 | - 'title'=>$_lang["manage_templates"], |
|
| 20 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 21 | - 'permissions'=>array('new_template','edit_template'), |
|
| 22 | - 'name'=>'templatename' |
|
| 23 | - ); |
|
| 24 | - $this->types['site_tmplvars'] = array( |
|
| 25 | - 'title'=>$_lang["tmplvars"], |
|
| 26 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 27 | - 'permissions'=>array('new_template','edit_template'), |
|
| 28 | - ); |
|
| 29 | - $this->types['site_htmlsnippets'] = array( |
|
| 30 | - 'title'=>$_lang["manage_htmlsnippets"], |
|
| 31 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 32 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 33 | - ); |
|
| 34 | - $this->types['site_snippets'] = array( |
|
| 35 | - 'title'=>$_lang["manage_snippets"], |
|
| 36 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 37 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 38 | - ); |
|
| 39 | - $this->types['site_plugins'] = array( |
|
| 40 | - 'title'=>$_lang["manage_plugins"], |
|
| 41 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 42 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 43 | - ); |
|
| 44 | - $this->types['site_modules'] = array( |
|
| 45 | - 'title'=>$_lang["manage_modules"], |
|
| 46 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 47 | - 'permissions'=>array('new_module','edit_module'), |
|
| 48 | - ); |
|
| 49 | - } |
|
| 16 | + function setTypes() { |
|
| 17 | + global $_lang; |
|
| 18 | + $this->types['site_templates'] = array( |
|
| 19 | + 'title'=>$_lang["manage_templates"], |
|
| 20 | + 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 21 | + 'permissions'=>array('new_template','edit_template'), |
|
| 22 | + 'name'=>'templatename' |
|
| 23 | + ); |
|
| 24 | + $this->types['site_tmplvars'] = array( |
|
| 25 | + 'title'=>$_lang["tmplvars"], |
|
| 26 | + 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 27 | + 'permissions'=>array('new_template','edit_template'), |
|
| 28 | + ); |
|
| 29 | + $this->types['site_htmlsnippets'] = array( |
|
| 30 | + 'title'=>$_lang["manage_htmlsnippets"], |
|
| 31 | + 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 32 | + 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 33 | + ); |
|
| 34 | + $this->types['site_snippets'] = array( |
|
| 35 | + 'title'=>$_lang["manage_snippets"], |
|
| 36 | + 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 37 | + 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 38 | + ); |
|
| 39 | + $this->types['site_plugins'] = array( |
|
| 40 | + 'title'=>$_lang["manage_plugins"], |
|
| 41 | + 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 42 | + 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 43 | + ); |
|
| 44 | + $this->types['site_modules'] = array( |
|
| 45 | + 'title'=>$_lang["manage_modules"], |
|
| 46 | + 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 47 | + 'permissions'=>array('new_module','edit_module'), |
|
| 48 | + ); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - function queryItemsFromDB() { |
|
| 52 | - foreach($this->types as $resourceTable=>$type) { |
|
| 53 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
| 54 | - $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
| 55 | - $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - } |
|
| 51 | + function queryItemsFromDB() { |
|
| 52 | + foreach($this->types as $resourceTable=>$type) { |
|
| 53 | + if($this->hasAnyPermissions($type['permissions'])) { |
|
| 54 | + $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
| 55 | + $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - function hasAnyPermissions($permissions) { |
|
| 61 | - global $modx; |
|
| 60 | + function hasAnyPermissions($permissions) { |
|
| 61 | + global $modx; |
|
| 62 | 62 | |
| 63 | - foreach($permissions as $p) |
|
| 64 | - if($modx->hasPermission($p)) return true; |
|
| 63 | + foreach($permissions as $p) |
|
| 64 | + if($modx->hasPermission($p)) return true; |
|
| 65 | 65 | |
| 66 | - return false; |
|
| 67 | - } |
|
| 66 | + return false; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - function queryResources($resourceTable, $nameField = 'name') { |
|
| 70 | - global $modx, $_lang; |
|
| 69 | + function queryResources($resourceTable, $nameField = 'name') { |
|
| 70 | + global $modx, $_lang; |
|
| 71 | 71 | |
| 72 | - $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
|
| 72 | + $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
|
| 73 | 73 | |
| 74 | - $tvsql = ''; |
|
| 75 | - $tvjoin = ''; |
|
| 76 | - if ($resourceTable == 'site_tmplvars') { |
|
| 77 | - $tvsql = 'site_tmplvars.caption, '; |
|
| 78 | - $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
| 79 | - $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
| 80 | - } |
|
| 81 | - else $sttfield = ''; |
|
| 74 | + $tvsql = ''; |
|
| 75 | + $tvjoin = ''; |
|
| 76 | + if ($resourceTable == 'site_tmplvars') { |
|
| 77 | + $tvsql = 'site_tmplvars.caption, '; |
|
| 78 | + $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
| 79 | + $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
| 80 | + } |
|
| 81 | + else $sttfield = ''; |
|
| 82 | 82 | |
| 83 | - $selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
| 83 | + $selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
| 84 | 84 | |
| 85 | - $rs = $modx->db->select( |
|
| 86 | - "{$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", |
|
| 87 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 85 | + $rs = $modx->db->select( |
|
| 86 | + "{$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", |
|
| 87 | + $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 88 | 88 | LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
| 89 | - "", |
|
| 90 | - "category,name" |
|
| 91 | - ); |
|
| 92 | - $limit = $modx->db->getRecordCount($rs); |
|
| 89 | + "", |
|
| 90 | + "category,name" |
|
| 91 | + ); |
|
| 92 | + $limit = $modx->db->getRecordCount($rs); |
|
| 93 | 93 | |
| 94 | - if($limit < 1) return false; |
|
| 94 | + if($limit < 1) return false; |
|
| 95 | 95 | |
| 96 | - $result = array(); |
|
| 97 | - while ($row = $modx->db->getRow($rs)) { |
|
| 98 | - $result[] = $row; |
|
| 99 | - } |
|
| 100 | - return $result; |
|
| 101 | - } |
|
| 96 | + $result = array(); |
|
| 97 | + while ($row = $modx->db->getRow($rs)) { |
|
| 98 | + $result[] = $row; |
|
| 99 | + } |
|
| 100 | + return $result; |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - function prepareCategoryArrays() { |
|
| 104 | - foreach($this->items as $type=>$items) { |
|
| 105 | - foreach((array)$items as $item) { |
|
| 106 | - $catid = $item['catid'] ? $item['catid'] : 0; |
|
| 107 | - $this->categories[$catid] = $item['category']; |
|
| 103 | + function prepareCategoryArrays() { |
|
| 104 | + foreach($this->items as $type=>$items) { |
|
| 105 | + foreach((array)$items as $item) { |
|
| 106 | + $catid = $item['catid'] ? $item['catid'] : 0; |
|
| 107 | + $this->categories[$catid] = $item['category']; |
|
| 108 | 108 | |
| 109 | - $item['type'] = $type; |
|
| 110 | - $this->itemsPerCategory[$catid][] = $item; |
|
| 111 | - } |
|
| 112 | - } |
|
| 109 | + $item['type'] = $type; |
|
| 110 | + $this->itemsPerCategory[$catid][] = $item; |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - // Sort categories by name |
|
| 115 | - natcasesort($this->categories); |
|
| 114 | + // Sort categories by name |
|
| 115 | + natcasesort($this->categories); |
|
| 116 | 116 | |
| 117 | - // Now sort by name |
|
| 118 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 119 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 120 | - return strcasecmp($a['name'], $b['name']); |
|
| 121 | - }); |
|
| 122 | - } |
|
| 123 | - } |
|
| 117 | + // Now sort by name |
|
| 118 | + foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 119 | + usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 120 | + return strcasecmp($a['name'], $b['name']); |
|
| 121 | + }); |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | 124 | } |
@@ -1,75 +1,75 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | 3 | |
| 4 | -class mgrResources { |
|
| 4 | +class mgrResources{ |
|
| 5 | 5 | var $types = array(); |
| 6 | 6 | var $items = array(); |
| 7 | 7 | var $categories = array(); |
| 8 | 8 | var $itemsPerCategory = array(); |
| 9 | 9 | |
| 10 | - function __construct() { |
|
| 10 | + function __construct(){ |
|
| 11 | 11 | $this->setTypes(); |
| 12 | 12 | $this->queryItemsFromDB(); |
| 13 | 13 | $this->prepareCategoryArrays(); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - function setTypes() { |
|
| 16 | + function setTypes(){ |
|
| 17 | 17 | global $_lang; |
| 18 | - $this->types['site_templates'] = array( |
|
| 18 | + $this->types['site_templates'] = array( |
|
| 19 | 19 | 'title'=>$_lang["manage_templates"], |
| 20 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 21 | - 'permissions'=>array('new_template','edit_template'), |
|
| 20 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
| 21 | + 'permissions'=>array('new_template', 'edit_template'), |
|
| 22 | 22 | 'name'=>'templatename' |
| 23 | 23 | ); |
| 24 | - $this->types['site_tmplvars'] = array( |
|
| 24 | + $this->types['site_tmplvars'] = array( |
|
| 25 | 25 | 'title'=>$_lang["tmplvars"], |
| 26 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 27 | - 'permissions'=>array('new_template','edit_template'), |
|
| 26 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
| 27 | + 'permissions'=>array('new_template', 'edit_template'), |
|
| 28 | 28 | ); |
| 29 | 29 | $this->types['site_htmlsnippets'] = array( |
| 30 | 30 | 'title'=>$_lang["manage_htmlsnippets"], |
| 31 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 32 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 31 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
| 32 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
| 33 | 33 | ); |
| 34 | - $this->types['site_snippets'] = array( |
|
| 34 | + $this->types['site_snippets'] = array( |
|
| 35 | 35 | 'title'=>$_lang["manage_snippets"], |
| 36 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 37 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 36 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
| 37 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
| 38 | 38 | ); |
| 39 | - $this->types['site_plugins'] = array( |
|
| 39 | + $this->types['site_plugins'] = array( |
|
| 40 | 40 | 'title'=>$_lang["manage_plugins"], |
| 41 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 42 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 41 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
| 42 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
| 43 | 43 | ); |
| 44 | - $this->types['site_modules'] = array( |
|
| 44 | + $this->types['site_modules'] = array( |
|
| 45 | 45 | 'title'=>$_lang["manage_modules"], |
| 46 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 47 | - 'permissions'=>array('new_module','edit_module'), |
|
| 46 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
| 47 | + 'permissions'=>array('new_module', 'edit_module'), |
|
| 48 | 48 | ); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - function queryItemsFromDB() { |
|
| 52 | - foreach($this->types as $resourceTable=>$type) { |
|
| 53 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
| 51 | + function queryItemsFromDB(){ |
|
| 52 | + foreach ($this->types as $resourceTable=>$type) { |
|
| 53 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
| 54 | 54 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
| 55 | 55 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - function hasAnyPermissions($permissions) { |
|
| 60 | + function hasAnyPermissions($permissions){ |
|
| 61 | 61 | global $modx; |
| 62 | 62 | |
| 63 | - foreach($permissions as $p) |
|
| 64 | - if($modx->hasPermission($p)) return true; |
|
| 63 | + foreach ($permissions as $p) |
|
| 64 | + if ($modx->hasPermission($p)) return true; |
|
| 65 | 65 | |
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - function queryResources($resourceTable, $nameField = 'name') { |
|
| 69 | + function queryResources($resourceTable, $nameField = 'name'){ |
|
| 70 | 70 | global $modx, $_lang; |
| 71 | 71 | |
| 72 | - $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
|
| 72 | + $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable.'.disabled, ' : ''; |
|
| 73 | 73 | |
| 74 | 74 | $tvsql = ''; |
| 75 | 75 | $tvjoin = ''; |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $rs = $modx->db->select( |
| 86 | 86 | "{$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", |
| 87 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 88 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
| 87 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
| 88 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
| 89 | 89 | "", |
| 90 | 90 | "category,name" |
| 91 | 91 | ); |
| 92 | 92 | $limit = $modx->db->getRecordCount($rs); |
| 93 | 93 | |
| 94 | - if($limit < 1) return false; |
|
| 94 | + if ($limit < 1) return false; |
|
| 95 | 95 | |
| 96 | 96 | $result = array(); |
| 97 | 97 | while ($row = $modx->db->getRow($rs)) { |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | return $result; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - function prepareCategoryArrays() { |
|
| 104 | - foreach($this->items as $type=>$items) { |
|
| 105 | - foreach((array)$items as $item) { |
|
| 103 | + function prepareCategoryArrays(){ |
|
| 104 | + foreach ($this->items as $type=>$items) { |
|
| 105 | + foreach ((array) $items as $item) { |
|
| 106 | 106 | $catid = $item['catid'] ? $item['catid'] : 0; |
| 107 | 107 | $this->categories[$catid] = $item['category']; |
| 108 | 108 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | natcasesort($this->categories); |
| 116 | 116 | |
| 117 | 117 | // Now sort by name |
| 118 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 119 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 118 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
| 119 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
| 120 | 120 | return strcasecmp($a['name'], $b['name']); |
| 121 | 121 | }); |
| 122 | 122 | } |
@@ -1,19 +1,24 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 2 | +if(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."); |
|
| 4 | +} |
|
| 3 | 5 | |
| 4 | -class mgrResources { |
|
| 6 | +class mgrResources |
|
| 7 | +{ |
|
| 5 | 8 | var $types = array(); |
| 6 | 9 | var $items = array(); |
| 7 | 10 | var $categories = array(); |
| 8 | 11 | var $itemsPerCategory = array(); |
| 9 | 12 | |
| 10 | - function __construct() { |
|
| 13 | + function __construct() |
|
| 14 | + { |
|
| 11 | 15 | $this->setTypes(); |
| 12 | 16 | $this->queryItemsFromDB(); |
| 13 | 17 | $this->prepareCategoryArrays(); |
| 14 | 18 | } |
| 15 | 19 | |
| 16 | - function setTypes() { |
|
| 20 | + function setTypes() |
|
| 21 | + { |
|
| 17 | 22 | global $_lang; |
| 18 | 23 | $this->types['site_templates'] = array( |
| 19 | 24 | 'title'=>$_lang["manage_templates"], |
@@ -48,7 +53,8 @@ discard block |
||
| 48 | 53 | ); |
| 49 | 54 | } |
| 50 | 55 | |
| 51 | - function queryItemsFromDB() { |
|
| 56 | + function queryItemsFromDB() |
|
| 57 | + { |
|
| 52 | 58 | foreach($this->types as $resourceTable=>$type) { |
| 53 | 59 | if($this->hasAnyPermissions($type['permissions'])) { |
| 54 | 60 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
@@ -57,16 +63,19 @@ discard block |
||
| 57 | 63 | } |
| 58 | 64 | } |
| 59 | 65 | |
| 60 | - function hasAnyPermissions($permissions) { |
|
| 66 | + function hasAnyPermissions($permissions) |
|
| 67 | + { |
|
| 61 | 68 | global $modx; |
| 62 | 69 | |
| 63 | - foreach($permissions as $p) |
|
| 64 | - if($modx->hasPermission($p)) return true; |
|
| 70 | + foreach($permissions as $p) { |
|
| 71 | + if($modx->hasPermission($p)) return true; |
|
| 72 | + } |
|
| 65 | 73 | |
| 66 | 74 | return false; |
| 67 | 75 | } |
| 68 | 76 | |
| 69 | - function queryResources($resourceTable, $nameField = 'name') { |
|
| 77 | + function queryResources($resourceTable, $nameField = 'name') |
|
| 78 | + { |
|
| 70 | 79 | global $modx, $_lang; |
| 71 | 80 | |
| 72 | 81 | $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
@@ -77,8 +86,9 @@ discard block |
||
| 77 | 86 | $tvsql = 'site_tmplvars.caption, '; |
| 78 | 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')); |
| 79 | 88 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
| 89 | + } else { |
|
| 90 | + $sttfield = ''; |
|
| 80 | 91 | } |
| 81 | - else $sttfield = ''; |
|
| 82 | 92 | |
| 83 | 93 | $selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
| 84 | 94 | |
@@ -91,7 +101,9 @@ discard block |
||
| 91 | 101 | ); |
| 92 | 102 | $limit = $modx->db->getRecordCount($rs); |
| 93 | 103 | |
| 94 | - if($limit < 1) return false; |
|
| 104 | + if($limit < 1) { |
|
| 105 | + return false; |
|
| 106 | + } |
|
| 95 | 107 | |
| 96 | 108 | $result = array(); |
| 97 | 109 | while ($row = $modx->db->getRow($rs)) { |
@@ -100,7 +112,8 @@ discard block |
||
| 100 | 112 | return $result; |
| 101 | 113 | } |
| 102 | 114 | |
| 103 | - function prepareCategoryArrays() { |
|
| 115 | + function prepareCategoryArrays() |
|
| 116 | + { |
|
| 104 | 117 | foreach($this->items as $type=>$items) { |
| 105 | 118 | foreach((array)$items as $item) { |
| 106 | 119 | $catid = $item['catid'] ? $item['catid'] : 0; |
@@ -116,7 +129,7 @@ discard block |
||
| 116 | 129 | |
| 117 | 130 | // Now sort by name |
| 118 | 131 | foreach($this->itemsPerCategory as $catid=>$items) { |
| 119 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 132 | + usort($this->itemsPerCategory[$catid], function ($a, $b){ |
|
| 120 | 133 | return strcasecmp($a['name'], $b['name']); |
| 121 | 134 | }); |
| 122 | 135 | } |
@@ -12,14 +12,14 @@ discard block |
||
| 12 | 12 | $collation = $modx->db->getRow($res, 'num'); |
| 13 | 13 | |
| 14 | 14 | $serverArr = array( |
| 15 | - $_lang['modx_version'] => $modx->getVersionData('version') . ' ' . $newversiontext,
|
|
| 15 | + $_lang['modx_version'] => $modx->getVersionData('version').' '.$newversiontext,
|
|
| 16 | 16 | $_lang['release_date'] => $modx->getVersionData('release_date'),
|
| 17 | 17 | 'PHP Version' => phpversion(), |
| 18 | - 'phpInfo()' => '<a class="text-underline" href="javascript:;" onclick="viewPHPInfo();return false;">' . $_lang['view'] . '</a>', |
|
| 18 | + 'phpInfo()' => '<a class="text-underline" href="javascript:;" onclick="viewPHPInfo();return false;">'.$_lang['view'].'</a>', |
|
| 19 | 19 | $_lang['access_permissions'] => ($use_udperms == 1 ? $_lang['enabled'] : $_lang['disabled']), |
| 20 | 20 | $_lang['servertime'] => strftime('%H:%M:%S', time()),
|
| 21 | 21 | $_lang['localtime'] => strftime('%H:%M:%S', time() + $server_offset_time),
|
| 22 | - $_lang['serveroffset'] => $server_offset_time / (60 * 60) . ' h', |
|
| 22 | + $_lang['serveroffset'] => $server_offset_time / (60 * 60).' h', |
|
| 23 | 23 | $_lang['database_name'] => trim($dbase, '`'), |
| 24 | 24 | $_lang['database_server'] => $database_server, |
| 25 | 25 | $_lang['database_version'] => $modx->db->getVersion(), |
@@ -95,33 +95,33 @@ discard block |
||
| 95 | 95 | </thead> |
| 96 | 96 | <tbody> |
| 97 | 97 | <?php |
| 98 | - $sql = "SHOW TABLE STATUS FROM $dbase LIKE '" . $modx->db->escape($modx->db->config['table_prefix']) . "%';"; |
|
| 98 | + $sql = "SHOW TABLE STATUS FROM $dbase LIKE '".$modx->db->escape($modx->db->config['table_prefix'])."%';"; |
|
| 99 | 99 | $rs = $modx->db->query($sql); |
| 100 | 100 | $i = 0; |
| 101 | 101 | while ($log_status = $modx->db->getRow($rs)) {
|
| 102 | 102 | ?> |
| 103 | 103 | <tr> |
| 104 | 104 | <td class="text-primary"><b><?= $log_status['Name'] ?></b></td> |
| 105 | - <td class="text-xs-center"><?= (!empty($log_status['Comment']) ? '<i class="' . $_style['actions_help'] . '" data-tooltip="' . $log_status['Comment'] . '"></i>' : '') ?></td> |
|
| 105 | + <td class="text-xs-center"><?= (!empty($log_status['Comment']) ? '<i class="'.$_style['actions_help'].'" data-tooltip="'.$log_status['Comment'].'"></i>' : '') ?></td> |
|
| 106 | 106 | <td class="text-xs-right"><?= $log_status['Rows'] ?></td> |
| 107 | 107 | |
| 108 | 108 | <?php |
| 109 | 109 | $truncateable = array( |
| 110 | - $modx->db->config['table_prefix'] . 'event_log', |
|
| 111 | - $modx->db->config['table_prefix'] . 'manager_log', |
|
| 110 | + $modx->db->config['table_prefix'].'event_log', |
|
| 111 | + $modx->db->config['table_prefix'].'manager_log', |
|
| 112 | 112 | ); |
| 113 | 113 | if ($modx->hasPermission('settings') && in_array($log_status['Name'], $truncateable)) {
|
| 114 | 114 | echo "<td class=\"text-xs-right\">"; |
| 115 | - echo "<a class=\"text-danger\" href='index.php?a=54&mode=$action&u=" . $log_status['Name'] . "' title='" . $_lang['truncate_table'] . "'>" . $modx->nicesize($log_status['Data_length'] + $log_status['Data_free']) . "</a>"; |
|
| 115 | + echo "<a class=\"text-danger\" href='index.php?a=54&mode=$action&u=".$log_status['Name']."' title='".$_lang['truncate_table']."'>".$modx->nicesize($log_status['Data_length'] + $log_status['Data_free'])."</a>"; |
|
| 116 | 116 | echo "</td>"; |
| 117 | 117 | } else {
|
| 118 | - echo "<td class=\"text-xs-right\">" . $modx->nicesize($log_status['Data_length'] + $log_status['Data_free']) . "</td>"; |
|
| 118 | + echo "<td class=\"text-xs-right\">".$modx->nicesize($log_status['Data_length'] + $log_status['Data_free'])."</td>"; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | if ($modx->hasPermission('settings')) {
|
| 122 | - echo "<td class=\"text-xs-right\">" . ($log_status['Data_free'] > 0 ? "<a class=\"text-danger\" href='index.php?a=54&mode=$action&t=" . $log_status['Name'] . "' title='" . $_lang['optimize_table'] . "' ><span>" . $modx->nicesize($log_status['Data_free']) . "</span></a>" : "-") . "</td>"; |
|
| 122 | + echo "<td class=\"text-xs-right\">".($log_status['Data_free'] > 0 ? "<a class=\"text-danger\" href='index.php?a=54&mode=$action&t=".$log_status['Name']."' title='".$_lang['optimize_table']."' ><span>".$modx->nicesize($log_status['Data_free'])."</span></a>" : "-")."</td>"; |
|
| 123 | 123 | } else {
|
| 124 | - echo "<td class=\"text-xs-right\">" . ($log_status['Data_free'] > 0 ? $modx->nicesize($log_status['Data_free']) : "-") . "</td>"; |
|
| 124 | + echo "<td class=\"text-xs-right\">".($log_status['Data_free'] > 0 ? $modx->nicesize($log_status['Data_free']) : "-")."</td>"; |
|
| 125 | 125 | } |
| 126 | 126 | ?> |
| 127 | 127 | <td class="text-xs-right"><?= $modx->nicesize($log_status['Data_length'] - $log_status['Data_free']) ?></td> |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | <tr class="unstyled"> |
| 137 | 137 | <td class="text-xs-right"><?= $_lang['database_table_totals'] ?></td> |
| 138 | 138 | <td colspan="3"> </td> |
| 139 | - <td class="text-xs-right"><?= $totaloverhead > 0 ? "<b class=\"text-danger\">" . $modx->nicesize($totaloverhead) . "</b><br />(" . number_format($totaloverhead) . " B)" : "-" ?></td>
|
|
| 139 | + <td class="text-xs-right"><?= $totaloverhead > 0 ? "<b class=\"text-danger\">".$modx->nicesize($totaloverhead)."</b><br />(".number_format($totaloverhead)." B)" : "-" ?></td>
|
|
| 140 | 140 | <td colspan="2"> </td> |
| 141 | - <td class="text-xs-right"><?= "<b>" . $modx->nicesize($total) . "</b><br />(" . number_format($total) . " B)" ?></td>
|
|
| 141 | + <td class="text-xs-right"><?= "<b>".$modx->nicesize($total)."</b><br />(".number_format($total)." B)" ?></td>
|
|
| 142 | 142 | </tr> |
| 143 | 143 | </tbody> |
| 144 | 144 | </table> |
@@ -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('logs')) {
|
|
| 5 | +if (!$modx->hasPermission('logs')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | <table class="table data table-sm nowrap"> |
| 56 | 56 | <tbody> |
| 57 | 57 | <?php |
| 58 | - foreach ($serverArr as $key => $value) {
|
|
| 58 | + foreach ($serverArr as $key => $value) { |
|
| 59 | 59 | ?> |
| 60 | 60 | <tr> |
| 61 | 61 | <td width="1%"><?= $key ?></td> |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $sql = "SHOW TABLE STATUS FROM $dbase LIKE '" . $modx->db->escape($modx->db->config['table_prefix']) . "%';"; |
| 99 | 99 | $rs = $modx->db->query($sql); |
| 100 | 100 | $i = 0; |
| 101 | - while ($log_status = $modx->db->getRow($rs)) {
|
|
| 101 | + while ($log_status = $modx->db->getRow($rs)) { |
|
| 102 | 102 | ?> |
| 103 | 103 | <tr> |
| 104 | 104 | <td class="text-primary"><b><?= $log_status['Name'] ?></b></td> |
@@ -110,17 +110,17 @@ discard block |
||
| 110 | 110 | $modx->db->config['table_prefix'] . 'event_log', |
| 111 | 111 | $modx->db->config['table_prefix'] . 'manager_log', |
| 112 | 112 | ); |
| 113 | - if ($modx->hasPermission('settings') && in_array($log_status['Name'], $truncateable)) {
|
|
| 113 | + if ($modx->hasPermission('settings') && in_array($log_status['Name'], $truncateable)) { |
|
| 114 | 114 | echo "<td class=\"text-xs-right\">"; |
| 115 | 115 | echo "<a class=\"text-danger\" href='index.php?a=54&mode=$action&u=" . $log_status['Name'] . "' title='" . $_lang['truncate_table'] . "'>" . $modx->nicesize($log_status['Data_length'] + $log_status['Data_free']) . "</a>"; |
| 116 | 116 | echo "</td>"; |
| 117 | - } else {
|
|
| 117 | + } else { |
|
| 118 | 118 | echo "<td class=\"text-xs-right\">" . $modx->nicesize($log_status['Data_length'] + $log_status['Data_free']) . "</td>"; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if ($modx->hasPermission('settings')) {
|
|
| 121 | + if ($modx->hasPermission('settings')) { |
|
| 122 | 122 | echo "<td class=\"text-xs-right\">" . ($log_status['Data_free'] > 0 ? "<a class=\"text-danger\" href='index.php?a=54&mode=$action&t=" . $log_status['Name'] . "' title='" . $_lang['optimize_table'] . "' ><span>" . $modx->nicesize($log_status['Data_free']) . "</span></a>" : "-") . "</td>"; |
| 123 | - } else {
|
|
| 123 | + } else { |
|
| 124 | 124 | echo "<td class=\"text-xs-right\">" . ($log_status['Data_free'] > 0 ? $modx->nicesize($log_status['Data_free']) : "-") . "</td>"; |
| 125 | 125 | } |
| 126 | 126 | ?> |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if(IN_MANAGER_MODE != "true") {
|
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('change_password')) {
|
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | ?> |
| 9 | 9 | |
@@ -1,8 +1,8 @@ |
||
| 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('change_password')) {
|
|
| 5 | +if (!$modx->hasPermission('change_password')) {
|
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | ?> |
@@ -1,8 +1,8 @@ |
||
| 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('change_password')) {
|
|
| 5 | +if(!$modx->hasPermission('change_password')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | ?> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(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 | // (un)publishing of documents, version 2! |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | <?php if($num_rows_pub) printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
| 33 | 33 | <?php if($num_rows_unpub) printf('<p>' . $_lang["refresh_unpublished"] . '</p>', $num_rows_unpub) ?> |
| 34 | 34 | <?php |
| 35 | - $modx->clearCache('full', true); |
|
| 36 | - // invoke OnSiteRefresh event |
|
| 37 | - $modx->invokeEvent("OnSiteRefresh"); |
|
| 38 | - ?> |
|
| 35 | + $modx->clearCache('full', true); |
|
| 36 | + // invoke OnSiteRefresh event |
|
| 37 | + $modx->invokeEvent("OnSiteRefresh"); |
|
| 38 | + ?> |
|
| 39 | 39 | </div> |
| 40 | 40 | </div> |
@@ -1,5 +1,5 @@ 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 | 5 | |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | <div class="tab-page"> |
| 31 | 31 | <div class="container container-body"> |
| 32 | - <?php if($num_rows_pub) printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
| 33 | - <?php if($num_rows_unpub) printf('<p>' . $_lang["refresh_unpublished"] . '</p>', $num_rows_unpub) ?> |
|
| 32 | + <?php if ($num_rows_pub) printf('<p>'.$_lang["refresh_published"].'</p>', $num_rows_pub) ?> |
|
| 33 | + <?php if ($num_rows_unpub) printf('<p>'.$_lang["refresh_unpublished"].'</p>', $num_rows_unpub) ?> |
|
| 34 | 34 | <?php |
| 35 | 35 | $modx->clearCache('full', true); |
| 36 | 36 | // invoke OnSiteRefresh event |
@@ -29,10 +29,12 @@ |
||
| 29 | 29 | |
| 30 | 30 | <div class="tab-page"> |
| 31 | 31 | <div class="container container-body"> |
| 32 | - <?php if($num_rows_pub) printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
| 32 | + <?php if($num_rows_pub) { |
|
| 33 | + printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
| 33 | 34 | <?php if($num_rows_unpub) printf('<p>' . $_lang["refresh_unpublished"] . '</p>', $num_rows_unpub) ?> |
| 34 | 35 | <?php |
| 35 | 36 | $modx->clearCache('full', true); |
| 37 | +} |
|
| 36 | 38 | // invoke OnSiteRefresh event |
| 37 | 39 | $modx->invokeEvent("OnSiteRefresh"); |
| 38 | 40 | ?> |