mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
@@ -103,7 +103,7 @@ trait TrRequestData
|
||||
|
||||
private static function checkIdListUnsigned(string $val) : array
|
||||
{
|
||||
if (preg_match('/\d+(,\d+)*/', $val))
|
||||
if (preg_match('/^\d+(,\d+)*$/', $val))
|
||||
return array_map('intVal', explode(',', $val));
|
||||
|
||||
return [];
|
||||
|
||||
@@ -28,7 +28,7 @@ class ScreenshotPage extends GenericPage
|
||||
protected $imgHash = '';
|
||||
|
||||
protected $_post = array(
|
||||
'coords' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkIdListUnsigned'],
|
||||
'coords' => ['filter' => FILTER_CALLBACK, 'options' => 'ScreenshotPage::checkCoords'],
|
||||
'screenshotalt' => ['filter' => FILTER_UNSAFE_RAW, 'flags' => FILTER_FLAG_STRIP_AOWOW]
|
||||
);
|
||||
|
||||
@@ -196,7 +196,7 @@ class ScreenshotPage extends GenericPage
|
||||
if (count($dims) != 4)
|
||||
return 3;
|
||||
|
||||
Util::checkNumeric($dims, NUM_REQ_INT);
|
||||
Util::checkNumeric($dims, NUM_CAST_FLOAT);
|
||||
|
||||
// actually crop the image
|
||||
$srcImg = imagecreatefromjpeg($fullPath);
|
||||
@@ -333,6 +333,14 @@ class ScreenshotPage extends GenericPage
|
||||
return $this->imgHash ? User::$displayName.'-'.$this->destType.'-'.$this->destTypeId.'-'.$this->imgHash : '';
|
||||
}
|
||||
|
||||
protected static function checkCoords(string $val) : array
|
||||
{
|
||||
if (preg_match('/^[01]\.[0-9]{3}(,[01]\.[0-9]{3}){3}$/', $val))
|
||||
return explode(',', $val);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function generatePath() : void { }
|
||||
protected function generateTitle() : void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user