Commit c308ece9340f57c946706306c280667968c549e6

Authored by Brad Shuttleworth
1 parent ba8db615

add admin mode entry-exit logging.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5321 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 34 additions and 1 deletions
browse.php
... ... @@ -46,6 +46,8 @@ require_once(KT_DIR . '/plugins/ktcore/KTFolderActions.php');
46 46 require_once(KT_LIB_DIR . "/permissions/permissionutil.inc.php");
47 47 require_once(KT_LIB_DIR . "/permissions/permission.inc.php");
48 48  
  49 +require_once(KT_LIB_DIR . '/users/userhistory.inc.php');
  50 +
49 51 /******* NBM's FAMOUS MOVECOLUMN HACK
50 52 *
51 53 * Also in /plugins/ktcore/KTDocumentActions.php
... ... @@ -818,8 +820,25 @@ class BrowseDispatcher extends KTStandardDispatcher {
818 820 if (!Permission::userIsSystemAdministrator() && !Permission::isUnitAdministratorForFolder($this->oUser, $iFolderId)) {
819 821 $this->errorRedirectToMain(_kt('You are not an administrator'));
820 822 }
821   -
  823 +
  824 + // log this entry
  825 + $oLogEntry =& KTUserHistory::createFromArray(array(
  826 + 'userid' => $this->oUser->getId(),
  827 + 'datetime' => date("Y-m-d H:i:s", time()),
  828 + 'actionnamespace' => 'ktcore.user_history.enable_admin_mode',
  829 + 'comments' => 'Admin Mode enabled',
  830 + 'sessionid' => $_SESSION['sessionID'],
  831 + ));
  832 + $aOpts = array(
  833 + 'redirect_to' => 'main',
  834 + 'message' => _kt('Unable to log admin mode entry. Not activating admin mode.'),
  835 + );
  836 + $this->oValidator->notError($oLogEntry, $aOpts);
  837 +
822 838 $_SESSION['adminmode'] = true;
  839 +
  840 +
  841 +
823 842 if ($_REQUEST['fDocumentId']) {
824 843 $_SESSION['KTInfoMessage'][] = _kt('Administrator mode enabled');
825 844 redirect(KTBrowseUtil::getUrlForDocument($iDocumentId));
... ... @@ -846,6 +865,20 @@ class BrowseDispatcher extends KTStandardDispatcher {
846 865 $this->errorRedirectToMain(_kt('You are not an administrator'));
847 866 }
848 867  
  868 + // log this entry
  869 + $oLogEntry =& KTUserHistory::createFromArray(array(
  870 + 'userid' => $this->oUser->getId(),
  871 + 'datetime' => date("Y-m-d H:i:s", time()),
  872 + 'actionnamespace' => 'ktcore.user_history.disable_admin_mode',
  873 + 'comments' => 'Admin Mode disabled',
  874 + 'sessionid' => $_SESSION['sessionID'],
  875 + ));
  876 + $aOpts = array(
  877 + 'redirect_to' => 'main',
  878 + 'message' => _kt('Unable to log admin mode exit. Not de-activating admin mode.'),
  879 + );
  880 + $this->oValidator->notError($oLogEntry, $aOpts);
  881 +
849 882 $_SESSION['adminmode'] = false;
850 883 if ($_REQUEST['fDocumentId']) {
851 884 $_SESSION['KTInfoMessage'][] = _kt('Administrator mode disabled');
... ...