@@ -1,19 +1,19 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('new_module')) { |
|
| 5 | +if (!$modx->hasPermission('new_module')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | // count duplicates |
| 14 | 14 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'")); |
| 15 | 15 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 16 | -if($count>=1) $count = ' '.($count+1); |
|
| 16 | +if ($count >= 1) $count = ' '.($count + 1); |
|
| 17 | 17 | else $count = ''; |
| 18 | 18 | |
| 19 | 19 | // duplicate module |
@@ -58,5 +58,5 @@ discard block |
||
| 58 | 58 | $_SESSION['itemname'] = $name; |
| 59 | 59 | |
| 60 | 60 | // finish duplicating - redirect to new module |
| 61 | -$header="Location: index.php?r=2&a=108&id=$newid"; |
|
| 61 | +$header = "Location: index.php?r=2&a=108&id=$newid"; |
|
| 62 | 62 | header($header); |
@@ -1,20 +1,20 @@ 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('new_template')) { |
|
| 5 | +if (!$modx->hasPermission('new_template')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // count duplicates |
| 15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'")); |
| 16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "templatename LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 17 | -if($count>=1) $count = ' '.($count+1); |
|
| 17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
| 18 | 18 | else $count = ''; |
| 19 | 19 | |
| 20 | 20 | // duplicate template |
@@ -41,5 +41,5 @@ discard block |
||
| 41 | 41 | $_SESSION['itemname'] = $name; |
| 42 | 42 | |
| 43 | 43 | // finish duplicating - redirect to new template |
| 44 | -$header="Location: index.php?r=2&a=16&id=$newid"; |
|
| 44 | +$header = "Location: index.php?r=2&a=16&id=$newid"; |
|
| 45 | 45 | header($header); |
@@ -1,25 +1,25 @@ 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('save_document')||!$modx->hasPermission('publish_document')) { |
|
| 5 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /************webber ********/ |
| 15 | -$content=$modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************** webber *************/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /***********************************/ |
| 25 | 25 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $udperms->document = $id; |
| 32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
| 33 | 33 | |
| 34 | -if(!$udperms->checkPermissions()) { |
|
| 34 | +if (!$udperms->checkPermissions()) { |
|
| 35 | 35 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'"); |
| 49 | 49 | |
| 50 | 50 | // invoke OnDocPublished event |
| 51 | -$modx->invokeEvent("OnDocPublished",array("docid"=>$id)); |
|
| 51 | +$modx->invokeEvent("OnDocPublished", array("docid"=>$id)); |
|
| 52 | 52 | |
| 53 | 53 | // Set the item name for logger |
| 54 | 54 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -56,6 +56,6 @@ discard block |
||
| 56 | 56 | // empty cache |
| 57 | 57 | $modx->clearCache('full'); |
| 58 | 58 | |
| 59 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 59 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 60 | 60 | |
| 61 | 61 | header($header); |
@@ -1,8 +1,8 @@ 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('messages')) { |
|
| 5 | +if (!$modx->hasPermission('messages')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | $userid = $_REQUEST['user']; |
| 11 | 11 | $groupid = $_REQUEST['group']; |
| 12 | 12 | $subject = $modx->getDatabase()->escape($_REQUEST['messagesubject']); |
| 13 | -if($subject=="") $subject="(no subject)"; |
|
| 13 | +if ($subject == "") $subject = "(no subject)"; |
|
| 14 | 14 | $message = $modx->getDatabase()->escape($_REQUEST['messagebody']); |
| 15 | -if($message=="") $message="(no message)"; |
|
| 15 | +if ($message == "") $message = "(no message)"; |
|
| 16 | 16 | $postdate = time(); |
| 17 | 17 | |
| 18 | -if($sendto=='u') { |
|
| 19 | - if($userid==0) { |
|
| 18 | +if ($sendto == 'u') { |
|
| 19 | + if ($userid == 0) { |
|
| 20 | 20 | $modx->webAlertAndQuit($_lang["error_no_user_selected"]); |
| 21 | 21 | } |
| 22 | 22 | $modx->getDatabase()->insert( |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | ), $modx->getDatabase()->getFullTableName('user_messages')); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -if($sendto=='g') { |
|
| 35 | - if($groupid==0) { |
|
| 34 | +if ($sendto == 'g') { |
|
| 35 | + if ($groupid == 0) { |
|
| 36 | 36 | $modx->webAlertAndQuit($_lang["error_no_group_selected"]); |
| 37 | 37 | } |
| 38 | 38 | $rs = $modx->getDatabase()->select('internalKey', $modx->getDatabase()->getFullTableName('user_attributes'), "role='{$groupid}' AND internalKey!='".$modx->getLoginUserID()."'"); |
| 39 | - while ($row=$modx->getDatabase()->getRow($rs)) { |
|
| 39 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
| 40 | 40 | $modx->getDatabase()->insert( |
| 41 | 41 | array( |
| 42 | 42 | 'recipient' => $row['internalKey'], |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | -if($sendto=='a') { |
|
| 54 | +if ($sendto == 'a') { |
|
| 55 | 55 | $rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('manager_users'), "id!='".$modx->getLoginUserID()."'"); |
| 56 | - while ($row=$modx->getDatabase()->getRow($rs)) { |
|
| 56 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
| 57 | 57 | $modx->getDatabase()->insert( |
| 58 | 58 | array( |
| 59 | 59 | 'recipient' => $row['id'], |
@@ -1,25 +1,25 @@ 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('save_document')||!$modx->hasPermission('publish_document')) { |
|
| 5 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /************webber ********/ |
| 15 | -$content=$modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************** webber *************/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /***********************************/ |
| 25 | 25 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $udperms->document = $id; |
| 32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
| 33 | 33 | |
| 34 | -if(!$udperms->checkPermissions()) { |
|
| 34 | +if (!$udperms->checkPermissions()) { |
|
| 35 | 35 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'"); |
| 49 | 49 | |
| 50 | 50 | // invoke OnDocUnPublished event |
| 51 | -$modx->invokeEvent("OnDocUnPublished",array("docid"=>$id)); |
|
| 51 | +$modx->invokeEvent("OnDocUnPublished", array("docid"=>$id)); |
|
| 52 | 52 | |
| 53 | 53 | // Set the item name for logger |
| 54 | 54 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -56,6 +56,6 @@ discard block |
||
| 56 | 56 | // empty cache |
| 57 | 57 | $modx->clearCache('full'); |
| 58 | 58 | |
| 59 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 59 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 60 | 60 | |
| 61 | 61 | header($header); |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if (!$modx->hasPermission('messages')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 10 | -if ($id==0) { |
|
| 9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | $modx->webAlertAndQuit("Wrong number of messages returned!"); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | -if ($message['recipient']!=$modx->getLoginUserID()) { |
|
| 21 | +if ($message['recipient'] != $modx->getLoginUserID()) { |
|
| 22 | 22 | $modx->webAlertAndQuit("You are not allowed to delete this message!"); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // delete message |
| 26 | 26 | $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('user_messages'), "id='{$id}'"); |
| 27 | 27 | |
| 28 | -$header="Location: index.php?a=10"; |
|
| 28 | +$header = "Location: index.php?a=10"; |
|
| 29 | 29 | header($header); |
@@ -1,10 +1,10 @@ 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(!isset($_GET['id'])) { |
|
| 7 | - if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | +if (!isset($_GET['id'])) { |
|
| 7 | + if (!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 8 | 8 | |
| 9 | 9 | // Remove all locks |
| 10 | 10 | $modx->getDatabase()->truncate($modx->getDatabase()->getFullTableName('active_user_locks')); |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | header($header); |
| 14 | 14 | } else { |
| 15 | 15 | // Remove single locks via AJAX / window.onbeforeunload |
| 16 | - $type = (int)$_GET['type']; |
|
| 17 | - $id = (int)$_GET['id']; |
|
| 16 | + $type = (int) $_GET['type']; |
|
| 17 | + $id = (int) $_GET['id']; |
|
| 18 | 18 | $includeAllUsers = $modx->hasPermission('remove_locks'); // Enables usage of "unlock"-ajax-button |
| 19 | - if($type && $id) { |
|
| 19 | + if ($type && $id) { |
|
| 20 | 20 | $modx->unlockElement($type, $id, $includeAllUsers); |
| 21 | 21 | echo '1'; |
| 22 | 22 | exit; |
@@ -1,20 +1,20 @@ 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('new_plugin')) { |
|
| 5 | +if (!$modx->hasPermission('new_plugin')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // count duplicates |
| 15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_plugins'), "id='{$id}'")); |
| 16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 17 | -if($count>=1) $count = ' '.($count+1); |
|
| 17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
| 18 | 18 | else $count = ''; |
| 19 | 19 | |
| 20 | 20 | // duplicate Plugin |
@@ -44,5 +44,5 @@ discard block |
||
| 44 | 44 | $_SESSION['itemname'] = $name; |
| 45 | 45 | |
| 46 | 46 | // finish duplicating - redirect to new plugin |
| 47 | -$header="Location: index.php?r=2&a=102&id=$newid"; |
|
| 47 | +$header = "Location: index.php?r=2&a=102&id=$newid"; |
|
| 48 | 48 | header($header); |
@@ -1,25 +1,25 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if (!$modx->hasPermission('delete_document')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 10 | -if ($id==0) { |
|
| 9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /*******ищем родителя чтобы к нему вернуться********/ |
| 15 | -$content=$modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************ а заодно и путь возврата (сам путь внизу файла) **********/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /*****************************/ |
| 25 | 25 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | "children"=>$children |
| 46 | 46 | )); |
| 47 | 47 | |
| 48 | -if (count($children)>0) { |
|
| 48 | +if (count($children) > 0) { |
|
| 49 | 49 | $modx->getDatabase()->update( |
| 50 | 50 | array( |
| 51 | 51 | 'deleted' => 1, |
@@ -54,19 +54,19 @@ discard block |
||
| 54 | 54 | ), $modx->getDatabase()->getFullTableName('site_content'), "id IN (".implode(", ", $children).")"); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -if ($site_start==$id) { |
|
| 57 | +if ($site_start == $id) { |
|
| 58 | 58 | $modx->webAlertAndQuit("Document is 'Site start' and cannot be deleted!"); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | -if ($site_unavailable_page==$id) { |
|
| 61 | +if ($site_unavailable_page == $id) { |
|
| 62 | 62 | $modx->webAlertAndQuit("Document is used as the 'Site unavailable page' and cannot be deleted!"); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | -if ($error_page==$id) { |
|
| 65 | +if ($error_page == $id) { |
|
| 66 | 66 | $modx->webAlertAndQuit("Document is used as the 'Site error page' and cannot be deleted!"); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -if ($unauthorized_page==$id) { |
|
| 69 | +if ($unauthorized_page == $id) { |
|
| 70 | 70 | $modx->webAlertAndQuit("Document is used as the 'Site unauthorized page' and cannot be deleted!"); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -92,5 +92,5 @@ discard block |
||
| 92 | 92 | $modx->clearCache('full'); |
| 93 | 93 | |
| 94 | 94 | // finished emptying cache - redirect |
| 95 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 95 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 96 | 96 | header($header); |