Избавляемся от констант и глобальных переменных
This commit is contained in:
parent
8b38b2a3cc
commit
f041488554
10 changed files with 39 additions and 33 deletions
|
|
@ -1,26 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Filter;
|
||||
use ctiso\Shortcut,
|
||||
ctiso\HttpRequest,
|
||||
ctiso\Filter\UserAccess;
|
||||
use ctiso\HttpRequest;
|
||||
|
||||
class ActionLogger
|
||||
{
|
||||
public $before = array();
|
||||
public $file;
|
||||
public $user;
|
||||
public $action;
|
||||
public $processor;
|
||||
|
||||
function __construct(/*.Filter_Filter.*/$processor) {
|
||||
function __construct(/*.Filter_Filter.*/$processor, $logPath, $user) {
|
||||
$this->processor = $processor;
|
||||
$this->file = fopen(Shortcut::getUrl('access.log'), "a");
|
||||
$this->user = $user;
|
||||
$this->file = fopen($logPath, "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: " . UserAccess::$name . "\n");
|
||||
fwrite($this->file, "time: " . date("r", time()) . " query: ". json_encode(array_merge($_POST, $_GET)) . " by: " . $this->user->name . "\n");
|
||||
}
|
||||
return $this->processor->execute($request);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue