|
@@ -298,6 +298,21 @@ class Helpers
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static function validateTimestamp($timestamp)
|
|
|
|
+ {
|
|
|
|
+ try {
|
|
|
|
+ $date = Carbon::parse($timestamp);
|
|
|
|
+ $now = Carbon::now();
|
|
|
|
+ $tenYearsAgo = $now->copy()->subYears(10);
|
|
|
|
+ $isMoreThanTenYearsOld = $date->lt($tenYearsAgo);
|
|
|
|
+ $tomorrow = $now->copy()->addDay();
|
|
|
|
+ $isMoreThanOneDayFuture = $date->gt($tomorrow);
|
|
|
|
+ return !($isMoreThanTenYearsOld || $isMoreThanOneDayFuture);
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public static function statusFirstOrFetch($url, $replyTo = false)
|
|
public static function statusFirstOrFetch($url, $replyTo = false)
|
|
{
|
|
{
|
|
$url = self::validateUrl($url);
|
|
$url = self::validateUrl($url);
|
|
@@ -329,6 +344,10 @@ class Helpers
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(!self::validateTimestamp($res['published'])) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (config('autospam.live_filters.enabled')) {
|
|
if (config('autospam.live_filters.enabled')) {
|
|
$filters = config('autospam.live_filters.filters');
|
|
$filters = config('autospam.live_filters.filters');
|
|
if (! empty($filters) && isset($res['content']) && ! empty($res['content']) && strlen($filters) > 3) {
|
|
if (! empty($filters) && isset($res['content']) && ! empty($res['content']) && strlen($filters) > 3) {
|