function WriteAuditTrailOnEdit(&$rsold, &$rsnew) { if (!$this->AuditTrailOnEdit) { return; } $table = 'socios'; // Get key value $key = ""; if ($key != "") { $key .= $GLOBALS["EW_COMPOSITE_KEY_SEPARATOR"]; } $key .= $rsold['socio_nro']; // Write Audit Trail $dt = ew_StdCurrentDateTime(); $id = ew_ScriptName(); $usr = CurrentUserID(); foreach (array_keys($rsnew) as $fldname) { if ($this->fields[$fldname]->FldDataType != EW_DATATYPE_BLOB) { // Ignore BLOB fields if ($this->fields[$fldname]->FldDataType == EW_DATATYPE_DATE) { // DateTime field $modified = ew_FormatDateTime($rsold[$fldname], 0) != ew_FormatDateTime($rsnew[$fldname], 0); } else { $modified = !ew_CompareValue($rsold[$fldname], $rsnew[$fldname]); } if ($modified) { if ($this->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) { // Memo field if (EW_AUDIT_TRAIL_TO_DATABASE) { $oldvalue = $rsold[$fldname]; $newvalue = $rsnew[$fldname]; } else { $oldvalue = "[MEMO]"; $newvalue = "[MEMO]"; } } elseif ($this->fields[$fldname]->FldDataType == EW_DATATYPE_XML) { // XML field $oldvalue = "[XML]"; $newvalue = "[XML]"; } else { $oldvalue = $rsold[$fldname]; $newvalue = $rsnew[$fldname]; } ew_WriteAuditTrail("log", $dt, $id, $usr, "U", $table, $fldname, $key, $oldvalue, $newvalue); } } } }
function WriteAuditTrailOnAdd(&$rs) { if (!$this->AuditTrailOnAdd) { return; } $table = 'montos'; // Get key value $key = ""; if ($key != "") { $key .= $GLOBALS["EW_COMPOSITE_KEY_SEPARATOR"]; } $key .= $rs['id']; // Write Audit Trail $dt = ew_StdCurrentDateTime(); $id = ew_ScriptName(); $usr = CurrentUserID(); foreach (array_keys($rs) as $fldname) { if ($this->fields[$fldname]->FldDataType != EW_DATATYPE_BLOB) { // Ignore BLOB fields if ($this->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) { if (EW_AUDIT_TRAIL_TO_DATABASE) { $newvalue = $rs[$fldname]; } else { $newvalue = "[MEMO]"; } // Memo Field } elseif ($this->fields[$fldname]->FldDataType == EW_DATATYPE_XML) { $newvalue = "[XML]"; // XML Field } else { $newvalue = $rs[$fldname]; } ew_WriteAuditTrail("log", $dt, $id, $usr, "A", $table, $fldname, $key, "", $newvalue); } } }
function WriteAuditTrailOnLogout($usr) { global $Language; ew_WriteAuditTrail("log", ew_StdCurrentDateTime(), ew_ScriptName(), $usr, $Language->Phrase("AuditTrailLogout"), ew_CurrentUserIP(), "", "", "", ""); }
function WriteAuditTrailDummy($typ) { $table = 'deudas'; $usr = CurrentUserID(); ew_WriteAuditTrail("log", ew_StdCurrentDateTime(), ew_ScriptName(), $usr, $typ, $table, "", "", "", ""); }
function ew_WriteAuditTrailOnLogInOut($usr, $logtype) { ew_WriteAuditTrail("log", ew_StdCurrentDateTime(), ew_ScriptName(), $usr, $logtype, ew_CurrentUserIP(), "", "", "", ""); }
function ew_WriteAuditTrailOnLogInOut($logtype) { $table = $logtype; $sKey = ""; // Write Audit Trail $filePfx = "log"; $curDate = date("Y/m/d"); $curTime = date("H:i:s"); $id = ew_ScriptName(); $user = CurrentUserName(); $action = $logtype; ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, "", "", "", ""); }
function WriteAuditTrailOnDelete(&$rs) { if (!$this->AuditTrailOnDelete) { return; } $table = 'usuario'; // Get key value $key = ""; if ($key != "") { $key .= $GLOBALS["EW_COMPOSITE_KEY_SEPARATOR"]; } $key .= $rs['id']; // Write Audit Trail $dt = ew_StdCurrentDateTime(); $id = ew_ScriptName(); $curUser = CurrentUserID(); foreach (array_keys($rs) as $fldname) { if (array_key_exists($fldname, $this->fields) && $this->fields[$fldname]->FldDataType != EW_DATATYPE_BLOB) { // Ignore BLOB fields if ($this->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) { if (EW_AUDIT_TRAIL_TO_DATABASE) { $oldvalue = $rs[$fldname]; } else { $oldvalue = "[MEMO]"; } // Memo field } elseif ($this->fields[$fldname]->FldDataType == EW_DATATYPE_XML) { $oldvalue = "[XML]"; // XML field } else { $oldvalue = $rs[$fldname]; } ew_WriteAuditTrail("log", $dt, $id, $curUser, "D", $table, $fldname, $key, $oldvalue, ""); } } }
function AutoLogin() { if (@$_COOKIE[EW_PROJECT_NAME]['AutoLogin'] == "autologin") { $usr = ew_Decrypt(@$_COOKIE[EW_PROJECT_NAME]['Username']); $pwd = ew_Decrypt(@$_COOKIE[EW_PROJECT_NAME]['Password']); $AutoLogin = $this->ValidateUser($usr, $pwd, TRUE); if ($AutoLogin) { ew_WriteAuditTrail("log", ew_StdCurrentDateTime(), ew_ScriptName(), $usr, $GLOBALS["Language"]->Phrase("AuditTrailAutoLogin"), ew_CurrentUserIP(), "", "", "", ""); } } else { $AutoLogin = FALSE; } return $AutoLogin; }