@@ -25,7 +25,10 @@ |
||
| 25 | 25 | |
| 26 | 26 | $id = $row['id']; |
| 27 | 27 | |
| 28 | - if(in_array($id,$latestIds)) continue; // Keep latest version of disabled plugins |
|
| 28 | + if(in_array($id,$latestIds)) { |
|
| 29 | + continue; |
|
| 30 | + } |
|
| 31 | + // Keep latest version of disabled plugins |
|
| 29 | 32 | |
| 30 | 33 | // invoke OnBeforePluginFormDelete event |
| 31 | 34 | $modx->invokeEvent('OnBeforePluginFormDelete', array('id'=> $id)); |
@@ -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 | exit(); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -if(!$modx->hasPermission('delete_plugin')) { |
|
| 6 | +if (!$modx->hasPermission('delete_plugin')) { |
|
| 7 | 7 | $e->setError(3); |
| 8 | 8 | $e->dumpError(); |
| 9 | 9 | } |
@@ -14,18 +14,18 @@ discard block |
||
| 14 | 14 | // Get unique list of latest added plugins by highest sql-id |
| 15 | 15 | $rs = $modx->getDatabase()->query("SELECT t1.id FROM {$tbl_site_plugins} t1 LEFT JOIN {$tbl_site_plugins} t2 ON (t1.name = t2.name AND t1.id < t2.id) WHERE t2.id IS NULL;"); |
| 16 | 16 | $latestIds = array(); |
| 17 | -while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 17 | +while ($row = $modx->getDatabase()->getRow($rs)) { |
|
| 18 | 18 | $latestIds[] = $row['id']; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // Get list of plugins with disabled and enabled versions |
| 22 | 22 | $rs = $modx->getDatabase()->query("SELECT id FROM {$tbl_site_plugins} t1 WHERE disabled = 1 AND name IN (SELECT name FROM {$tbl_site_plugins} t2 WHERE t1.name = t2.name AND t1.id != t2.id)"); |
| 23 | 23 | |
| 24 | -while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 24 | +while ($row = $modx->getDatabase()->getRow($rs)) { |
|
| 25 | 25 | |
| 26 | 26 | $id = $row['id']; |
| 27 | 27 | |
| 28 | - if(in_array($id,$latestIds)) continue; // Keep latest version of disabled plugins |
|
| 28 | + if (in_array($id, $latestIds)) continue; // Keep latest version of disabled plugins |
|
| 29 | 29 | |
| 30 | 30 | // invoke OnBeforePluginFormDelete event |
| 31 | 31 | $modx->invokeEvent('OnBeforePluginFormDelete', array('id'=> $id)); |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | if(!$modx->hasPermission('delete_plugin')) { |
| 7 | - $e->setError(3); |
|
| 8 | - $e->dumpError(); |
|
| 7 | + $e->setError(3); |
|
| 8 | + $e->dumpError(); |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | $tbl_site_plugins = $modx->getDatabase()->getFullTableName('site_plugins'); |
@@ -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('delete_document')) { |
|
| 5 | +if (!$modx->hasPermission('delete_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -42,5 +42,5 @@ discard block |
||
| 42 | 42 | $modx->clearCache('full'); |
| 43 | 43 | |
| 44 | 44 | // finished emptying cache - redirect |
| 45 | - $header="Location: index.php?a=2&r=1"; |
|
| 45 | + $header = "Location: index.php?a=2&r=1"; |
|
| 46 | 46 | header($header); |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('delete_document')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), "deleted=1"); |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | // invoke OnBeforeEmptyTrash event |
| 13 | 13 | $modx->invokeEvent("OnBeforeEmptyTrash", |
| 14 | - array( |
|
| 15 | - "ids"=>$ids |
|
| 16 | - )); |
|
| 14 | + array( |
|
| 15 | + "ids"=>$ids |
|
| 16 | + )); |
|
| 17 | 17 | |
| 18 | 18 | // remove the document groups link. |
| 19 | 19 | $sql = "DELETE document_groups |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | //'undelete' the document. |
| 33 | 33 | $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_content'), "deleted=1"); |
| 34 | 34 | |
| 35 | - // invoke OnEmptyTrash event |
|
| 36 | - $modx->invokeEvent("OnEmptyTrash", |
|
| 37 | - array( |
|
| 38 | - "ids"=>$ids |
|
| 39 | - )); |
|
| 35 | + // invoke OnEmptyTrash event |
|
| 36 | + $modx->invokeEvent("OnEmptyTrash", |
|
| 37 | + array( |
|
| 38 | + "ids"=>$ids |
|
| 39 | + )); |
|
| 40 | 40 | |
| 41 | - // empty cache |
|
| 42 | - $modx->clearCache('full'); |
|
| 41 | + // empty cache |
|
| 42 | + $modx->clearCache('full'); |
|
| 43 | 43 | |
| 44 | - // finished emptying cache - redirect |
|
| 45 | - $header="Location: index.php?a=2&r=1"; |
|
| 46 | - header($header); |
|
| 44 | + // finished emptying cache - redirect |
|
| 45 | + $header="Location: index.php?a=2&r=1"; |
|
| 46 | + header($header); |
|
@@ -10,11 +10,11 @@ |
||
| 10 | 10 | $pass1 = $_POST['pass1']; |
| 11 | 11 | $pass2 = $_POST['pass2']; |
| 12 | 12 | |
| 13 | -if($pass1!=$pass2){ |
|
| 13 | +if($pass1!=$pass2) { |
|
| 14 | 14 | $modx->webAlertAndQuit("Passwords don't match!"); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -if(strlen($pass1)<6){ |
|
| 17 | +if(strlen($pass1)<6) { |
|
| 18 | 18 | $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('save_password')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $id = $_POST['id']; |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | $pass2 = $_POST['pass2']; |
| 12 | 12 | |
| 13 | 13 | if($pass1!=$pass2){ |
| 14 | - $modx->webAlertAndQuit("Passwords don't match!"); |
|
| 14 | + $modx->webAlertAndQuit("Passwords don't match!"); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if(strlen($pass1)<6){ |
| 18 | - $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
|
| 18 | + $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $pass1 = $modx->getPhpCompat()->htmlspecialchars($pass1, ENT_NOQUOTES); |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | $user = EvolutionCMS\Models\ManagerUser::find($uid); |
| 25 | 25 | $user->update(['password' => $password]); |
| 26 | 26 | |
| 27 | - // invoke OnManagerChangePassword event |
|
| 28 | - $modx->invokeEvent('OnManagerChangePassword', array ( |
|
| 29 | - 'userid' => $uid, |
|
| 30 | - 'username' => $_SESSION['mgrShortname'], |
|
| 31 | - 'userpassword' => $pass1 |
|
| 32 | - )); |
|
| 27 | + // invoke OnManagerChangePassword event |
|
| 28 | + $modx->invokeEvent('OnManagerChangePassword', array ( |
|
| 29 | + 'userid' => $uid, |
|
| 30 | + 'username' => $_SESSION['mgrShortname'], |
|
| 31 | + 'userpassword' => $pass1 |
|
| 32 | + )); |
|
| 33 | 33 | |
| 34 | 34 | $header="Location: index.php?a=2"; |
| 35 | 35 | 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('save_password')) { |
|
| 5 | +if (!$modx->hasPermission('save_password')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | $pass1 = $_POST['pass1']; |
| 11 | 11 | $pass2 = $_POST['pass2']; |
| 12 | 12 | |
| 13 | -if($pass1!=$pass2){ |
|
| 13 | +if ($pass1 != $pass2) { |
|
| 14 | 14 | $modx->webAlertAndQuit("Passwords don't match!"); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -if(strlen($pass1)<6){ |
|
| 17 | +if (strlen($pass1) < 6) { |
|
| 18 | 18 | $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | $user->update(['password' => $password]); |
| 26 | 26 | |
| 27 | 27 | // invoke OnManagerChangePassword event |
| 28 | - $modx->invokeEvent('OnManagerChangePassword', array ( |
|
| 28 | + $modx->invokeEvent('OnManagerChangePassword', array( |
|
| 29 | 29 | 'userid' => $uid, |
| 30 | 30 | 'username' => $_SESSION['mgrShortname'], |
| 31 | 31 | 'userpassword' => $pass1 |
| 32 | 32 | )); |
| 33 | 33 | |
| 34 | -$header="Location: index.php?a=2"; |
|
| 34 | +$header = "Location: index.php?a=2"; |
|
| 35 | 35 | header($header); |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // secure manager documents - flag as private |
| 122 | -if($updategroupaccess==true){ |
|
| 122 | +if($updategroupaccess==true) { |
|
| 123 | 123 | include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
| 124 | 124 | secureMgrDocument(); |
| 125 | 125 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('access_permissions')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // access group processor. |
@@ -20,113 +20,113 @@ discard block |
||
| 20 | 20 | $operation = $_REQUEST['operation']; |
| 21 | 21 | |
| 22 | 22 | switch ($operation) { |
| 23 | - case "add_user_group" : |
|
| 24 | - $newgroup = $_REQUEST['newusergroup']; |
|
| 25 | - if(empty($newgroup)) { |
|
| 26 | - $modx->webAlertAndQuit("No group name specified."); |
|
| 27 | - } else { |
|
| 28 | - $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
|
| 23 | + case "add_user_group" : |
|
| 24 | + $newgroup = $_REQUEST['newusergroup']; |
|
| 25 | + if(empty($newgroup)) { |
|
| 26 | + $modx->webAlertAndQuit("No group name specified."); |
|
| 27 | + } else { |
|
| 28 | + $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
|
| 29 | 29 | |
| 30 | - // invoke OnManagerCreateGroup event |
|
| 31 | - $modx->invokeEvent('OnManagerCreateGroup', array( |
|
| 32 | - 'groupid' => $id, |
|
| 33 | - 'groupname' => $newgroup, |
|
| 34 | - )); |
|
| 35 | - } |
|
| 36 | - break; |
|
| 37 | - case "add_document_group" : |
|
| 38 | - $newgroup = $_REQUEST['newdocgroup']; |
|
| 39 | - if(empty($newgroup)) { |
|
| 40 | - $modx->webAlertAndQuit("No group name specified."); |
|
| 41 | - } else { |
|
| 42 | - $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
| 30 | + // invoke OnManagerCreateGroup event |
|
| 31 | + $modx->invokeEvent('OnManagerCreateGroup', array( |
|
| 32 | + 'groupid' => $id, |
|
| 33 | + 'groupname' => $newgroup, |
|
| 34 | + )); |
|
| 35 | + } |
|
| 36 | + break; |
|
| 37 | + case "add_document_group" : |
|
| 38 | + $newgroup = $_REQUEST['newdocgroup']; |
|
| 39 | + if(empty($newgroup)) { |
|
| 40 | + $modx->webAlertAndQuit("No group name specified."); |
|
| 41 | + } else { |
|
| 42 | + $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
| 43 | 43 | |
| 44 | - // invoke OnCreateDocGroup event |
|
| 45 | - $modx->invokeEvent('OnCreateDocGroup', array( |
|
| 46 | - 'groupid' => $id, |
|
| 47 | - 'groupname' => $newgroup, |
|
| 48 | - )); |
|
| 49 | - } |
|
| 50 | - break; |
|
| 51 | - case "delete_user_group" : |
|
| 52 | - $updategroupaccess = true; |
|
| 53 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
| 54 | - if(empty($usergroup)) { |
|
| 55 | - $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
| 56 | - } else { |
|
| 57 | - $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
|
| 44 | + // invoke OnCreateDocGroup event |
|
| 45 | + $modx->invokeEvent('OnCreateDocGroup', array( |
|
| 46 | + 'groupid' => $id, |
|
| 47 | + 'groupname' => $newgroup, |
|
| 48 | + )); |
|
| 49 | + } |
|
| 50 | + break; |
|
| 51 | + case "delete_user_group" : |
|
| 52 | + $updategroupaccess = true; |
|
| 53 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
| 54 | + if(empty($usergroup)) { |
|
| 55 | + $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
| 56 | + } else { |
|
| 57 | + $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
|
| 58 | 58 | |
| 59 | - $modx->getDatabase()->delete($tbl_membergroup_access, "membergroup='{$usergroup}'"); |
|
| 59 | + $modx->getDatabase()->delete($tbl_membergroup_access, "membergroup='{$usergroup}'"); |
|
| 60 | 60 | |
| 61 | - $modx->getDatabase()->delete($tbl_member_groups, "user_group='{$usergroup}'"); |
|
| 62 | - } |
|
| 63 | - break; |
|
| 64 | - case "delete_document_group" : |
|
| 65 | - $group = (int)$_REQUEST['documentgroup']; |
|
| 66 | - if(empty($group)) { |
|
| 67 | - $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
| 68 | - } else { |
|
| 69 | - $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
| 61 | + $modx->getDatabase()->delete($tbl_member_groups, "user_group='{$usergroup}'"); |
|
| 62 | + } |
|
| 63 | + break; |
|
| 64 | + case "delete_document_group" : |
|
| 65 | + $group = (int)$_REQUEST['documentgroup']; |
|
| 66 | + if(empty($group)) { |
|
| 67 | + $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
| 68 | + } else { |
|
| 69 | + $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
| 70 | 70 | |
| 71 | - $modx->getDatabase()->delete($tbl_membergroup_access, "documentgroup='{$group}'"); |
|
| 71 | + $modx->getDatabase()->delete($tbl_membergroup_access, "documentgroup='{$group}'"); |
|
| 72 | 72 | |
| 73 | - $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
| 74 | - } |
|
| 75 | - break; |
|
| 76 | - case "rename_user_group" : |
|
| 77 | - $newgroupname = $_REQUEST['newgroupname']; |
|
| 78 | - if(empty($newgroupname)) { |
|
| 79 | - $modx->webAlertAndQuit("No group name specified."); |
|
| 80 | - } |
|
| 81 | - $groupid = (int)$_REQUEST['groupid']; |
|
| 82 | - if(empty($groupid)) { |
|
| 83 | - $modx->webAlertAndQuit("No group id specified for rename."); |
|
| 84 | - } |
|
| 73 | + $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
| 74 | + } |
|
| 75 | + break; |
|
| 76 | + case "rename_user_group" : |
|
| 77 | + $newgroupname = $_REQUEST['newgroupname']; |
|
| 78 | + if(empty($newgroupname)) { |
|
| 79 | + $modx->webAlertAndQuit("No group name specified."); |
|
| 80 | + } |
|
| 81 | + $groupid = (int)$_REQUEST['groupid']; |
|
| 82 | + if(empty($groupid)) { |
|
| 83 | + $modx->webAlertAndQuit("No group id specified for rename."); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_membergroup_names, "id='{$groupid}'"); |
|
| 87 | - break; |
|
| 88 | - case "rename_document_group" : |
|
| 89 | - $newgroupname = $_REQUEST['newgroupname']; |
|
| 90 | - if(empty($newgroupname)) { |
|
| 91 | - $modx->webAlertAndQuit("No group name specified."); |
|
| 92 | - } |
|
| 93 | - $groupid = (int)$_REQUEST['groupid']; |
|
| 94 | - if(empty($groupid)) { |
|
| 95 | - $modx->webAlertAndQuit("No group id specified for rename."); |
|
| 96 | - } |
|
| 86 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_membergroup_names, "id='{$groupid}'"); |
|
| 87 | + break; |
|
| 88 | + case "rename_document_group" : |
|
| 89 | + $newgroupname = $_REQUEST['newgroupname']; |
|
| 90 | + if(empty($newgroupname)) { |
|
| 91 | + $modx->webAlertAndQuit("No group name specified."); |
|
| 92 | + } |
|
| 93 | + $groupid = (int)$_REQUEST['groupid']; |
|
| 94 | + if(empty($groupid)) { |
|
| 95 | + $modx->webAlertAndQuit("No group id specified for rename."); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
| 99 | - break; |
|
| 100 | - case "add_document_group_to_user_group" : |
|
| 101 | - $updategroupaccess = true; |
|
| 102 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
| 103 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
| 104 | - $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
| 105 | - $limit = $modx->getDatabase()->getValue($rs); |
|
| 106 | - if($limit<=0) { |
|
| 107 | - $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
|
| 108 | - } else { |
|
| 109 | - //alert user that coupling already exists? |
|
| 110 | - } |
|
| 111 | - break; |
|
| 112 | - case "remove_document_group_from_user_group" : |
|
| 113 | - $updategroupaccess = true; |
|
| 114 | - $coupling = (int)$_REQUEST['coupling']; |
|
| 115 | - $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
|
| 116 | - break; |
|
| 117 | - default : |
|
| 118 | - $modx->webAlertAndQuit("No operation set in request."); |
|
| 98 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
| 99 | + break; |
|
| 100 | + case "add_document_group_to_user_group" : |
|
| 101 | + $updategroupaccess = true; |
|
| 102 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
| 103 | + $docgroup = (int)$_REQUEST['docgroup']; |
|
| 104 | + $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
| 105 | + $limit = $modx->getDatabase()->getValue($rs); |
|
| 106 | + if($limit<=0) { |
|
| 107 | + $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
|
| 108 | + } else { |
|
| 109 | + //alert user that coupling already exists? |
|
| 110 | + } |
|
| 111 | + break; |
|
| 112 | + case "remove_document_group_from_user_group" : |
|
| 113 | + $updategroupaccess = true; |
|
| 114 | + $coupling = (int)$_REQUEST['coupling']; |
|
| 115 | + $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
|
| 116 | + break; |
|
| 117 | + default : |
|
| 118 | + $modx->webAlertAndQuit("No operation set in request."); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // secure manager documents - flag as private |
| 122 | 122 | if($updategroupaccess==true){ |
| 123 | - include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
| 124 | - secureMgrDocument(); |
|
| 123 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
| 124 | + secureMgrDocument(); |
|
| 125 | 125 | |
| 126 | - // Update the private group column |
|
| 127 | - $modx->getDatabase()->update( |
|
| 128 | - 'dgn.private_memgroup = (mga.membergroup IS NOT NULL)', |
|
| 129 | - "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_membergroup_access} AS mga ON mga.documentgroup = dgn.id"); |
|
| 126 | + // Update the private group column |
|
| 127 | + $modx->getDatabase()->update( |
|
| 128 | + 'dgn.private_memgroup = (mga.membergroup IS NOT NULL)', |
|
| 129 | + "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_membergroup_access} AS mga ON mga.documentgroup = dgn.id"); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $header = "Location: index.php?a=40"; |
@@ -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('access_permissions')) { |
|
| 5 | +if (!$modx->hasPermission('access_permissions')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | switch ($operation) { |
| 23 | 23 | case "add_user_group" : |
| 24 | 24 | $newgroup = $_REQUEST['newusergroup']; |
| 25 | - if(empty($newgroup)) { |
|
| 25 | + if (empty($newgroup)) { |
|
| 26 | 26 | $modx->webAlertAndQuit("No group name specified."); |
| 27 | 27 | } else { |
| 28 | 28 | $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | break; |
| 37 | 37 | case "add_document_group" : |
| 38 | 38 | $newgroup = $_REQUEST['newdocgroup']; |
| 39 | - if(empty($newgroup)) { |
|
| 39 | + if (empty($newgroup)) { |
|
| 40 | 40 | $modx->webAlertAndQuit("No group name specified."); |
| 41 | 41 | } else { |
| 42 | 42 | $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | break; |
| 51 | 51 | case "delete_user_group" : |
| 52 | 52 | $updategroupaccess = true; |
| 53 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
| 54 | - if(empty($usergroup)) { |
|
| 53 | + $usergroup = (int) $_REQUEST['usergroup']; |
|
| 54 | + if (empty($usergroup)) { |
|
| 55 | 55 | $modx->webAlertAndQuit("No user group id specified for deletion."); |
| 56 | 56 | } else { |
| 57 | 57 | $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | break; |
| 64 | 64 | case "delete_document_group" : |
| 65 | - $group = (int)$_REQUEST['documentgroup']; |
|
| 66 | - if(empty($group)) { |
|
| 65 | + $group = (int) $_REQUEST['documentgroup']; |
|
| 66 | + if (empty($group)) { |
|
| 67 | 67 | $modx->webAlertAndQuit("No document group id specified for deletion."); |
| 68 | 68 | } else { |
| 69 | 69 | $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | break; |
| 76 | 76 | case "rename_user_group" : |
| 77 | 77 | $newgroupname = $_REQUEST['newgroupname']; |
| 78 | - if(empty($newgroupname)) { |
|
| 78 | + if (empty($newgroupname)) { |
|
| 79 | 79 | $modx->webAlertAndQuit("No group name specified."); |
| 80 | 80 | } |
| 81 | - $groupid = (int)$_REQUEST['groupid']; |
|
| 82 | - if(empty($groupid)) { |
|
| 81 | + $groupid = (int) $_REQUEST['groupid']; |
|
| 82 | + if (empty($groupid)) { |
|
| 83 | 83 | $modx->webAlertAndQuit("No group id specified for rename."); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | break; |
| 88 | 88 | case "rename_document_group" : |
| 89 | 89 | $newgroupname = $_REQUEST['newgroupname']; |
| 90 | - if(empty($newgroupname)) { |
|
| 90 | + if (empty($newgroupname)) { |
|
| 91 | 91 | $modx->webAlertAndQuit("No group name specified."); |
| 92 | 92 | } |
| 93 | - $groupid = (int)$_REQUEST['groupid']; |
|
| 94 | - if(empty($groupid)) { |
|
| 93 | + $groupid = (int) $_REQUEST['groupid']; |
|
| 94 | + if (empty($groupid)) { |
|
| 95 | 95 | $modx->webAlertAndQuit("No group id specified for rename."); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | break; |
| 100 | 100 | case "add_document_group_to_user_group" : |
| 101 | 101 | $updategroupaccess = true; |
| 102 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
| 103 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
| 102 | + $usergroup = (int) $_REQUEST['usergroup']; |
|
| 103 | + $docgroup = (int) $_REQUEST['docgroup']; |
|
| 104 | 104 | $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
| 105 | 105 | $limit = $modx->getDatabase()->getValue($rs); |
| 106 | - if($limit<=0) { |
|
| 106 | + if ($limit <= 0) { |
|
| 107 | 107 | $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
| 108 | 108 | } else { |
| 109 | 109 | //alert user that coupling already exists? |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | break; |
| 112 | 112 | case "remove_document_group_from_user_group" : |
| 113 | 113 | $updategroupaccess = true; |
| 114 | - $coupling = (int)$_REQUEST['coupling']; |
|
| 114 | + $coupling = (int) $_REQUEST['coupling']; |
|
| 115 | 115 | $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
| 116 | 116 | break; |
| 117 | 117 | default : |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // secure manager documents - flag as private |
| 122 | -if($updategroupaccess==true){ |
|
| 122 | +if ($updategroupaccess == true) { |
|
| 123 | 123 | include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
| 124 | 124 | secureMgrDocument(); |
| 125 | 125 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | ?> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | ?> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | ?> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | ?> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | ?> |