phplibrary/src/Filter/ActionLogger.php

22 lines
664 B
PHP

<?php
class Filter_ActionLogger
{
public $before = array();
public $file;
public $action;
public $processor;
function __construct(/*.Filter_Filter.*/$processor) {
$this->processor = $processor;
$this->file = fopen(Shortcut::getUrl('access.log'), "a");
}
function execute(HttpRequest $request) {
$action = $request->getAction();
if(in_array($action, $this->before)) {
fwrite($this->file, "time: " . date("r", time()) . " query: ". json_encode(array_merge($_POST, $_GET)) . " by: " . Filter_UserAccess::$name . "\n");
}
return $this->processor->execute($request);
}
}