AffinityLog.php
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
class AffinityLog {
const className = "AffinityLog";
const TYPE_DEBUG = "debug";
const TYPE_WARNING = "warning";
const TYPE_ERROR = "error";
public $id;
public $strDateTime;
public $type;
public $title;
public $details;
public $numDateTime;
public static function saveLog($constType, $title, $details) {
$obj = new AffinityLog();
$obj->strDateTime = date("d/m/Y H:i:s");
$obj->numDateTime = time();
$obj->type = $constType;
$obj->title = $title;
$obj->details = str_replace("password", "********", $details); //@Todo: make a decent filter for passwords
$obj->save();
}
private function save() {
require_once(__DIR__ . "/../ecommerce-adapters/AffinityDataLayer.php");
try {
return AffinityDataLayer::save($this);
} catch (Exception $e) {
return false;
}
}
public static function getAll($limit = 10, $offset = 0, $s = '', $startdate = '', $enddate = '') {
require_once(__DIR__ . "/../ecommerce-adapters/AffinityDataLayer.php");
return AffinityDataLayer::getAll(self::className, $limit, $offset, 'DESC', stripslashes($s), stripslashes($startdate), stripslashes($enddate));
}
}