@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | if(!$modx->hasPermission('edit_module')) { |
| 7 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -26,91 +26,91 @@ discard block |
||
| 26 | 26 | // check to see the editor isn't locked |
| 27 | 27 | $rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
| 28 | 28 | if($username = $modx->db->getValue($rs)) { |
| 29 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
| 29 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
| 30 | 30 | } |
| 31 | 31 | // end check for lock |
| 32 | 32 | |
| 33 | 33 | // take action |
| 34 | 34 | switch($_REQUEST['op']) { |
| 35 | - case 'add': |
|
| 36 | - // convert ids to numbers |
|
| 37 | - $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
| 38 | - |
|
| 39 | - if(count($opids) > 0) { |
|
| 40 | - // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
| 41 | - $rt = strtolower($_REQUEST["rt"]); |
|
| 42 | - if($rt == 'chunk') { |
|
| 43 | - $type = 10; |
|
| 44 | - } |
|
| 45 | - if($rt == 'doc') { |
|
| 46 | - $type = 20; |
|
| 47 | - } |
|
| 48 | - if($rt == 'plug') { |
|
| 49 | - $type = 30; |
|
| 50 | - } |
|
| 51 | - if($rt == 'snip') { |
|
| 52 | - $type = 40; |
|
| 53 | - } |
|
| 54 | - if($rt == 'tpl') { |
|
| 55 | - $type = 50; |
|
| 56 | - } |
|
| 57 | - if($rt == 'tv') { |
|
| 58 | - $type = 60; |
|
| 59 | - } |
|
| 60 | - $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
| 61 | - foreach($opids as $opid) { |
|
| 62 | - $modx->db->insert(array( |
|
| 63 | - 'module' => $id, |
|
| 64 | - 'resource' => $opid, |
|
| 65 | - 'type' => $type, |
|
| 66 | - ), $tbl_site_module_depobj); |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - break; |
|
| 70 | - case 'del': |
|
| 71 | - // convert ids to numbers |
|
| 72 | - $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
| 73 | - |
|
| 74 | - // get resources that needs to be removed |
|
| 75 | - $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
| 76 | - // loop through resources and look for plugins and snippets |
|
| 77 | - $plids = array(); |
|
| 78 | - $snid = array(); |
|
| 79 | - while($row = $modx->db->getRow($ds)) { |
|
| 80 | - if($row['type'] == '30') { |
|
| 81 | - $plids[$i] = $row['resource']; |
|
| 82 | - } |
|
| 83 | - if($row['type'] == '40') { |
|
| 84 | - $snids[$i] = $row['resource']; |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - // get guid |
|
| 88 | - $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
| 89 | - $guid = $modx->db->getValue($ds); |
|
| 90 | - // reset moduleguid for deleted resources |
|
| 91 | - if(($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | - if($cp) { |
|
| 93 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
| 94 | - } |
|
| 95 | - if($cs) { |
|
| 96 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
| 97 | - } |
|
| 98 | - // reset cache |
|
| 99 | - $modx->clearCache('full'); |
|
| 100 | - } |
|
| 101 | - $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
| 102 | - break; |
|
| 35 | + case 'add': |
|
| 36 | + // convert ids to numbers |
|
| 37 | + $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
| 38 | + |
|
| 39 | + if(count($opids) > 0) { |
|
| 40 | + // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
| 41 | + $rt = strtolower($_REQUEST["rt"]); |
|
| 42 | + if($rt == 'chunk') { |
|
| 43 | + $type = 10; |
|
| 44 | + } |
|
| 45 | + if($rt == 'doc') { |
|
| 46 | + $type = 20; |
|
| 47 | + } |
|
| 48 | + if($rt == 'plug') { |
|
| 49 | + $type = 30; |
|
| 50 | + } |
|
| 51 | + if($rt == 'snip') { |
|
| 52 | + $type = 40; |
|
| 53 | + } |
|
| 54 | + if($rt == 'tpl') { |
|
| 55 | + $type = 50; |
|
| 56 | + } |
|
| 57 | + if($rt == 'tv') { |
|
| 58 | + $type = 60; |
|
| 59 | + } |
|
| 60 | + $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
| 61 | + foreach($opids as $opid) { |
|
| 62 | + $modx->db->insert(array( |
|
| 63 | + 'module' => $id, |
|
| 64 | + 'resource' => $opid, |
|
| 65 | + 'type' => $type, |
|
| 66 | + ), $tbl_site_module_depobj); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + break; |
|
| 70 | + case 'del': |
|
| 71 | + // convert ids to numbers |
|
| 72 | + $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
| 73 | + |
|
| 74 | + // get resources that needs to be removed |
|
| 75 | + $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
| 76 | + // loop through resources and look for plugins and snippets |
|
| 77 | + $plids = array(); |
|
| 78 | + $snid = array(); |
|
| 79 | + while($row = $modx->db->getRow($ds)) { |
|
| 80 | + if($row['type'] == '30') { |
|
| 81 | + $plids[$i] = $row['resource']; |
|
| 82 | + } |
|
| 83 | + if($row['type'] == '40') { |
|
| 84 | + $snids[$i] = $row['resource']; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + // get guid |
|
| 88 | + $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
| 89 | + $guid = $modx->db->getValue($ds); |
|
| 90 | + // reset moduleguid for deleted resources |
|
| 91 | + if(($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | + if($cp) { |
|
| 93 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
| 94 | + } |
|
| 95 | + if($cs) { |
|
| 96 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
| 97 | + } |
|
| 98 | + // reset cache |
|
| 99 | + $modx->clearCache('full'); |
|
| 100 | + } |
|
| 101 | + $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
| 102 | + break; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // load record |
| 106 | 106 | $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'"); |
| 107 | 107 | $content = $modx->db->getRow($rs); |
| 108 | 108 | if(!$content) { |
| 109 | - $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
| 109 | + $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
| 110 | 110 | } |
| 111 | 111 | $_SESSION['itemname'] = $content['name']; |
| 112 | 112 | if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
| 113 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 113 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | ?> |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | <tr> |
| 204 | 204 | <td valign="top" align="left"> |
| 205 | 205 | <?php |
| 206 | - $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
| 206 | + $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
| 207 | 207 | CASE smd.type |
| 208 | 208 | WHEN 10 THEN 'Chunk' |
| 209 | 209 | WHEN 20 THEN 'Document' |
@@ -218,18 +218,18 @@ discard block |
||
| 218 | 218 | LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40' |
| 219 | 219 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50' |
| 220 | 220 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name"); |
| 221 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 222 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
| 223 | - $grd->noRecordMsg = $_lang["no_records_found"]; |
|
| 224 | - $grd->cssClass = "grid"; |
|
| 225 | - $grd->columnHeaderClass = "gridHeader"; |
|
| 226 | - $grd->itemClass = "gridItem"; |
|
| 227 | - $grd->altItemClass = "gridAltItem"; |
|
| 228 | - $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
| 229 | - $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
| 230 | - $grd->fields = "name,type"; |
|
| 231 | - echo $grd->render(); |
|
| 232 | - ?> |
|
| 221 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 222 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
| 223 | + $grd->noRecordMsg = $_lang["no_records_found"]; |
|
| 224 | + $grd->cssClass = "grid"; |
|
| 225 | + $grd->columnHeaderClass = "gridHeader"; |
|
| 226 | + $grd->itemClass = "gridItem"; |
|
| 227 | + $grd->altItemClass = "gridAltItem"; |
|
| 228 | + $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
| 229 | + $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
| 230 | + $grd->fields = "name,type"; |
|
| 231 | + echo $grd->render(); |
|
| 232 | + ?> |
|
| 233 | 233 | </td> |
| 234 | 234 | <td valign="top" style="width: 150px;"> |
| 235 | 235 | <a class="btn btn-block btn-danger text-left" style="margin-bottom:10px;" href="javascript:;" onclick="removeDependencies();return false;"><i class="<?php echo $_style["actions_delete"] ?>"></i> <?php echo $_lang['remove']; ?></a> |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -if(!$modx->hasPermission('edit_module')) { |
|
| 6 | +if (!$modx->hasPermission('edit_module')) { |
|
| 7 | 7 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 8 | 8 | } |
| 9 | 9 | |
@@ -24,41 +24,41 @@ discard block |
||
| 24 | 24 | $modx->manager->initPageViewState(); |
| 25 | 25 | |
| 26 | 26 | // check to see the editor isn't locked |
| 27 | -$rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
|
| 28 | -if($username = $modx->db->getValue($rs)) { |
|
| 27 | +$rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
| 28 | +if ($username = $modx->db->getValue($rs)) { |
|
| 29 | 29 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
| 30 | 30 | } |
| 31 | 31 | // end check for lock |
| 32 | 32 | |
| 33 | 33 | // take action |
| 34 | -switch($_REQUEST['op']) { |
|
| 34 | +switch ($_REQUEST['op']) { |
|
| 35 | 35 | case 'add': |
| 36 | 36 | // convert ids to numbers |
| 37 | 37 | $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
| 38 | 38 | |
| 39 | - if(count($opids) > 0) { |
|
| 39 | + if (count($opids) > 0) { |
|
| 40 | 40 | // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
| 41 | 41 | $rt = strtolower($_REQUEST["rt"]); |
| 42 | - if($rt == 'chunk') { |
|
| 42 | + if ($rt == 'chunk') { |
|
| 43 | 43 | $type = 10; |
| 44 | 44 | } |
| 45 | - if($rt == 'doc') { |
|
| 45 | + if ($rt == 'doc') { |
|
| 46 | 46 | $type = 20; |
| 47 | 47 | } |
| 48 | - if($rt == 'plug') { |
|
| 48 | + if ($rt == 'plug') { |
|
| 49 | 49 | $type = 30; |
| 50 | 50 | } |
| 51 | - if($rt == 'snip') { |
|
| 51 | + if ($rt == 'snip') { |
|
| 52 | 52 | $type = 40; |
| 53 | 53 | } |
| 54 | - if($rt == 'tpl') { |
|
| 54 | + if ($rt == 'tpl') { |
|
| 55 | 55 | $type = 50; |
| 56 | 56 | } |
| 57 | - if($rt == 'tv') { |
|
| 57 | + if ($rt == 'tv') { |
|
| 58 | 58 | $type = 60; |
| 59 | 59 | } |
| 60 | - $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
| 61 | - foreach($opids as $opid) { |
|
| 60 | + $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (".implode(',', $opids).") AND type='{$type}'"); |
|
| 61 | + foreach ($opids as $opid) { |
|
| 62 | 62 | $modx->db->insert(array( |
| 63 | 63 | 'module' => $id, |
| 64 | 64 | 'resource' => $opid, |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
| 73 | 73 | |
| 74 | 74 | // get resources that needs to be removed |
| 75 | - $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
| 75 | + $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (".implode(",", $opids).")"); |
|
| 76 | 76 | // loop through resources and look for plugins and snippets |
| 77 | 77 | $plids = array(); |
| 78 | 78 | $snid = array(); |
| 79 | - while($row = $modx->db->getRow($ds)) { |
|
| 80 | - if($row['type'] == '30') { |
|
| 79 | + while ($row = $modx->db->getRow($ds)) { |
|
| 80 | + if ($row['type'] == '30') { |
|
| 81 | 81 | $plids[$i] = $row['resource']; |
| 82 | 82 | } |
| 83 | - if($row['type'] == '40') { |
|
| 83 | + if ($row['type'] == '40') { |
|
| 84 | 84 | $snids[$i] = $row['resource']; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -88,28 +88,28 @@ discard block |
||
| 88 | 88 | $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
| 89 | 89 | $guid = $modx->db->getValue($ds); |
| 90 | 90 | // reset moduleguid for deleted resources |
| 91 | - if(($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | - if($cp) { |
|
| 93 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
| 91 | + if (($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | + if ($cp) { |
|
| 93 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (".implode(',', $plids).") AND moduleguid='{$guid}'"); |
|
| 94 | 94 | } |
| 95 | - if($cs) { |
|
| 96 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
| 95 | + if ($cs) { |
|
| 96 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (".implode(',', $snids).") AND moduleguid='{$guid}'"); |
|
| 97 | 97 | } |
| 98 | 98 | // reset cache |
| 99 | 99 | $modx->clearCache('full'); |
| 100 | 100 | } |
| 101 | - $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
| 101 | + $modx->db->delete($tbl_site_module_depobj, "id IN (".implode(',', $opids).")"); |
|
| 102 | 102 | break; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // load record |
| 106 | 106 | $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'"); |
| 107 | 107 | $content = $modx->db->getRow($rs); |
| 108 | -if(!$content) { |
|
| 108 | +if (!$content) { |
|
| 109 | 109 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
| 110 | 110 | } |
| 111 | 111 | $_SESSION['itemname'] = $content['name']; |
| 112 | -if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 112 | +if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 113 | 113 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -188,13 +188,13 @@ discard block |
||
| 188 | 188 | <input type="hidden" name="id" value="<?php echo $content['id']; ?>" /> |
| 189 | 189 | |
| 190 | 190 | <h1> |
| 191 | - <i class="fa fa-cogs"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['module_resource_title']) ?> |
|
| 191 | + <i class="fa fa-cogs"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['module_resource_title']) ?> |
|
| 192 | 192 | </h1> |
| 193 | 193 | |
| 194 | 194 | <?php echo $_style['actionbuttons']['dynamic']['close'] ?> |
| 195 | 195 | |
| 196 | 196 | <div class="section"> |
| 197 | - <div class="sectionHeader"><?php echo $content["name"] . " - " . $_lang['module_resource_title']; ?></div> |
|
| 197 | + <div class="sectionHeader"><?php echo $content["name"]." - ".$_lang['module_resource_title']; ?></div> |
|
| 198 | 198 | <div class="sectionBody"> |
| 199 | 199 | <p><?php echo $_lang['module_resource_msg']; ?></p> |
| 200 | 200 | <br /> |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40' |
| 219 | 219 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50' |
| 220 | 220 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name"); |
| 221 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 221 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
| 222 | 222 | $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
| 223 | 223 | $grd->noRecordMsg = $_lang["no_records_found"]; |
| 224 | 224 | $grd->cssClass = "grid"; |
| 225 | 225 | $grd->columnHeaderClass = "gridHeader"; |
| 226 | 226 | $grd->itemClass = "gridItem"; |
| 227 | 227 | $grd->altItemClass = "gridAltItem"; |
| 228 | - $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
| 228 | + $grd->columns = $_lang["element_name"]." ,".$_lang["type"]; |
|
| 229 | 229 | $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
| 230 | 230 | $grd->fields = "name,type"; |
| 231 | 231 | echo $grd->render(); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
| 23 | 23 | { |
| 24 | - $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
|
| 24 | + $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | foreach( $cm->getCategories() as $category ) |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | if( empty( $category ) ) |
| 108 | 108 | { |
| 109 | - $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
| 110 | - return; |
|
| 109 | + $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
| 110 | + return; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if( $cm->isCategoryExists( $category ) ) |
| 114 | 114 | { |
| 115 | - $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
| 116 | - return; |
|
| 115 | + $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
| 116 | + return; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if( $cm->addCategory( $category, $rank ) !== 0 ) |
@@ -2,16 +2,16 @@ discard block |
||
| 2 | 2 | /** |
| 3 | 3 | * Ajax Requests |
| 4 | 4 | */ |
| 5 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 5 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) |
|
| 9 | +if (isset($_REQUEST[$cm->get('request_key')]['ajax'])) |
|
| 10 | 10 | { |
| 11 | 11 | $_data = $_REQUEST[$cm->get('request_key')]; |
| 12 | 12 | $output = ''; |
| 13 | 13 | $task = $_data['task']; |
| 14 | - switch( $task ) |
|
| 14 | + switch ($task) |
|
| 15 | 15 | { |
| 16 | 16 | /** |
| 17 | 17 | * get categories |
@@ -19,19 +19,19 @@ discard block |
||
| 19 | 19 | case 'categorize_load_elements': |
| 20 | 20 | $elements = $_data['elements']; |
| 21 | 21 | |
| 22 | - if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
|
| 22 | + if ($uncategorized_elements = $cm->getAssignedElements(0, $_data['elements'])) |
|
| 23 | 23 | { |
| 24 | 24 | $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - foreach( $cm->getCategories() as $category ) |
|
| 27 | + foreach ($cm->getCategories() as $category) |
|
| 28 | 28 | { |
| 29 | - $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] ); |
|
| 29 | + $category['elements'] = $cm->getAssignedElements($category['id'], $_data['elements']); |
|
| 30 | 30 | $output .= $cm->renderView('chunks/categorize/category', $category); |
| 31 | 31 | } |
| 32 | 32 | break; |
| 33 | 33 | } |
| 34 | - exit( $output ); |
|
| 34 | + exit($output); |
|
| 35 | 35 | } |
| 36 | 36 | /** |
| 37 | 37 | * Categorize elements |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476 |
| 42 | 42 | * |
| 43 | 43 | */ |
| 44 | -if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) |
|
| 44 | +if (isset($_POST[$cm->get('request_key')]['categorize']['submit'])) |
|
| 45 | 45 | { |
| 46 | 46 | $_data = $_POST[$cm->get('request_key')]['categorize']; |
| 47 | 47 | $_changes = 0; |
@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | 'categorize' |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | - if( !isset( $_data['elements'] ) ) |
|
| 57 | + if (!isset($_data['elements'])) |
|
| 58 | 58 | { |
| 59 | - $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' ); |
|
| 59 | + $cm->addMessage($cm->txt('cm_unknown_error'), 'categorize'); |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - foreach( $_data['elements'] as $element_id => $data ) |
|
| 63 | + foreach ($_data['elements'] as $element_id => $data) |
|
| 64 | 64 | { |
| 65 | - if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) |
|
| 65 | + if ($cm->updateElement($_data['elementsgroup'], $element_id, $data['category_id'])) |
|
| 66 | 66 | { |
| 67 | 67 | $cm->addMessage( |
| 68 | 68 | sprintf( |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if( $_changes === 0 ) |
|
| 81 | + if ($_changes === 0) |
|
| 82 | 82 | { |
| 83 | - $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' ); |
|
| 83 | + $cm->addMessage($cm->txt('cm_no_categorization'), 'categorize'); |
|
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | else |
@@ -98,29 +98,29 @@ discard block |
||
| 98 | 98 | /** |
| 99 | 99 | * Add a new category |
| 100 | 100 | */ |
| 101 | -if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) |
|
| 101 | +if (isset($_POST[$cm->get('request_key')]['add']['submit'])) |
|
| 102 | 102 | { |
| 103 | 103 | $_data = $_POST[$cm->get('request_key')]['add']['data']; |
| 104 | - $category = trim( html_entity_decode($_data['name']) ); |
|
| 104 | + $category = trim(html_entity_decode($_data['name'])); |
|
| 105 | 105 | $rank = (int) $_data['rank']; |
| 106 | 106 | |
| 107 | - if( empty( $category ) ) |
|
| 107 | + if (empty($category)) |
|
| 108 | 108 | { |
| 109 | - $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
| 109 | + $cm->addMessage($cm->txt('cm_enter_name_for_category'), 'add'); |
|
| 110 | 110 | return; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if( $cm->isCategoryExists( $category ) ) |
|
| 113 | + if ($cm->isCategoryExists($category)) |
|
| 114 | 114 | { |
| 115 | - $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
| 115 | + $cm->addMessage(sprintf($cm->txt('cm_category_x_exists'), $category), 'add'); |
|
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if( $cm->addCategory( $category, $rank ) !== 0 ) |
|
| 119 | + if ($cm->addCategory($category, $rank) !== 0) |
|
| 120 | 120 | { |
| 121 | 121 | $cm->addMessage( |
| 122 | 122 | sprintf( |
| 123 | - $cm->txt( 'cm_category_x_saved_at_position_y' ), |
|
| 123 | + $cm->txt('cm_category_x_saved_at_position_y'), |
|
| 124 | 124 | $category, |
| 125 | 125 | $rank |
| 126 | 126 | ), |
@@ -129,26 +129,26 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | else |
| 131 | 131 | { |
| 132 | - $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' ); |
|
| 132 | + $cm->addMessage($cm->txt('cm_unknown_error'), 'add'); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Sort categories |
| 138 | 138 | */ |
| 139 | -if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) |
|
| 139 | +if (isset($_POST[$cm->get('request_key')]['sort']['submit'])) |
|
| 140 | 140 | { |
| 141 | 141 | $categories = $_POST[$cm->get('request_key')]['sort']['data']; |
| 142 | 142 | $_changes = 0; |
| 143 | 143 | |
| 144 | - foreach( $categories as $category_id => $_data ) |
|
| 144 | + foreach ($categories as $category_id => $_data) |
|
| 145 | 145 | { |
| 146 | 146 | $data = array( |
| 147 | - 'category' => urldecode( $_data['category'] ), |
|
| 147 | + 'category' => urldecode($_data['category']), |
|
| 148 | 148 | 'rank' => $_data['rank'] |
| 149 | 149 | ); |
| 150 | 150 | |
| 151 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
| 151 | + if ($cm->updateCategory($category_id, $data)) |
|
| 152 | 152 | { |
| 153 | 153 | $cm->addMessage( |
| 154 | 154 | sprintf( |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if( $_changes === 0 ) |
|
| 165 | + if ($_changes === 0) |
|
| 166 | 166 | { |
| 167 | - $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort'); |
|
| 167 | + $cm->addMessage($cm->txt('cm_no_changes'), 'sort'); |
|
| 168 | 168 | } |
| 169 | 169 | else |
| 170 | 170 | { |
@@ -181,21 +181,21 @@ discard block |
||
| 181 | 181 | /** |
| 182 | 182 | * Edit categories |
| 183 | 183 | */ |
| 184 | -if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) |
|
| 184 | +if (isset($_POST[$cm->get('request_key')]['edit']['submit'])) |
|
| 185 | 185 | { |
| 186 | 186 | $categories = $_POST[$cm->get('request_key')]['edit']['data']; |
| 187 | 187 | $_changes = 0; |
| 188 | 188 | |
| 189 | - foreach( $categories as $category_id => $_data ) |
|
| 189 | + foreach ($categories as $category_id => $_data) |
|
| 190 | 190 | { |
| 191 | - if( isset( $_data['delete'] ) ) |
|
| 191 | + if (isset($_data['delete'])) |
|
| 192 | 192 | { |
| 193 | - if( $cm->deleteCategory( $category_id ) ) |
|
| 193 | + if ($cm->deleteCategory($category_id)) |
|
| 194 | 194 | { |
| 195 | 195 | $cm->addMessage( |
| 196 | 196 | sprintf( |
| 197 | 197 | $cm->txt('cm_category_x_deleted'), |
| 198 | - urldecode( $_data['origin'] ) |
|
| 198 | + urldecode($_data['origin']) |
|
| 199 | 199 | ), |
| 200 | 200 | 'edit' |
| 201 | 201 | ); |
@@ -205,16 +205,16 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | $data = array( |
| 208 | - 'category' => trim( html_entity_decode( $_data['category'] ) ), |
|
| 208 | + 'category' => trim(html_entity_decode($_data['category'])), |
|
| 209 | 209 | 'rank' => $_data['rank'] |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
| 212 | + if ($cm->updateCategory($category_id, $data)) |
|
| 213 | 213 | { |
| 214 | 214 | $cm->addMessage( |
| 215 | 215 | sprintf( |
| 216 | 216 | $cm->txt('cm_category_x_renamed_to_y'), |
| 217 | - urldecode( $_data['origin'] ), |
|
| 217 | + urldecode($_data['origin']), |
|
| 218 | 218 | $data['category'] |
| 219 | 219 | ), |
| 220 | 220 | 'edit' |
@@ -223,26 +223,26 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if( $_changes === 0 ) |
|
| 226 | + if ($_changes === 0) |
|
| 227 | 227 | { |
| 228 | - $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit'); |
|
| 228 | + $cm->addMessage($cm->txt('cm_no_changes'), 'edit'); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | 233 | * Delete singel category by $_GET |
| 234 | 234 | */ |
| 235 | -if( isset( $_GET[$cm->get('request_key')]['delete'] ) |
|
| 236 | - && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) |
|
| 235 | +if (isset($_GET[$cm->get('request_key')]['delete']) |
|
| 236 | + && !empty($_GET[$cm->get('request_key')]['delete'])) |
|
| 237 | 237 | { |
| 238 | - $category_id = (int)$_GET[$cm->get('request_key')]['delete']; |
|
| 238 | + $category_id = (int) $_GET[$cm->get('request_key')]['delete']; |
|
| 239 | 239 | |
| 240 | - if( $cm->deleteCategory( $category_id ) ) |
|
| 240 | + if ($cm->deleteCategory($category_id)) |
|
| 241 | 241 | { |
| 242 | 242 | $cm->addMessage( |
| 243 | 243 | sprintf( |
| 244 | 244 | $cm->txt('cm_category_x_deleted'), |
| 245 | - urldecode( $_GET[$cm->get('request_key')]['category'] ) |
|
| 245 | + urldecode($_GET[$cm->get('request_key')]['category']) |
|
| 246 | 246 | ), |
| 247 | 247 | 'edit' |
| 248 | 248 | ); |
@@ -251,15 +251,15 @@ discard block |
||
| 251 | 251 | /** |
| 252 | 252 | * Translate phrases |
| 253 | 253 | */ |
| 254 | -if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) |
|
| 254 | +if (isset($_POST[$cm->get('request_key')]['translate']['submit'])) |
|
| 255 | 255 | { |
| 256 | 256 | $translations = $_POST[$cm->get('request_key')]['translate']['data']; |
| 257 | 257 | |
| 258 | - foreach( $translations as $native_phrase => $translation ) |
|
| 258 | + foreach ($translations as $native_phrase => $translation) |
|
| 259 | 259 | { |
| 260 | - $native_phrase = urldecode( $native_phrase ); |
|
| 260 | + $native_phrase = urldecode($native_phrase); |
|
| 261 | 261 | |
| 262 | - if( empty( $translation ) ) |
|
| 262 | + if (empty($translation)) |
|
| 263 | 263 | { |
| 264 | 264 | $translation = $native_phrase; |
| 265 | 265 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | ); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $cm->c('Translator')->addTranslation( $native_phrase, $translation, 'phrase' ); |
|
| 275 | + $cm->c('Translator')->addTranslation($native_phrase, $translation, 'phrase'); |
|
| 276 | 276 | |
| 277 | 277 | $cm->addMessage( |
| 278 | 278 | sprintf( |
@@ -6,26 +6,22 @@ discard block |
||
| 6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) |
|
| 10 | -{ |
|
| 9 | +if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) { |
|
| 11 | 10 | $_data = $_REQUEST[$cm->get('request_key')]; |
| 12 | 11 | $output = ''; |
| 13 | 12 | $task = $_data['task']; |
| 14 | - switch( $task ) |
|
| 15 | - { |
|
| 13 | + switch( $task ) { |
|
| 16 | 14 | /** |
| 17 | 15 | * get categories |
| 18 | 16 | */ |
| 19 | 17 | case 'categorize_load_elements': |
| 20 | 18 | $elements = $_data['elements']; |
| 21 | 19 | |
| 22 | - if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
|
| 23 | - { |
|
| 20 | + if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) { |
|
| 24 | 21 | $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
| 25 | 22 | } |
| 26 | 23 | |
| 27 | - foreach( $cm->getCategories() as $category ) |
|
| 28 | - { |
|
| 24 | + foreach( $cm->getCategories() as $category ) { |
|
| 29 | 25 | $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] ); |
| 30 | 26 | $output .= $cm->renderView('chunks/categorize/category', $category); |
| 31 | 27 | } |
@@ -41,8 +37,7 @@ discard block |
||
| 41 | 37 | * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476 |
| 42 | 38 | * |
| 43 | 39 | */ |
| 44 | -if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) |
|
| 45 | -{ |
|
| 40 | +if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) { |
|
| 46 | 41 | $_data = $_POST[$cm->get('request_key')]['categorize']; |
| 47 | 42 | $_changes = 0; |
| 48 | 43 | |
@@ -54,16 +49,13 @@ discard block |
||
| 54 | 49 | 'categorize' |
| 55 | 50 | ); |
| 56 | 51 | |
| 57 | - if( !isset( $_data['elements'] ) ) |
|
| 58 | - { |
|
| 52 | + if( !isset( $_data['elements'] ) ) { |
|
| 59 | 53 | $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' ); |
| 60 | 54 | return; |
| 61 | 55 | } |
| 62 | 56 | |
| 63 | - foreach( $_data['elements'] as $element_id => $data ) |
|
| 64 | - { |
|
| 65 | - if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) |
|
| 66 | - { |
|
| 57 | + foreach( $_data['elements'] as $element_id => $data ) { |
|
| 58 | + if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) { |
|
| 67 | 59 | $cm->addMessage( |
| 68 | 60 | sprintf( |
| 69 | 61 | $cm->txt('cm_x_assigned_to_category_y'), |
@@ -78,13 +70,10 @@ discard block |
||
| 78 | 70 | } |
| 79 | 71 | } |
| 80 | 72 | |
| 81 | - if( $_changes === 0 ) |
|
| 82 | - { |
|
| 73 | + if( $_changes === 0 ) { |
|
| 83 | 74 | $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' ); |
| 84 | 75 | return; |
| 85 | - } |
|
| 86 | - else |
|
| 87 | - { |
|
| 76 | + } else { |
|
| 88 | 77 | $cm->addMessage( |
| 89 | 78 | sprintf( |
| 90 | 79 | $cm->txt('cm_x_changes_made'), |
@@ -98,26 +87,22 @@ discard block |
||
| 98 | 87 | /** |
| 99 | 88 | * Add a new category |
| 100 | 89 | */ |
| 101 | -if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) |
|
| 102 | -{ |
|
| 90 | +if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) { |
|
| 103 | 91 | $_data = $_POST[$cm->get('request_key')]['add']['data']; |
| 104 | 92 | $category = trim( html_entity_decode($_data['name']) ); |
| 105 | 93 | $rank = (int) $_data['rank']; |
| 106 | 94 | |
| 107 | - if( empty( $category ) ) |
|
| 108 | - { |
|
| 95 | + if( empty( $category ) ) { |
|
| 109 | 96 | $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
| 110 | 97 | return; |
| 111 | 98 | } |
| 112 | 99 | |
| 113 | - if( $cm->isCategoryExists( $category ) ) |
|
| 114 | - { |
|
| 100 | + if( $cm->isCategoryExists( $category ) ) { |
|
| 115 | 101 | $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
| 116 | 102 | return; |
| 117 | 103 | } |
| 118 | 104 | |
| 119 | - if( $cm->addCategory( $category, $rank ) !== 0 ) |
|
| 120 | - { |
|
| 105 | + if( $cm->addCategory( $category, $rank ) !== 0 ) { |
|
| 121 | 106 | $cm->addMessage( |
| 122 | 107 | sprintf( |
| 123 | 108 | $cm->txt( 'cm_category_x_saved_at_position_y' ), |
@@ -126,9 +111,7 @@ discard block |
||
| 126 | 111 | ), |
| 127 | 112 | 'add' |
| 128 | 113 | ); |
| 129 | - } |
|
| 130 | - else |
|
| 131 | - { |
|
| 114 | + } else { |
|
| 132 | 115 | $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' ); |
| 133 | 116 | } |
| 134 | 117 | } |
@@ -136,20 +119,17 @@ discard block |
||
| 136 | 119 | /** |
| 137 | 120 | * Sort categories |
| 138 | 121 | */ |
| 139 | -if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) |
|
| 140 | -{ |
|
| 122 | +if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) { |
|
| 141 | 123 | $categories = $_POST[$cm->get('request_key')]['sort']['data']; |
| 142 | 124 | $_changes = 0; |
| 143 | 125 | |
| 144 | - foreach( $categories as $category_id => $_data ) |
|
| 145 | - { |
|
| 126 | + foreach( $categories as $category_id => $_data ) { |
|
| 146 | 127 | $data = array( |
| 147 | 128 | 'category' => urldecode( $_data['category'] ), |
| 148 | 129 | 'rank' => $_data['rank'] |
| 149 | 130 | ); |
| 150 | 131 | |
| 151 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
| 152 | - { |
|
| 132 | + if( $cm->updateCategory( $category_id, $data ) ) { |
|
| 153 | 133 | $cm->addMessage( |
| 154 | 134 | sprintf( |
| 155 | 135 | $cm->txt('cm_category_x_moved_to_position_y'), |
@@ -162,12 +142,9 @@ discard block |
||
| 162 | 142 | } |
| 163 | 143 | } |
| 164 | 144 | |
| 165 | - if( $_changes === 0 ) |
|
| 166 | - { |
|
| 145 | + if( $_changes === 0 ) { |
|
| 167 | 146 | $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort'); |
| 168 | - } |
|
| 169 | - else |
|
| 170 | - { |
|
| 147 | + } else { |
|
| 171 | 148 | $cm->addMessage( |
| 172 | 149 | sprintf( |
| 173 | 150 | $cm->txt('cm_x_changes_made'), |
@@ -181,17 +158,13 @@ discard block |
||
| 181 | 158 | /** |
| 182 | 159 | * Edit categories |
| 183 | 160 | */ |
| 184 | -if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) |
|
| 185 | -{ |
|
| 161 | +if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) { |
|
| 186 | 162 | $categories = $_POST[$cm->get('request_key')]['edit']['data']; |
| 187 | 163 | $_changes = 0; |
| 188 | 164 | |
| 189 | - foreach( $categories as $category_id => $_data ) |
|
| 190 | - { |
|
| 191 | - if( isset( $_data['delete'] ) ) |
|
| 192 | - { |
|
| 193 | - if( $cm->deleteCategory( $category_id ) ) |
|
| 194 | - { |
|
| 165 | + foreach( $categories as $category_id => $_data ) { |
|
| 166 | + if( isset( $_data['delete'] ) ) { |
|
| 167 | + if( $cm->deleteCategory( $category_id ) ) { |
|
| 195 | 168 | $cm->addMessage( |
| 196 | 169 | sprintf( |
| 197 | 170 | $cm->txt('cm_category_x_deleted'), |
@@ -209,8 +182,7 @@ discard block |
||
| 209 | 182 | 'rank' => $_data['rank'] |
| 210 | 183 | ); |
| 211 | 184 | |
| 212 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
| 213 | - { |
|
| 185 | + if( $cm->updateCategory( $category_id, $data ) ) { |
|
| 214 | 186 | $cm->addMessage( |
| 215 | 187 | sprintf( |
| 216 | 188 | $cm->txt('cm_category_x_renamed_to_y'), |
@@ -223,8 +195,7 @@ discard block |
||
| 223 | 195 | } |
| 224 | 196 | } |
| 225 | 197 | |
| 226 | - if( $_changes === 0 ) |
|
| 227 | - { |
|
| 198 | + if( $_changes === 0 ) { |
|
| 228 | 199 | $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit'); |
| 229 | 200 | } |
| 230 | 201 | } |
@@ -233,12 +204,10 @@ discard block |
||
| 233 | 204 | * Delete singel category by $_GET |
| 234 | 205 | */ |
| 235 | 206 | if( isset( $_GET[$cm->get('request_key')]['delete'] ) |
| 236 | - && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) |
|
| 237 | -{ |
|
| 207 | + && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) { |
|
| 238 | 208 | $category_id = (int)$_GET[$cm->get('request_key')]['delete']; |
| 239 | 209 | |
| 240 | - if( $cm->deleteCategory( $category_id ) ) |
|
| 241 | - { |
|
| 210 | + if( $cm->deleteCategory( $category_id ) ) { |
|
| 242 | 211 | $cm->addMessage( |
| 243 | 212 | sprintf( |
| 244 | 213 | $cm->txt('cm_category_x_deleted'), |
@@ -251,16 +220,13 @@ discard block |
||
| 251 | 220 | /** |
| 252 | 221 | * Translate phrases |
| 253 | 222 | */ |
| 254 | -if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) |
|
| 255 | -{ |
|
| 223 | +if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) { |
|
| 256 | 224 | $translations = $_POST[$cm->get('request_key')]['translate']['data']; |
| 257 | 225 | |
| 258 | - foreach( $translations as $native_phrase => $translation ) |
|
| 259 | - { |
|
| 226 | + foreach( $translations as $native_phrase => $translation ) { |
|
| 260 | 227 | $native_phrase = urldecode( $native_phrase ); |
| 261 | 228 | |
| 262 | - if( empty( $translation ) ) |
|
| 263 | - { |
|
| 229 | + if( empty( $translation ) ) { |
|
| 264 | 230 | $translation = $native_phrase; |
| 265 | 231 | |
| 266 | 232 | $cm->addMessage( |
@@ -2,13 +2,13 @@ discard block |
||
| 2 | 2 | /** |
| 3 | 3 | * Class for MODx Categories Manager |
| 4 | 4 | */ |
| 5 | -if( !is_object( $modx ) |
|
| 6 | - || $modx->isBackend() === false ) |
|
| 5 | +if (!is_object($modx) |
|
| 6 | + || $modx->isBackend() === false) |
|
| 7 | 7 | { |
| 8 | 8 | die('Please use the MODx Backend.'); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | -require_once realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'Categories.php'; |
|
| 11 | +require_once realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Categories.php'; |
|
| 12 | 12 | |
| 13 | 13 | class Module_Categories_Manager extends Categories |
| 14 | 14 | { |
@@ -37,19 +37,19 @@ discard block |
||
| 37 | 37 | * @return mixed return the parameter value if exists, otherwise false |
| 38 | 38 | * @param string $key Paramter-key |
| 39 | 39 | */ |
| 40 | - public function get( $key ) |
|
| 40 | + public function get($key) |
|
| 41 | 41 | { |
| 42 | 42 | global $modx; |
| 43 | 43 | |
| 44 | - if( isset( $this->params[$key] ) ) |
|
| 44 | + if (isset($this->params[$key])) |
|
| 45 | 45 | { |
| 46 | 46 | return $this->params[$key]; |
| 47 | 47 | } |
| 48 | - elseif( isset( $modx->config[$key] ) ) |
|
| 48 | + elseif (isset($modx->config[$key])) |
|
| 49 | 49 | { |
| 50 | 50 | return $modx->config[$key]; |
| 51 | 51 | } |
| 52 | - elseif( isset( $modx->event->params[$key] ) ) |
|
| 52 | + elseif (isset($modx->event->params[$key])) |
|
| 53 | 53 | { |
| 54 | 54 | return $modx->event->params[$key]; |
| 55 | 55 | } |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
| 60 | - public function addMessage( $message, $namespace = 'default' ) |
|
| 60 | + public function addMessage($message, $namespace = 'default') |
|
| 61 | 61 | { |
| 62 | 62 | $this->params['messages'][$namespace][] = $message; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
| 66 | - public function getMessages( $namespace = 'default' ) |
|
| 66 | + public function getMessages($namespace = 'default') |
|
| 67 | 67 | { |
| 68 | - if( isset( $this->params['messages'][$namespace] ) ) |
|
| 68 | + if (isset($this->params['messages'][$namespace])) |
|
| 69 | 69 | { |
| 70 | 70 | return $this->params['messages'][$namespace]; |
| 71 | 71 | } |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | - public function renderView( $view_name, $data = array() ) |
|
| 76 | + public function renderView($view_name, $data = array()) |
|
| 77 | 77 | { |
| 78 | 78 | global $_lang, $_style; |
| 79 | 79 | |
| 80 | - $filename = trim( $view_name ) . '.tpl.phtml'; |
|
| 81 | - $file = self::get('views_dir') . $filename; |
|
| 80 | + $filename = trim($view_name).'.tpl.phtml'; |
|
| 81 | + $file = self::get('views_dir').$filename; |
|
| 82 | 82 | $view = & $this; |
| 83 | 83 | |
| 84 | - if( is_file( $file ) |
|
| 85 | - && is_readable( $file ) ) |
|
| 84 | + if (is_file($file) |
|
| 85 | + && is_readable($file)) |
|
| 86 | 86 | { |
| 87 | 87 | include $file; |
| 88 | 88 | } |
@@ -96,28 +96,28 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function updateElement( $element, $element_id, $category_id ) |
|
| 99 | + public function updateElement($element, $element_id, $category_id) |
|
| 100 | 100 | { |
| 101 | 101 | |
| 102 | 102 | $_update = array( |
| 103 | - 'id' => (int)$element_id, |
|
| 104 | - 'category' => (int)$category_id |
|
| 103 | + 'id' => (int) $element_id, |
|
| 104 | + 'category' => (int) $category_id |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | $this->db->update( |
| 108 | 108 | $_update, |
| 109 | 109 | $this->db_tbl[$element], |
| 110 | - "`id` = '" . (int)$element_id . "'" |
|
| 110 | + "`id` = '".(int) $element_id."'" |
|
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | 113 | return $this->db->getAffectedRows() === 1; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| 117 | - public function txt( $txt ) |
|
| 117 | + public function txt($txt) |
|
| 118 | 118 | { |
| 119 | 119 | global $_lang; |
| 120 | - if(isset($_lang[$txt])) return $_lang[$txt]; |
|
| 120 | + if (isset($_lang[$txt])) return $_lang[$txt]; |
|
| 121 | 121 | return $txt; |
| 122 | 122 | } |
| 123 | 123 | } |
@@ -3,8 +3,7 @@ discard block |
||
| 3 | 3 | * Class for MODx Categories Manager |
| 4 | 4 | */ |
| 5 | 5 | if( !is_object( $modx ) |
| 6 | - || $modx->isBackend() === false ) |
|
| 7 | -{ |
|
| 6 | + || $modx->isBackend() === false ) { |
|
| 8 | 7 | die('Please use the MODx Backend.'); |
| 9 | 8 | } |
| 10 | 9 | |
@@ -41,16 +40,11 @@ discard block |
||
| 41 | 40 | { |
| 42 | 41 | global $modx; |
| 43 | 42 | |
| 44 | - if( isset( $this->params[$key] ) ) |
|
| 45 | - { |
|
| 43 | + if( isset( $this->params[$key] ) ) { |
|
| 46 | 44 | return $this->params[$key]; |
| 47 | - } |
|
| 48 | - elseif( isset( $modx->config[$key] ) ) |
|
| 49 | - { |
|
| 45 | + } elseif( isset( $modx->config[$key] ) ) { |
|
| 50 | 46 | return $modx->config[$key]; |
| 51 | - } |
|
| 52 | - elseif( isset( $modx->event->params[$key] ) ) |
|
| 53 | - { |
|
| 47 | + } elseif( isset( $modx->event->params[$key] ) ) { |
|
| 54 | 48 | return $modx->event->params[$key]; |
| 55 | 49 | } |
| 56 | 50 | return false; |
@@ -65,8 +59,7 @@ discard block |
||
| 65 | 59 | |
| 66 | 60 | public function getMessages( $namespace = 'default' ) |
| 67 | 61 | { |
| 68 | - if( isset( $this->params['messages'][$namespace] ) ) |
|
| 69 | - { |
|
| 62 | + if( isset( $this->params['messages'][$namespace] ) ) { |
|
| 70 | 63 | return $this->params['messages'][$namespace]; |
| 71 | 64 | } |
| 72 | 65 | return false; |
@@ -82,12 +75,9 @@ discard block |
||
| 82 | 75 | $view = & $this; |
| 83 | 76 | |
| 84 | 77 | if( is_file( $file ) |
| 85 | - && is_readable( $file ) ) |
|
| 86 | - { |
|
| 78 | + && is_readable( $file ) ) { |
|
| 87 | 79 | include $file; |
| 88 | - } |
|
| 89 | - else |
|
| 90 | - { |
|
| 80 | + } else { |
|
| 91 | 81 | echo sprintf( |
| 92 | 82 | 'View "%s<strong>%s</strong>" not found.', |
| 93 | 83 | self::get('views_dir'), |
@@ -117,7 +107,9 @@ discard block |
||
| 117 | 107 | public function txt( $txt ) |
| 118 | 108 | { |
| 119 | 109 | global $_lang; |
| 120 | - if(isset($_lang[$txt])) return $_lang[$txt]; |
|
| 110 | + if(isset($_lang[$txt])) { |
|
| 111 | + return $_lang[$txt]; |
|
| 112 | + } |
|
| 121 | 113 | return $txt; |
| 122 | 114 | } |
| 123 | 115 | } |
@@ -15,8 +15,7 @@ discard block |
||
| 15 | 15 | $this->db = & $modx->db; |
| 16 | 16 | $this->db_tbl['categories'] = $modx->getFullTableName('categories'); |
| 17 | 17 | |
| 18 | - foreach( $this->elements as $element ) |
|
| 19 | - { |
|
| 18 | + foreach( $this->elements as $element ) { |
|
| 20 | 19 | $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element ); |
| 21 | 20 | } |
| 22 | 21 | } |
@@ -37,8 +36,7 @@ discard block |
||
| 37 | 36 | ) |
| 38 | 37 | ); |
| 39 | 38 | |
| 40 | - if( !empty( $categories ) ) |
|
| 41 | - { |
|
| 39 | + if( !empty( $categories ) ) { |
|
| 42 | 40 | return $categories; |
| 43 | 41 | } |
| 44 | 42 | return false; |
@@ -70,8 +68,7 @@ discard block |
||
| 70 | 68 | |
| 71 | 69 | public function getAssignedElements( $category_id, $element ) |
| 72 | 70 | { |
| 73 | - if( in_array( $element, $this->elements, true ) ) |
|
| 74 | - { |
|
| 71 | + if( in_array( $element, $this->elements, true ) ) { |
|
| 75 | 72 | $elements = $this->db->makeArray( |
| 76 | 73 | $this->db->select( |
| 77 | 74 | '*', |
@@ -81,11 +78,9 @@ discard block |
||
| 81 | 78 | ); |
| 82 | 79 | |
| 83 | 80 | // correct the name of templates |
| 84 | - if( $element === 'templates' ) |
|
| 85 | - { |
|
| 81 | + if( $element === 'templates' ) { |
|
| 86 | 82 | $_elements_count = count($elements); |
| 87 | - for( $i=0; $i < $_elements_count; $i++ ) |
|
| 88 | - { |
|
| 83 | + for( $i=0; $i < $_elements_count; $i++ ) { |
|
| 89 | 84 | $elements[$i]['name'] = $elements[$i]['templatename']; |
| 90 | 85 | } |
| 91 | 86 | } |
@@ -97,8 +92,7 @@ discard block |
||
| 97 | 92 | public function getAllAssignedElements( $category_id ) |
| 98 | 93 | { |
| 99 | 94 | $elements = array(); |
| 100 | - foreach( $this->elements as $element ) |
|
| 101 | - { |
|
| 95 | + foreach( $this->elements as $element ) { |
|
| 102 | 96 | $elements[$element] = $this->getAssignedElements( $category_id, $element ); |
| 103 | 97 | } |
| 104 | 98 | return $elements; |
@@ -107,8 +101,7 @@ discard block |
||
| 107 | 101 | public function deleteCategory( $category_id ) |
| 108 | 102 | { |
| 109 | 103 | $_update = array('category' => 0); |
| 110 | - foreach( $this->elements as $element ) |
|
| 111 | - { |
|
| 104 | + foreach( $this->elements as $element ) { |
|
| 112 | 105 | $this->db->update( |
| 113 | 106 | $_update, |
| 114 | 107 | $this->db_tbl[$element], |
@@ -127,8 +120,7 @@ discard block |
||
| 127 | 120 | public function updateCategory( $category_id, $data = array() ) |
| 128 | 121 | { |
| 129 | 122 | if( empty( $data ) |
| 130 | - || empty( $category_id ) ) |
|
| 131 | - { |
|
| 123 | + || empty( $category_id ) ) { |
|
| 132 | 124 | return false; |
| 133 | 125 | } |
| 134 | 126 | |
@@ -143,8 +135,7 @@ discard block |
||
| 143 | 135 | "`id` = '" . (int)$category_id . "'" |
| 144 | 136 | ); |
| 145 | 137 | |
| 146 | - if( $this->db->getAffectedRows() === 1 ) |
|
| 147 | - { |
|
| 138 | + if( $this->db->getAffectedRows() === 1 ) { |
|
| 148 | 139 | return true; |
| 149 | 140 | } |
| 150 | 141 | |
@@ -153,8 +144,7 @@ discard block |
||
| 153 | 144 | |
| 154 | 145 | public function addCategory( $category_name, $category_rank ) |
| 155 | 146 | { |
| 156 | - if( $this->isCategoryExists( $category_name ) ) |
|
| 157 | - { |
|
| 147 | + if( $this->isCategoryExists( $category_name ) ) { |
|
| 158 | 148 | return false; |
| 159 | 149 | } |
| 160 | 150 | |
@@ -168,8 +158,7 @@ discard block |
||
| 168 | 158 | $this->db_tbl['categories'] |
| 169 | 159 | ); |
| 170 | 160 | |
| 171 | - if( $this->db->getAffectedRows() === 1 ) |
|
| 172 | - { |
|
| 161 | + if( $this->db->getAffectedRows() === 1 ) { |
|
| 173 | 162 | return $this->db->getInsertId(); |
| 174 | 163 | } |
| 175 | 164 | |
@@ -188,8 +177,7 @@ discard block |
||
| 188 | 177 | ) |
| 189 | 178 | ); |
| 190 | 179 | |
| 191 | - if( $this->db->getAffectedRows() === 1 ) |
|
| 192 | - { |
|
| 180 | + if( $this->db->getAffectedRows() === 1 ) { |
|
| 193 | 181 | return $category_id; |
| 194 | 182 | } |
| 195 | 183 | return false; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | public $db; |
| 11 | 11 | public $db_tbl = array(); |
| 12 | - public $elements = array( 'templates', 'tmplvars', 'htmlsnippets', 'snippets', 'plugins', 'modules' ); |
|
| 12 | + public $elements = array('templates', 'tmplvars', 'htmlsnippets', 'snippets', 'plugins', 'modules'); |
|
| 13 | 13 | |
| 14 | 14 | public function __construct() |
| 15 | 15 | { |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | $this->db = & $modx->db; |
| 19 | 19 | $this->db_tbl['categories'] = $modx->getFullTableName('categories'); |
| 20 | 20 | |
| 21 | - foreach( $this->elements as $element ) |
|
| 21 | + foreach ($this->elements as $element) |
|
| 22 | 22 | { |
| 23 | - $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element ); |
|
| 23 | + $this->db_tbl[$element] = $modx->getFullTableName('site_'.$element); |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
@@ -40,54 +40,54 @@ discard block |
||
| 40 | 40 | ) |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | - if( !empty( $categories ) ) |
|
| 43 | + if (!empty($categories)) |
|
| 44 | 44 | { |
| 45 | 45 | return $categories; |
| 46 | 46 | } |
| 47 | 47 | return false; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function getCategory( $search, $where = 'category' ) |
|
| 50 | + public function getCategory($search, $where = 'category') |
|
| 51 | 51 | { |
| 52 | 52 | $category = $this->db->getRow( |
| 53 | 53 | $this->db->select( |
| 54 | 54 | '*', |
| 55 | 55 | $this->db_tbl['categories'], |
| 56 | - "`" . $where . "` = '" . $search . "'" |
|
| 56 | + "`".$where."` = '".$search."'" |
|
| 57 | 57 | ) |
| 58 | 58 | ); |
| 59 | 59 | return $category; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function getCategoryValue( $value, $search, $where = 'category' ) |
|
| 62 | + public function getCategoryValue($value, $search, $where = 'category') |
|
| 63 | 63 | { |
| 64 | 64 | $_value = $this->db->getValue( |
| 65 | 65 | $this->db->select( |
| 66 | - '`' . $value . '`', |
|
| 66 | + '`'.$value.'`', |
|
| 67 | 67 | $this->db_tbl['categories'], |
| 68 | - "`" . $where . "` = '" . $search . "'" |
|
| 68 | + "`".$where."` = '".$search."'" |
|
| 69 | 69 | ) |
| 70 | 70 | ); |
| 71 | 71 | return $_value; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function getAssignedElements( $category_id, $element ) |
|
| 74 | + public function getAssignedElements($category_id, $element) |
|
| 75 | 75 | { |
| 76 | - if( in_array( $element, $this->elements, true ) ) |
|
| 76 | + if (in_array($element, $this->elements, true)) |
|
| 77 | 77 | { |
| 78 | 78 | $elements = $this->db->makeArray( |
| 79 | 79 | $this->db->select( |
| 80 | 80 | '*', |
| 81 | 81 | $this->db_tbl[$element], |
| 82 | - "`category` = '" . $category_id . "'" |
|
| 82 | + "`category` = '".$category_id."'" |
|
| 83 | 83 | ) |
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | 86 | // correct the name of templates |
| 87 | - if( $element === 'templates' ) |
|
| 87 | + if ($element === 'templates') |
|
| 88 | 88 | { |
| 89 | 89 | $_elements_count = count($elements); |
| 90 | - for( $i=0; $i < $_elements_count; $i++ ) |
|
| 90 | + for ($i = 0; $i < $_elements_count; $i++) |
|
| 91 | 91 | { |
| 92 | 92 | $elements[$i]['name'] = $elements[$i]['templatename']; |
| 93 | 93 | } |
@@ -97,56 +97,56 @@ discard block |
||
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function getAllAssignedElements( $category_id ) |
|
| 100 | + public function getAllAssignedElements($category_id) |
|
| 101 | 101 | { |
| 102 | 102 | $elements = array(); |
| 103 | - foreach( $this->elements as $element ) |
|
| 103 | + foreach ($this->elements as $element) |
|
| 104 | 104 | { |
| 105 | - $elements[$element] = $this->getAssignedElements( $category_id, $element ); |
|
| 105 | + $elements[$element] = $this->getAssignedElements($category_id, $element); |
|
| 106 | 106 | } |
| 107 | 107 | return $elements; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function deleteCategory( $category_id ) |
|
| 110 | + public function deleteCategory($category_id) |
|
| 111 | 111 | { |
| 112 | 112 | $_update = array('category' => 0); |
| 113 | - foreach( $this->elements as $element ) |
|
| 113 | + foreach ($this->elements as $element) |
|
| 114 | 114 | { |
| 115 | 115 | $this->db->update( |
| 116 | 116 | $_update, |
| 117 | 117 | $this->db_tbl[$element], |
| 118 | - "`category` = '" . $category_id . "'" |
|
| 118 | + "`category` = '".$category_id."'" |
|
| 119 | 119 | ); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $this->db->delete( |
| 123 | 123 | $this->db_tbl['categories'], |
| 124 | - "`id` = '" . $category_id . "'" |
|
| 124 | + "`id` = '".$category_id."'" |
|
| 125 | 125 | ); |
| 126 | 126 | |
| 127 | 127 | return $this->db->getAffectedRows() === 1; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function updateCategory( $category_id, $data = array() ) |
|
| 130 | + public function updateCategory($category_id, $data = array()) |
|
| 131 | 131 | { |
| 132 | - if( empty( $data ) |
|
| 133 | - || empty( $category_id ) ) |
|
| 132 | + if (empty($data) |
|
| 133 | + || empty($category_id)) |
|
| 134 | 134 | { |
| 135 | 135 | return false; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | $_update = array( |
| 139 | - 'category' => $this->db->escape( $data['category'] ), |
|
| 140 | - 'rank' => (int)$data['rank'] |
|
| 139 | + 'category' => $this->db->escape($data['category']), |
|
| 140 | + 'rank' => (int) $data['rank'] |
|
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | 143 | $this->db->update( |
| 144 | 144 | $_update, |
| 145 | 145 | $this->db_tbl['categories'], |
| 146 | - "`id` = '" . (int)$category_id . "'" |
|
| 146 | + "`id` = '".(int) $category_id."'" |
|
| 147 | 147 | ); |
| 148 | 148 | |
| 149 | - if( $this->db->getAffectedRows() === 1 ) |
|
| 149 | + if ($this->db->getAffectedRows() === 1) |
|
| 150 | 150 | { |
| 151 | 151 | return true; |
| 152 | 152 | } |
@@ -154,16 +154,16 @@ discard block |
||
| 154 | 154 | return false; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function addCategory( $category_name, $category_rank ) |
|
| 157 | + public function addCategory($category_name, $category_rank) |
|
| 158 | 158 | { |
| 159 | - if( $this->isCategoryExists( $category_name ) ) |
|
| 159 | + if ($this->isCategoryExists($category_name)) |
|
| 160 | 160 | { |
| 161 | 161 | return false; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $_insert = array( |
| 165 | - 'category' => $this->db->escape( $category_name ), |
|
| 166 | - 'rank' => (int)$category_rank |
|
| 165 | + 'category' => $this->db->escape($category_name), |
|
| 166 | + 'rank' => (int) $category_rank |
|
| 167 | 167 | ); |
| 168 | 168 | |
| 169 | 169 | $this->db->insert( |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $this->db_tbl['categories'] |
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | - if( $this->db->getAffectedRows() === 1 ) |
|
| 174 | + if ($this->db->getAffectedRows() === 1) |
|
| 175 | 175 | { |
| 176 | 176 | return $this->db->getInsertId(); |
| 177 | 177 | } |
@@ -179,19 +179,19 @@ discard block |
||
| 179 | 179 | return false; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - public function isCategoryExists( $category_name ) |
|
| 182 | + public function isCategoryExists($category_name) |
|
| 183 | 183 | { |
| 184 | - $category = $this->db->escape( $category_name ); |
|
| 184 | + $category = $this->db->escape($category_name); |
|
| 185 | 185 | |
| 186 | 186 | $category_id = $this->db->getValue( |
| 187 | 187 | $this->db->select( |
| 188 | 188 | '`id`', |
| 189 | 189 | $this->db_tbl['categories'], |
| 190 | - "`category` = '" . $category . "'" |
|
| 190 | + "`category` = '".$category."'" |
|
| 191 | 191 | ) |
| 192 | 192 | ); |
| 193 | 193 | |
| 194 | - if( $this->db->getAffectedRows() === 1 ) |
|
| 194 | + if ($this->db->getAffectedRows() === 1) |
|
| 195 | 195 | { |
| 196 | 196 | return $category_id; |
| 197 | 197 | } |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('view_eventlog')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // get id |
@@ -41,18 +41,18 @@ discard block |
||
| 41 | 41 | <div class="tab-page"> |
| 42 | 42 | <div class="container container-body"> |
| 43 | 43 | <?php |
| 44 | - $date = $modx->toDateFormat($content["createdon"]); |
|
| 45 | - if($content["type"] == 1) { |
|
| 46 | - $icon = $_style['actions_info'] . ' text-info'; |
|
| 47 | - $msgtype = $_lang["information"]; |
|
| 48 | - } else if($content["type"] == 2) { |
|
| 49 | - $icon = $_style['actions_triangle'] . ' text-warning'; |
|
| 50 | - $msgtype = $_lang["warning"]; |
|
| 51 | - } else if($content["type"] == 3) { |
|
| 52 | - $icon = $_style['actions_error'] . ' text-danger'; |
|
| 53 | - $msgtype = $_lang["error"]; |
|
| 54 | - } |
|
| 55 | - ?> |
|
| 44 | + $date = $modx->toDateFormat($content["createdon"]); |
|
| 45 | + if($content["type"] == 1) { |
|
| 46 | + $icon = $_style['actions_info'] . ' text-info'; |
|
| 47 | + $msgtype = $_lang["information"]; |
|
| 48 | + } else if($content["type"] == 2) { |
|
| 49 | + $icon = $_style['actions_triangle'] . ' text-warning'; |
|
| 50 | + $msgtype = $_lang["warning"]; |
|
| 51 | + } else if($content["type"] == 3) { |
|
| 52 | + $icon = $_style['actions_error'] . ' text-danger'; |
|
| 53 | + $msgtype = $_lang["error"]; |
|
| 54 | + } |
|
| 55 | + ?> |
|
| 56 | 56 | <p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p> |
| 57 | 57 | <p> |
| 58 | 58 | <i class="<?= $icon ?>"></i> <?= $msgtype ?> |
@@ -1,17 +1,17 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('view_eventlog')) { |
|
| 5 | +if (!$modx->hasPermission('view_eventlog')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // get id |
| 10 | 10 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
| 11 | 11 | |
| 12 | -$ds = $modx->db->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getFullTableName("event_log") . " el |
|
| 13 | - LEFT JOIN " . $modx->getFullTableName("manager_users") . " mu ON mu.id=el.user AND el.usertype=0 |
|
| 14 | - LEFT JOIN " . $modx->getFullTableName("web_users") . " wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'"); |
|
| 12 | +$ds = $modx->db->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getFullTableName("event_log")." el |
|
| 13 | + LEFT JOIN " . $modx->getFullTableName("manager_users")." mu ON mu.id=el.user AND el.usertype=0 |
|
| 14 | + LEFT JOIN " . $modx->getFullTableName("web_users")." wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'"); |
|
| 15 | 15 | $content = $modx->db->getRow($ds); |
| 16 | 16 | |
| 17 | 17 | ?> |
@@ -42,18 +42,18 @@ discard block |
||
| 42 | 42 | <div class="container container-body"> |
| 43 | 43 | <?php |
| 44 | 44 | $date = $modx->toDateFormat($content["createdon"]); |
| 45 | - if($content["type"] == 1) { |
|
| 46 | - $icon = $_style['actions_info'] . ' text-info'; |
|
| 45 | + if ($content["type"] == 1) { |
|
| 46 | + $icon = $_style['actions_info'].' text-info'; |
|
| 47 | 47 | $msgtype = $_lang["information"]; |
| 48 | - } else if($content["type"] == 2) { |
|
| 49 | - $icon = $_style['actions_triangle'] . ' text-warning'; |
|
| 48 | + } else if ($content["type"] == 2) { |
|
| 49 | + $icon = $_style['actions_triangle'].' text-warning'; |
|
| 50 | 50 | $msgtype = $_lang["warning"]; |
| 51 | - } else if($content["type"] == 3) { |
|
| 52 | - $icon = $_style['actions_error'] . ' text-danger'; |
|
| 51 | + } else if ($content["type"] == 3) { |
|
| 52 | + $icon = $_style['actions_error'].' text-danger'; |
|
| 53 | 53 | $msgtype = $_lang["error"]; |
| 54 | 54 | } |
| 55 | 55 | ?> |
| 56 | - <p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p> |
|
| 56 | + <p><b><?= $content['source']." - ".$_lang['eventlog_viewer'] ?></b></p> |
|
| 57 | 57 | <p> |
| 58 | 58 | <i class="<?= $icon ?>"></i> <?= $msgtype ?> |
| 59 | 59 | </p> |
@@ -5,140 +5,140 @@ |
||
| 5 | 5 | |
| 6 | 6 | // action list |
| 7 | 7 | $GLOBALS['action_list'] = array( |
| 8 | - '1' => 'Loading a frame(set)', |
|
| 9 | - '2' => 'Viewing home page/ online users', |
|
| 10 | - '3' => 'Viewing data for resource', |
|
| 11 | - '4' => 'Creating a resource', |
|
| 12 | - '5' => 'Saving resource', |
|
| 13 | - '6' => 'Deleting resource', |
|
| 14 | - '7' => 'Waiting while MODX cleans up', |
|
| 15 | - '8' => 'Logged out', |
|
| 16 | - '9' => 'Viewing help', |
|
| 17 | - '10' => 'Viewing/ composing messages', |
|
| 18 | - '11' => 'Creating a user', |
|
| 19 | - '12' => 'Editing user', |
|
| 20 | - '13' => 'Viewing logging', |
|
| 21 | - '14' => 'Editing a parser', |
|
| 22 | - '15' => 'Saving a parser', |
|
| 23 | - '16' => 'Editing template', |
|
| 24 | - '17' => 'Editing settings', |
|
| 25 | - '18' => 'Viewing Credits :)', |
|
| 26 | - '19' => 'Creating a new template', |
|
| 27 | - '20' => 'Saving template', |
|
| 28 | - '21' => 'Deleting template', |
|
| 29 | - '22' => 'Editing Snippet', |
|
| 30 | - '23' => 'Creating a new Snippet', |
|
| 31 | - '24' => 'Saving Snippet', |
|
| 32 | - '25' => 'Deleting Snippet', |
|
| 33 | - '26' => 'Refreshing site', |
|
| 34 | - '27' => 'Editing resource', |
|
| 35 | - '28' => 'Changing password', |
|
| 36 | - '29' => 'Error', |
|
| 37 | - '30' => 'Saving settings', |
|
| 38 | - '31' => 'Using file manager', |
|
| 39 | - '32' => 'Saving user', |
|
| 40 | - '33' => 'Deleting user', |
|
| 41 | - '34' => 'Saving new password', |
|
| 42 | - '35' => 'Editing role', |
|
| 43 | - '36' => 'Saving role', |
|
| 44 | - '37' => 'Deleting role', |
|
| 45 | - '38' => 'Creating new role', |
|
| 46 | - '40' => 'Editing Access Permissions', |
|
| 47 | - '41' => 'Editing Access Permissions', |
|
| 48 | - '42' => 'Editing Access Permissions', |
|
| 49 | - '43' => 'Editing Access Permissions', |
|
| 50 | - '44' => 'Editing Access Permissions', |
|
| 51 | - '45' => 'Idle', |
|
| 52 | - '46' => 'Editing Access Permissions', |
|
| 53 | - '47' => 'Editing Access Permissions', |
|
| 54 | - '48' => 'Editing Access Permissions', |
|
| 55 | - '49' => 'Editing Access Permissions', |
|
| 56 | - '50' => 'Editing Access Permissions', |
|
| 57 | - '51' => 'Moving resource', |
|
| 58 | - '52' => 'Moved resource', |
|
| 59 | - '53' => 'Viewing system info', |
|
| 60 | - '54' => 'Optimizing a table', |
|
| 61 | - '55' => 'Empty logs', |
|
| 62 | - '56' => 'Refresh resource tree', |
|
| 63 | - '57' => 'Refresh menu', |
|
| 64 | - '58' => 'Logged in', |
|
| 65 | - '59' => 'About MODX', |
|
| 66 | - '60' => 'Emptying Recycle Bin', |
|
| 67 | - '61' => 'Publishing a resource', |
|
| 68 | - '62' => 'Un-publishing a resource', |
|
| 69 | - '63' => 'Un-deleting a resource', |
|
| 70 | - '64' => 'Removing deleted content', |
|
| 71 | - '65' => 'Deleting a message', |
|
| 72 | - '66' => 'Sending a message', |
|
| 73 | - '67' => 'Removing locks', |
|
| 74 | - '68' => 'Viewing site logging', |
|
| 75 | - '69' => 'Viewing online visitors', |
|
| 76 | - '70' => 'Viewing site schedule', |
|
| 77 | - '71' => 'Searching', |
|
| 78 | - '72' => 'Adding a weblink', |
|
| 79 | - '73' => 'Editing a weblink', |
|
| 80 | - //case "74" : return "Changing personal preferences"; break; |
|
| 81 | - '75' => 'User/ role management', |
|
| 82 | - '76' => 'Element management', |
|
| 83 | - '77' => 'Creating a new Chunk (HTML Snippet)', |
|
| 84 | - '78' => 'Editing Chunk (HTML Snippet)', |
|
| 85 | - '79' => 'Saving Chunk (HTML Snippet)', |
|
| 86 | - '80' => 'Deleting Chunk (HTML Snippet)', |
|
| 87 | - '83' => 'Exporting a resource to HTML', |
|
| 88 | - '84' => 'Load Element Selector', |
|
| 89 | - '85' => 'Create Folder', |
|
| 90 | - '86' => 'Role management', |
|
| 91 | - '87' => 'Create new web user', |
|
| 92 | - '88' => 'Editing web user', |
|
| 93 | - '89' => 'Saving web user', |
|
| 94 | - '90' => 'Deleting web user', |
|
| 95 | - '91' => 'Editing Web Access Permissions', |
|
| 96 | - '92' => 'Editing Access Permissions', |
|
| 97 | - '93' => 'Backup Manager', |
|
| 98 | - '94' => 'Duplicate resource', |
|
| 99 | - '95' => 'Importing resources from HTML', |
|
| 100 | - '96' => 'Duplicate Template', |
|
| 101 | - '97' => 'Duplicate Chunk (HTML Snippet)', |
|
| 102 | - '98' => 'Duplicate Snippet', |
|
| 103 | - '99' => 'Manage Web Users', |
|
| 104 | - '100' => 'Previewing resource', |
|
| 105 | - '101' => 'Create new plugin', |
|
| 106 | - '102' => 'Edit plugin', |
|
| 107 | - '103' => 'Saving plugin', |
|
| 108 | - '104' => 'Delete plugin', |
|
| 109 | - '105' => 'Duplicate plugin', |
|
| 110 | - '106' => 'Viewing Modules', |
|
| 111 | - '107' => 'Create new module', |
|
| 112 | - '108' => 'Edit module', |
|
| 113 | - '109' => 'Saving module', |
|
| 114 | - '110' => 'Delete module', |
|
| 115 | - '111' => 'Duplicate module', |
|
| 116 | - '112' => 'Execute module', |
|
| 117 | - '113' => 'Manage module dependencies', |
|
| 118 | - '114' => 'View event log', |
|
| 119 | - '115' => 'View event log details', |
|
| 120 | - '116' => 'Delete event log', |
|
| 121 | - '117' => 'Editing tv rank', |
|
| 122 | - '118' => 'Call settings ajax include', |
|
| 123 | - '119' => 'Login Fail (Temporary Block)', |
|
| 8 | + '1' => 'Loading a frame(set)', |
|
| 9 | + '2' => 'Viewing home page/ online users', |
|
| 10 | + '3' => 'Viewing data for resource', |
|
| 11 | + '4' => 'Creating a resource', |
|
| 12 | + '5' => 'Saving resource', |
|
| 13 | + '6' => 'Deleting resource', |
|
| 14 | + '7' => 'Waiting while MODX cleans up', |
|
| 15 | + '8' => 'Logged out', |
|
| 16 | + '9' => 'Viewing help', |
|
| 17 | + '10' => 'Viewing/ composing messages', |
|
| 18 | + '11' => 'Creating a user', |
|
| 19 | + '12' => 'Editing user', |
|
| 20 | + '13' => 'Viewing logging', |
|
| 21 | + '14' => 'Editing a parser', |
|
| 22 | + '15' => 'Saving a parser', |
|
| 23 | + '16' => 'Editing template', |
|
| 24 | + '17' => 'Editing settings', |
|
| 25 | + '18' => 'Viewing Credits :)', |
|
| 26 | + '19' => 'Creating a new template', |
|
| 27 | + '20' => 'Saving template', |
|
| 28 | + '21' => 'Deleting template', |
|
| 29 | + '22' => 'Editing Snippet', |
|
| 30 | + '23' => 'Creating a new Snippet', |
|
| 31 | + '24' => 'Saving Snippet', |
|
| 32 | + '25' => 'Deleting Snippet', |
|
| 33 | + '26' => 'Refreshing site', |
|
| 34 | + '27' => 'Editing resource', |
|
| 35 | + '28' => 'Changing password', |
|
| 36 | + '29' => 'Error', |
|
| 37 | + '30' => 'Saving settings', |
|
| 38 | + '31' => 'Using file manager', |
|
| 39 | + '32' => 'Saving user', |
|
| 40 | + '33' => 'Deleting user', |
|
| 41 | + '34' => 'Saving new password', |
|
| 42 | + '35' => 'Editing role', |
|
| 43 | + '36' => 'Saving role', |
|
| 44 | + '37' => 'Deleting role', |
|
| 45 | + '38' => 'Creating new role', |
|
| 46 | + '40' => 'Editing Access Permissions', |
|
| 47 | + '41' => 'Editing Access Permissions', |
|
| 48 | + '42' => 'Editing Access Permissions', |
|
| 49 | + '43' => 'Editing Access Permissions', |
|
| 50 | + '44' => 'Editing Access Permissions', |
|
| 51 | + '45' => 'Idle', |
|
| 52 | + '46' => 'Editing Access Permissions', |
|
| 53 | + '47' => 'Editing Access Permissions', |
|
| 54 | + '48' => 'Editing Access Permissions', |
|
| 55 | + '49' => 'Editing Access Permissions', |
|
| 56 | + '50' => 'Editing Access Permissions', |
|
| 57 | + '51' => 'Moving resource', |
|
| 58 | + '52' => 'Moved resource', |
|
| 59 | + '53' => 'Viewing system info', |
|
| 60 | + '54' => 'Optimizing a table', |
|
| 61 | + '55' => 'Empty logs', |
|
| 62 | + '56' => 'Refresh resource tree', |
|
| 63 | + '57' => 'Refresh menu', |
|
| 64 | + '58' => 'Logged in', |
|
| 65 | + '59' => 'About MODX', |
|
| 66 | + '60' => 'Emptying Recycle Bin', |
|
| 67 | + '61' => 'Publishing a resource', |
|
| 68 | + '62' => 'Un-publishing a resource', |
|
| 69 | + '63' => 'Un-deleting a resource', |
|
| 70 | + '64' => 'Removing deleted content', |
|
| 71 | + '65' => 'Deleting a message', |
|
| 72 | + '66' => 'Sending a message', |
|
| 73 | + '67' => 'Removing locks', |
|
| 74 | + '68' => 'Viewing site logging', |
|
| 75 | + '69' => 'Viewing online visitors', |
|
| 76 | + '70' => 'Viewing site schedule', |
|
| 77 | + '71' => 'Searching', |
|
| 78 | + '72' => 'Adding a weblink', |
|
| 79 | + '73' => 'Editing a weblink', |
|
| 80 | + //case "74" : return "Changing personal preferences"; break; |
|
| 81 | + '75' => 'User/ role management', |
|
| 82 | + '76' => 'Element management', |
|
| 83 | + '77' => 'Creating a new Chunk (HTML Snippet)', |
|
| 84 | + '78' => 'Editing Chunk (HTML Snippet)', |
|
| 85 | + '79' => 'Saving Chunk (HTML Snippet)', |
|
| 86 | + '80' => 'Deleting Chunk (HTML Snippet)', |
|
| 87 | + '83' => 'Exporting a resource to HTML', |
|
| 88 | + '84' => 'Load Element Selector', |
|
| 89 | + '85' => 'Create Folder', |
|
| 90 | + '86' => 'Role management', |
|
| 91 | + '87' => 'Create new web user', |
|
| 92 | + '88' => 'Editing web user', |
|
| 93 | + '89' => 'Saving web user', |
|
| 94 | + '90' => 'Deleting web user', |
|
| 95 | + '91' => 'Editing Web Access Permissions', |
|
| 96 | + '92' => 'Editing Access Permissions', |
|
| 97 | + '93' => 'Backup Manager', |
|
| 98 | + '94' => 'Duplicate resource', |
|
| 99 | + '95' => 'Importing resources from HTML', |
|
| 100 | + '96' => 'Duplicate Template', |
|
| 101 | + '97' => 'Duplicate Chunk (HTML Snippet)', |
|
| 102 | + '98' => 'Duplicate Snippet', |
|
| 103 | + '99' => 'Manage Web Users', |
|
| 104 | + '100' => 'Previewing resource', |
|
| 105 | + '101' => 'Create new plugin', |
|
| 106 | + '102' => 'Edit plugin', |
|
| 107 | + '103' => 'Saving plugin', |
|
| 108 | + '104' => 'Delete plugin', |
|
| 109 | + '105' => 'Duplicate plugin', |
|
| 110 | + '106' => 'Viewing Modules', |
|
| 111 | + '107' => 'Create new module', |
|
| 112 | + '108' => 'Edit module', |
|
| 113 | + '109' => 'Saving module', |
|
| 114 | + '110' => 'Delete module', |
|
| 115 | + '111' => 'Duplicate module', |
|
| 116 | + '112' => 'Execute module', |
|
| 117 | + '113' => 'Manage module dependencies', |
|
| 118 | + '114' => 'View event log', |
|
| 119 | + '115' => 'View event log details', |
|
| 120 | + '116' => 'Delete event log', |
|
| 121 | + '117' => 'Editing tv rank', |
|
| 122 | + '118' => 'Call settings ajax include', |
|
| 123 | + '119' => 'Login Fail (Temporary Block)', |
|
| 124 | 124 | |
| 125 | - '300' => 'Create Template Variable', |
|
| 126 | - '301' => 'Edit Template Variable', |
|
| 127 | - '302' => 'Save Template Variable', |
|
| 128 | - '303' => 'Delete Template Variable', |
|
| 129 | - '304' => 'Duplicate Template Variable', |
|
| 125 | + '300' => 'Create Template Variable', |
|
| 126 | + '301' => 'Edit Template Variable', |
|
| 127 | + '302' => 'Save Template Variable', |
|
| 128 | + '303' => 'Delete Template Variable', |
|
| 129 | + '304' => 'Duplicate Template Variable', |
|
| 130 | 130 | |
| 131 | - '200' => 'Viewing phpInfo()', |
|
| 132 | - '501' => 'Delete category', |
|
| 133 | - '998' => 'Viewing web page', |
|
| 134 | - '999' => 'Viewing test page', |
|
| 131 | + '200' => 'Viewing phpInfo()', |
|
| 132 | + '501' => 'Delete category', |
|
| 133 | + '998' => 'Viewing web page', |
|
| 134 | + '999' => 'Viewing test page', |
|
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | 137 | function getAction($actionId, $itemid='') { |
| 138 | - global $action_list; |
|
| 138 | + global $action_list; |
|
| 139 | 139 | |
| 140 | - $ret = sprintf($action_list[$actionId], $itemid); |
|
| 141 | - if (!$ret) $ret = "Idle (unknown)"; |
|
| 140 | + $ret = sprintf($action_list[$actionId], $itemid); |
|
| 141 | + if (!$ret) $ret = "Idle (unknown)"; |
|
| 142 | 142 | |
| 143 | - return $ret; |
|
| 143 | + return $ret; |
|
| 144 | 144 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | '999' => 'Viewing test page', |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | -function getAction($actionId, $itemid='') { |
|
| 137 | +function getAction($actionId, $itemid = ''){ |
|
| 138 | 138 | global $action_list; |
| 139 | 139 | |
| 140 | 140 | $ret = sprintf($action_list[$actionId], $itemid); |
@@ -134,11 +134,14 @@ |
||
| 134 | 134 | '999' => 'Viewing test page', |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | -function getAction($actionId, $itemid='') { |
|
| 137 | +function getAction($actionId, $itemid='') |
|
| 138 | +{ |
|
| 138 | 139 | global $action_list; |
| 139 | 140 | |
| 140 | 141 | $ret = sprintf($action_list[$actionId], $itemid); |
| 141 | - if (!$ret) $ret = "Idle (unknown)"; |
|
| 142 | + if (!$ret) { |
|
| 143 | + $ret = "Idle (unknown)"; |
|
| 144 | + } |
|
| 142 | 145 | |
| 143 | 146 | return $ret; |
| 144 | 147 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if(( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) && IN_PARSER_MODE!="true") { |
|
| 2 | +if ((!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) && IN_PARSER_MODE != "true") { |
|
| 3 | 3 | die("<b>INCLUDE ACCESS ERROR</b><br /><br />Direct access to this file prohibited."); |
| 4 | 4 | } |
| 5 | 5 | $tmpArray = array(); |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if($emptyCache) { |
| 56 | - $modx->clearCache('full'); |
|
| 56 | + $modx->clearCache('full'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | echo $str; |
@@ -3,11 +3,11 @@ discard block |
||
| 3 | 3 | * mutate_settings.ajax.php |
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 6 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 7 | 7 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | -require_once(dirname(__FILE__) . '/protect.inc.php'); |
|
| 10 | +require_once(dirname(__FILE__).'/protect.inc.php'); |
|
| 11 | 11 | |
| 12 | 12 | $action = preg_replace('/[^A-Za-z0-9_\-\.\/]/', '', $_POST['action']); |
| 13 | 13 | $lang = preg_replace('/[^A-Za-z0-9_\s\+\-\.\/]/', '', $_POST['lang']); |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | $str = ''; |
| 23 | 23 | $emptyCache = false; |
| 24 | 24 | |
| 25 | -switch(true){ |
|
| 26 | - case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/',$lang) && file_exists(dirname(__FILE__) . '/lang/'.$lang.'.inc.php')):{ |
|
| 27 | - include(dirname(__FILE__) . '/lang/'.$lang.'.inc.php'); |
|
| 28 | - $str = isset($key,$_lang,$_lang[$key]) ? $_lang[$key] : "" ; |
|
| 25 | +switch (true) { |
|
| 26 | + case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/', $lang) && file_exists(dirname(__FILE__).'/lang/'.$lang.'.inc.php')):{ |
|
| 27 | + include(dirname(__FILE__).'/lang/'.$lang.'.inc.php'); |
|
| 28 | + $str = isset($key, $_lang, $_lang[$key]) ? $_lang[$key] : ""; |
|
| 29 | 29 | break; |
| 30 | 30 | } |
| 31 | 31 | case ($action == 'setsetting' && !empty($key) && !empty($value)):{ |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | -if($emptyCache) { |
|
| 55 | +if ($emptyCache) { |
|
| 56 | 56 | $modx->clearCache('full'); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $str = ''; |
| 23 | 23 | $emptyCache = false; |
| 24 | 24 | |
| 25 | -switch(true){ |
|
| 25 | +switch(true) { |
|
| 26 | 26 | case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/',$lang) && file_exists(dirname(__FILE__) . '/lang/'.$lang.'.inc.php')):{ |
| 27 | 27 | include(dirname(__FILE__) . '/lang/'.$lang.'.inc.php'); |
| 28 | 28 | $str = isset($key,$_lang,$_lang[$key]) ? $_lang[$key] : "" ; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | var stay = document.getElementById('stay'); |
| 19 | 19 | // Trigger unlock |
| 20 | 20 | if ((stay && stay.value !== '2') || !form_save) { |
| 21 | - var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType;?>&id=<?php echo $lockElementId;?>&o=' + Math.random(); |
|
| 21 | + var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType; ?>&id=<?php echo $lockElementId; ?>&o=' + Math.random(); |
|
| 22 | 22 | if (navigator.sendBeacon) { |
| 23 | 23 | navigator.sendBeacon(url) |
| 24 | 24 | } else { |