Commit 8b7301d2a42e48af6850124595f0d301eb7d98fe

Authored by Brad Shuttleworth
1 parent d241a7e1

add admin mode logging.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5317 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/DocumentTransaction.inc
... ... @@ -33,6 +33,9 @@ require_once(KT_LIB_DIR . "/documentmanagement/documentutil.inc.php");
33 33 require_once(KT_LIB_DIR . '/users/User.inc');
34 34 require_once(KT_LIB_DIR . '/documentmanagement/DocumentTransactionType.inc.php');
35 35  
  36 +require_once(KT_LIB_DIR . '/foldermanagement/Folder.inc');
  37 +require_once(KT_LIB_DIR . '/browse/browseutil.inc.php');
  38 +
36 39 class DocumentTransaction {
37 40  
38 41 /** primary key of document transaction */
... ... @@ -45,6 +48,7 @@ class DocumentTransaction {
45 48 var $sFileName;
46 49 var $sComment;
47 50 var $sTransactionNS;
  51 + var $bAdminMode = 0;
48 52  
49 53 /**
50 54 * Constructor
... ... @@ -82,6 +86,18 @@ class DocumentTransaction {
82 86 }
83 87 $this->dDateTime = getCurrentDateTime();
84 88 $this->sIP = KTUtil::arrayGet($_SERVER, "REMOTE_ADDR", '0.0.0.0');
  89 +
  90 + $oFolder = Folder::get($oDocument->getFolderID());
  91 + // head off the certain breakage down the line.
  92 + if (PEAR::isError($oFolder) || ($oFolder === false)) {
  93 + $this->bAdminMode = 0;
  94 + } else {
  95 + if (KTBrowseUtil::inAdminMode($oUser, $oFolder)) {
  96 + $this->bAdminMode = 1;
  97 + } else {
  98 + $this->bAdminMode = 0;
  99 + }
  100 + }
85 101 }
86 102  
87 103 function getVersion() { return $this->sVersion; }
... ... @@ -121,6 +137,7 @@ class DocumentTransaction {
121 137 'comment' => $this->sComment,
122 138 'transaction_namespace' => $this->sTransactionNS,
123 139 'session_id' => $this->iSessionId,
  140 + 'admin_mode' => $this->bAdminMode,
124 141 );
125 142 $id =& DBUtil::autoInsert($this->_table(), $aFieldValues);
126 143  
... ... @@ -177,6 +194,7 @@ class DocumentTransaction {
177 194 $oDocumentTransaction->dDateTime = $sql->f("datetime");
178 195 $oDocumentTransaction->sIP = $sql->f("ip");
179 196 $oDocumentTransaction->sFileName = $sql->f("filename");
  197 + $oDocumentTransaction->bAdminMode = $sql->f("admin_mode");
180 198 return $oDocumentTransaction;
181 199 }
182 200 $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentTransactionID . " table = document_transactions";
... ...
lib/foldermanagement/foldertransaction.inc.php
... ... @@ -38,6 +38,7 @@ class KTFolderTransaction extends KTEntity {
38 38 'sComment' => 'comment',
39 39 'sTransactionNS' => 'transaction_namespace',
40 40 'iSessionId' => 'session_id',
  41 + 'bAdminMode' => 'admin_mode',
41 42 );
42 43  
43 44 var $_bUsePearError = true;
... ... @@ -53,6 +54,17 @@ class KTFolderTransaction extends KTEntity {
53 54 if (empty($this->iSessionId)) {
54 55 $this->iSessionId = $_SESSION['sessionID'];
55 56 }
  57 + $oFolder = Folder::get($this->iFolderId);
  58 + // head off the certain breakage down the line.
  59 + if (PEAR::isError($oFolder) || ($oFolder === false)) {
  60 + $this->bAdminMode = 0;
  61 + } else {
  62 + if (KTBrowseUtil::inAdminMode($oUser, $oFolder)) {
  63 + $this->bAdminMode = 1;
  64 + } else {
  65 + $this->bAdminMode = 0;
  66 + }
  67 + }
56 68 return parent::_fieldValues();
57 69 }
58 70  
... ...
sql/mysql/upgrade/3.0.1.8/admin-mode-logging.sql 0 → 100644
  1 +ALTER TABLE `folder_transactions` ADD admin_mode TINYINT(1) NOT NULL default 0;
  2 +ALTER TABLE `document_transactions` ADD admin_mode TINYINT(1) NOT NULL default 0;
0 3 \ No newline at end of file
... ...