first commit
This commit is contained in:
commit
1218dd1517
12716 files changed
+989233
No files matched your search
@@ -0,0 +1,344 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Belog\Domain\Model;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constraints for log entries
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class Constraint
|
||||
{
|
||||
/**
|
||||
* Selected user/group; possible values are "gr-<uid>" for a group, "us-<uid>" for a user or -1 for "all users"
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $userOrGroup = '0';
|
||||
|
||||
/**
|
||||
* Number of log rows to show
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $number = 20;
|
||||
|
||||
/**
|
||||
* UID of selected workspace
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $workspaceUid = \TYPO3\CMS\Belog\Domain\Model\Workspace::UID_ANY_WORKSPACE;
|
||||
|
||||
/**
|
||||
* Selected time frame
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $timeFrame = 0;
|
||||
|
||||
/**
|
||||
* Selected action
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $action = 0;
|
||||
|
||||
/**
|
||||
* Whether rows should be grouped by page
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $groupByPage = false;
|
||||
|
||||
/**
|
||||
* Calculated start timestamp
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $startTimestamp = 0;
|
||||
|
||||
/**
|
||||
* Calculated end timestamp
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $endTimestamp = 0;
|
||||
|
||||
/**
|
||||
* Manual date start
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $manualDateStart;
|
||||
|
||||
/**
|
||||
* Manual date stop
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $manualDateStop;
|
||||
|
||||
/**
|
||||
* Selected page ID in page context
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $pageId = 0;
|
||||
|
||||
/**
|
||||
* Page level depth
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $depth = 0;
|
||||
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param string $user
|
||||
*/
|
||||
public function setUserOrGroup($user)
|
||||
{
|
||||
$this->userOrGroup = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserOrGroup()
|
||||
{
|
||||
return $this->userOrGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set number of log rows to show
|
||||
*
|
||||
* @param int $number
|
||||
*/
|
||||
public function setNumber($number)
|
||||
{
|
||||
$this->number = (int)$number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of log entries to show
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNumber()
|
||||
{
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set workspace
|
||||
*
|
||||
* @param string $workspace
|
||||
*/
|
||||
public function setWorkspaceUid($workspace)
|
||||
{
|
||||
$this->workspaceUid = $workspace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get workspace
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getWorkspaceUid()
|
||||
{
|
||||
return $this->workspaceUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set time frame
|
||||
*
|
||||
* @param int $timeFrame
|
||||
*/
|
||||
public function setTimeFrame($timeFrame)
|
||||
{
|
||||
$this->timeFrame = $timeFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get time frame
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTimeFrame()
|
||||
{
|
||||
return (int)$this->timeFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set action
|
||||
*
|
||||
* @param int $action
|
||||
*/
|
||||
public function setAction($action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get action
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return (int)$this->action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set group by page
|
||||
*
|
||||
* @param bool $groupByPage
|
||||
*/
|
||||
public function setGroupByPage($groupByPage)
|
||||
{
|
||||
$this->groupByPage = $groupByPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group by page
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getGroupByPage()
|
||||
{
|
||||
return (bool)$this->groupByPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set calculated start timestamp from query constraints
|
||||
*
|
||||
* @param int $timestamp
|
||||
*/
|
||||
public function setStartTimestamp($timestamp)
|
||||
{
|
||||
$this->startTimestamp = (int)$timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get calculated start timestamp from query constraints
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStartTimestamp()
|
||||
{
|
||||
return $this->startTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set calculated end timestamp from query constraints
|
||||
*
|
||||
* @param int $timestamp
|
||||
*/
|
||||
public function setEndTimestamp($timestamp)
|
||||
{
|
||||
$this->endTimestamp = (int)$timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get calculated end timestamp from query constraints
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getEndTimestamp()
|
||||
{
|
||||
return $this->endTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set page id
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function setPageId($id)
|
||||
{
|
||||
$this->pageId = (int)$id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get page id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPageId()
|
||||
{
|
||||
return $this->pageId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set page level depth
|
||||
*
|
||||
* @param int $depth
|
||||
*/
|
||||
public function setDepth($depth)
|
||||
{
|
||||
$this->depth = $depth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get page level depth
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDepth()
|
||||
{
|
||||
return (int)$this->depth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set manual date start
|
||||
*
|
||||
* @param \DateTime $manualDateStart
|
||||
*/
|
||||
public function setManualDateStart(\DateTime $manualDateStart = null)
|
||||
{
|
||||
$this->manualDateStart = $manualDateStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get manual date start
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getManualDateStart()
|
||||
{
|
||||
return $this->manualDateStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set manual date stop
|
||||
*
|
||||
* @param \DateTime $manualDateStop
|
||||
*/
|
||||
public function setManualDateStop(\DateTime $manualDateStop = null)
|
||||
{
|
||||
$this->manualDateStop = $manualDateStop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get manual date stop
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getManualDateStop()
|
||||
{
|
||||
return $this->manualDateStop;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,489 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Belog\Domain\Model;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* A sys log entry
|
||||
* This model is 'complete': All current database properties are in there.
|
||||
*
|
||||
* @todo : This should be stuffed to some more central place
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class LogEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
||||
{
|
||||
/**
|
||||
* Storage page ID of the log entry
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $pid = 0;
|
||||
|
||||
/**
|
||||
* This is not a relation to BeUser model, since the user does
|
||||
* not always exist, but we want the uid in then anyway.
|
||||
* This case is ugly in extbase, the best way we
|
||||
* have found now is to resolve the username (if it exists) in a
|
||||
* view helper and just use the uid of the be user here.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $backendUserUid = 0;
|
||||
|
||||
/**
|
||||
* Action ID of the action that happened, for example 3 was a file action
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $action = 0;
|
||||
|
||||
/**
|
||||
* UID of the record the event happened to
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $recordUid = 0;
|
||||
|
||||
/**
|
||||
* Table name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 0;
|
||||
|
||||
/**
|
||||
* PID of the record the event happened to
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $recordPid = 0;
|
||||
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $error = 0;
|
||||
|
||||
/**
|
||||
* This is the log message itself, but possibly with %s substitutions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $details = '';
|
||||
|
||||
/**
|
||||
* Timestamp when the log entry was written
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $tstamp = 0;
|
||||
|
||||
/**
|
||||
* Type code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $type = 0;
|
||||
|
||||
/**
|
||||
* Details number
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $detailsNumber = 0;
|
||||
|
||||
/**
|
||||
* IP address of client
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $ip = '';
|
||||
|
||||
/**
|
||||
* Serialized log data. This is a serialized array with substitutions for $this->details.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $logData = '';
|
||||
|
||||
/**
|
||||
* Event PID
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $eventPid = 0;
|
||||
|
||||
/**
|
||||
* This is only the UID and not the full workspace object for the same reason as in $beUserUid.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $workspaceUid = 0;
|
||||
|
||||
/**
|
||||
* New ID
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $newId = 0;
|
||||
|
||||
/**
|
||||
* Set pid
|
||||
*
|
||||
* @param int $pid
|
||||
*/
|
||||
public function setPid($pid)
|
||||
{
|
||||
$this->pid = (int)$pid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pid
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPid()
|
||||
{
|
||||
return $this->pid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set backend user uid
|
||||
*
|
||||
* @param int $beUserUid
|
||||
*/
|
||||
public function setBackendUserUid($beUserUid)
|
||||
{
|
||||
$this->backendUserUid = $beUserUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get backend user id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBackendUserUid()
|
||||
{
|
||||
return $this->backendUserUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set action
|
||||
*
|
||||
* @param int $action
|
||||
*/
|
||||
public function setAction($action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get action
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return (int)$this->action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set record uid
|
||||
*
|
||||
* @param int $recordUid
|
||||
*/
|
||||
public function setRecordUid($recordUid)
|
||||
{
|
||||
$this->recordUid = $recordUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get record uid
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRecordUid()
|
||||
{
|
||||
return (int)$this->recordUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set table name
|
||||
*
|
||||
* @param string $tableName
|
||||
*/
|
||||
public function setTableName($tableName)
|
||||
{
|
||||
$this->tableName = $tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get table name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTableName()
|
||||
{
|
||||
return $this->tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set record pid
|
||||
*
|
||||
* @param int $recordPid
|
||||
*/
|
||||
public function setRecordPid($recordPid)
|
||||
{
|
||||
$this->recordPid = $recordPid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get record pid
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRecordPid()
|
||||
{
|
||||
return (int)$this->recordPid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set error
|
||||
*
|
||||
* @param int $error
|
||||
*/
|
||||
public function setError($error)
|
||||
{
|
||||
$this->error = $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get error
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return (int)$this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get class name for the error code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorIconClass(): string
|
||||
{
|
||||
switch ($this->getError()) {
|
||||
case 1:
|
||||
return 'status-dialog-warning';
|
||||
case 2:
|
||||
case 3:
|
||||
return 'status-dialog-error';
|
||||
default:
|
||||
return 'empty-empty';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set details
|
||||
*
|
||||
* @param string $details
|
||||
*/
|
||||
public function setDetails($details)
|
||||
{
|
||||
$this->details = $details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get details
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDetails()
|
||||
{
|
||||
if ($this->type === 255) {
|
||||
return str_replace('###IP###', $this->ip, $this->details);
|
||||
}
|
||||
return $this->details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set tstamp
|
||||
*
|
||||
* @param int $tstamp
|
||||
*/
|
||||
public function setTstamp($tstamp)
|
||||
{
|
||||
$this->tstamp = $tstamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tstamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTstamp()
|
||||
{
|
||||
return (int)$this->tstamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
* @param int $type
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return (int)$this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set details number
|
||||
*
|
||||
* @param int $detailsNumber
|
||||
*/
|
||||
public function setDetailsNumber($detailsNumber)
|
||||
{
|
||||
$this->detailsNumber = $detailsNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get details number
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDetailsNumber()
|
||||
{
|
||||
return (int)$this->detailsNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ip
|
||||
*
|
||||
* @param string $ip
|
||||
*/
|
||||
public function setIp($ip)
|
||||
{
|
||||
$this->ip = $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ip
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIp()
|
||||
{
|
||||
return $this->ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set log data
|
||||
*
|
||||
* @param string $logData
|
||||
*/
|
||||
public function setLogData($logData)
|
||||
{
|
||||
$this->logData = $logData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get log data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLogData()
|
||||
{
|
||||
if ($this->logData === '') {
|
||||
return [];
|
||||
}
|
||||
$logData = @unserialize($this->logData);
|
||||
if (!is_array($logData)) {
|
||||
$logData = [];
|
||||
}
|
||||
return $logData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set event pid
|
||||
*
|
||||
* @param int $eventPid
|
||||
*/
|
||||
public function setEventPid($eventPid)
|
||||
{
|
||||
$this->eventPid = $eventPid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get event pid
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getEventPid()
|
||||
{
|
||||
return (int)$this->eventPid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set workspace uid
|
||||
*
|
||||
* @param int $workspaceUid
|
||||
*/
|
||||
public function setWorkspaceUid($workspaceUid)
|
||||
{
|
||||
$this->workspaceUid = $workspaceUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get workspace
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getWorkspaceUid()
|
||||
{
|
||||
return (int)$this->workspaceUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new id
|
||||
*
|
||||
* @param string $newId
|
||||
*/
|
||||
public function setNewId($newId)
|
||||
{
|
||||
$this->newId = $newId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get new id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNewId()
|
||||
{
|
||||
return $this->newId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Belog\Domain\Model;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stub model for workspaces - only properties required for belog module are added currently
|
||||
*
|
||||
* @todo : This should be extended and put at some more central place
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class Workspace extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const UID_LIVE_WORKSPACE = 0;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const UID_ANY_WORKSPACE = -99;
|
||||
|
||||
/**
|
||||
* title of the workspace
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $title = '';
|
||||
|
||||
/**
|
||||
* Set workspace title
|
||||
*
|
||||
* @param string $title
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get workspace title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user