Commit 324bd3e3db4a9d20306e5fb2b6b68ef27dfa848f

Authored by Neil Blakey-Milner
1 parent c8d63e09

Replace manual UPDATEs to whereUpdate


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3042 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/DocumentCollaboration.inc
@@ -75,11 +75,19 @@ class DocumentCollaboration { @@ -75,11 +75,19 @@ class DocumentCollaboration {
75 */ 75 */
76 function resetDocumentCollaborationSteps($iDocumentID) { 76 function resetDocumentCollaborationSteps($iDocumentID) {
77 global $default; 77 global $default;
78 - $sql = $default->db;  
79 - if ($sql->query("UPDATE $default->folders_user_roles_table SET active = 0, done = 0 WHERE document_id = $iDocumentID")) {  
80 - return true; 78 + $aFieldValues = array(
  79 + 'active' => 0,
  80 + 'done' => 0,
  81 + );
  82 + $aWhereFieldValues = array(
  83 + 'document_id' => $iDocumentID,
  84 + );
  85 + $res =& DBUtil::whereUpdate($default->folders_user_roles_table, $aFieldValues, $aWhereFieldValues);
  86 +
  87 + if (PEAR::isError($res)) {
  88 + return false;
81 } 89 }
82 - return false; 90 + return true;
83 } 91 }
84 92
85 /** 93 /**
@@ -427,4 +435,4 @@ class DocumentCollaboration { @@ -427,4 +435,4 @@ class DocumentCollaboration {
427 435
428 } 436 }
429 437
430 -?>  
431 \ No newline at end of file 438 \ No newline at end of file
  439 +?>
lib/session/Session.inc
@@ -141,8 +141,14 @@ class Session { @@ -141,8 +141,14 @@ class Session {
141 } 141 }
142 142
143 // update last used timestamp 143 // update last used timestamp
144 - $sql->query("UPDATE $default->sessions_table SET lastused = '" . getCurrentDateTime() ."' " .  
145 - "WHERE user_id = $iUserID AND session_id = '$sessionID'"); 144 + $aFV = array(
  145 + 'lastused' => getCurrentDateTime(),
  146 + );
  147 + $aWFV = array(
  148 + 'user_id' => $iUserID,
  149 + 'session_id' => $sessionID,
  150 + );
  151 + $res = DBUtil::whereUpdate($default->sessions_table, $aFV, $aWFV);
146 // add the array to the session 152 // add the array to the session
147 $_SESSION["sessionStatus"] = $sessionStatus; 153 $_SESSION["sessionStatus"] = $sessionStatus;
148 } else { 154 } else {