summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-01-11 00:38:32 +0100
committeremkael <emkael@tlen.pl>2017-01-11 00:38:32 +0100
commit4ea787e34ddbfa62781fa6ea4b6fd4af39ef9ff0 (patch)
tree648d53773d156d7a20396f9f6c4f4452cebefa5f
parent2e47c6fd675f316b8226672ee224796eb9dca769 (diff)
* aggressive spam filtering, because MSM is fucking ridiculous
-rw-r--r--http/index.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/http/index.php b/http/index.php
index 1c0fae3..572f857 100644
--- a/http/index.php
+++ b/http/index.php
@@ -71,14 +71,27 @@ if ($user) {
$filteredContent = [];
foreach ($content as $c) {
if (!in_array($c->id_str, $spamContent)) {
- $urls = array_map(
- function($url) {
- return $url->expanded_url;
- },
- $c->entities->urls
+ $twitterURLs = FALSE;
+ $urls = array_filter(
+ array_map(
+ function($url) {
+ return $url->expanded_url;
+ },
+ $c->entities->urls
+ ),
+ function($url) use(&$twitterURLs) {
+ $urlParts = parse_url($url);
+ if ($urlParts['host'] == 'twitter.com') {
+ $twitterURLs = TRUE;
+ return FALSE;
+ }
+ return TRUE;
+ }
);
if (!$urls) {
- $filteredContent[] = $c;
+ if (!$twitterURLs) {
+ $filteredContent[] = $c;
+ }
} else {
sort($urls);
$urlHash = md5(implode('|', $urls));