mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Reports/Fixup
* reports can have 'null' subject (general bug reports, general feedback)
This commit is contained in:
@@ -38,8 +38,8 @@ class AjaxContactus extends AjaxHandler
|
|||||||
$report = new Report($this->_post['mode'], $this->_post['reason'], $this->_post['id']);
|
$report = new Report($this->_post['mode'], $this->_post['reason'], $this->_post['id']);
|
||||||
if ($report->create($this->_post['desc'], $this->_post['ua'], $this->_post['appname'], $this->_post['page'], $this->_post['relatedurl'], $this->_post['email']))
|
if ($report->create($this->_post['desc'], $this->_post['ua'], $this->_post['appname'], $this->_post['page'], $this->_post['relatedurl'], $this->_post['email']))
|
||||||
return 0;
|
return 0;
|
||||||
else if ($report->errorCode > 0)
|
else if (($e = $report->getError()) > 0)
|
||||||
return $report->errorCode;
|
return $e;
|
||||||
else
|
else
|
||||||
return Lang::main('intError');
|
return Lang::main('intError');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1934,7 +1934,7 @@ class Report
|
|||||||
public const AR_OUT_OF_DATE = 46;
|
public const AR_OUT_OF_DATE = 46;
|
||||||
public const AR_MISCELLANEOUS = 48;
|
public const AR_MISCELLANEOUS = 48;
|
||||||
|
|
||||||
private /* array */ $context = array(
|
private array $context = array(
|
||||||
self::MODE_GENERAL => array(
|
self::MODE_GENERAL => array(
|
||||||
self::GEN_FEEDBACK => true,
|
self::GEN_FEEDBACK => true,
|
||||||
self::GEN_BUG_REPORT => true,
|
self::GEN_BUG_REPORT => true,
|
||||||
@@ -1997,16 +1997,12 @@ class Report
|
|||||||
public const STATUS_CLOSED_WONTFIX = 2;
|
public const STATUS_CLOSED_WONTFIX = 2;
|
||||||
public const STATUS_CLOSED_SOLVED = 3;
|
public const STATUS_CLOSED_SOLVED = 3;
|
||||||
|
|
||||||
private /* int */ $mode = 0;
|
private int $errorCode = self::ERR_NONE;
|
||||||
private /* int */ $reason = 0;
|
|
||||||
private /* int */ $subject = 0;
|
|
||||||
|
|
||||||
public /* readonly int */ $errorCode;
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct(int $mode, int $reason, int $subject = 0)
|
public function __construct(private int $mode, private int $reason, private ?int $subject = 0)
|
||||||
{
|
{
|
||||||
if ($mode < 0 || $reason <= 0 || !$subject)
|
if ($mode < 0 || $reason <= 0)
|
||||||
{
|
{
|
||||||
trigger_error('Report - malformed contact request received', E_USER_ERROR);
|
trigger_error('Report - malformed contact request received', E_USER_ERROR);
|
||||||
$this->errorCode = self::ERR_MISCELLANEOUS;
|
$this->errorCode = self::ERR_MISCELLANEOUS;
|
||||||
@@ -2027,9 +2023,7 @@ class Report
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->mode = $mode;
|
$this->subject ??= 0; // 0 for utility, tools and misc pages?
|
||||||
$this->reason = $reason;
|
|
||||||
$this->subject = $subject; // 0 for utility, tools and misc pages?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkTargetContext() : int
|
private function checkTargetContext() : int
|
||||||
@@ -2152,6 +2146,11 @@ class Report
|
|||||||
// assignedTo = 0 ? status = STATUS_OPEN : status = STATUS_ASSIGNED, userId = assignedTo
|
// assignedTo = 0 ? status = STATUS_OPEN : status = STATUS_ASSIGNED, userId = assignedTo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getError() : int
|
||||||
|
{
|
||||||
|
return $this->errorCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user