diff options
-rwxr-xr-x | include/items.php | 25 | ||||
-rwxr-xr-x | include/text.php | 4 | ||||
-rw-r--r-- | library/spam/b8/storage/storage_frndc.php | 34 |
3 files changed, 56 insertions, 7 deletions
diff --git a/include/items.php b/include/items.php index 3c55fbb4f..fdff6b642 100755 --- a/include/items.php +++ b/include/items.php @@ -1595,6 +1595,14 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) if((activity_match($datarray['verb'],ACTIVITY_LIKE)) || (activity_match($datarray['verb'],ACTIVITY_DISLIKE))) { $datarray['type'] = 'activity'; $datarray['gravity'] = GRAVITY_LIKE; + // only one like or dislike per person + $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1", + intval($datarray['uid']), + intval($datarray['contact-id']), + dbesc($datarray['verb']) + ); + if($r && count($r)) + continue; } if(($datarray['verb'] === ACTIVITY_TAG) && ($datarray['object-type'] === ACTIVITY_OBJ_TAGTERM)) { @@ -2148,6 +2156,14 @@ function local_delivery($importer,$data) { $datarray['type'] = 'activity'; $datarray['gravity'] = GRAVITY_LIKE; $datarray['last-child'] = 0; + // only one like or dislike per person + $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1", + intval($datarray['uid']), + intval($datarray['contact-id']), + dbesc($datarray['verb']) + ); + if($r && count($r)) + continue; } if(($datarray['verb'] === ACTIVITY_TAG) && ($datarray['object-type'] === ACTIVITY_OBJ_TAGTERM)) { @@ -2297,6 +2313,15 @@ function local_delivery($importer,$data) { if(($datarray['verb'] == ACTIVITY_LIKE) || ($datarray['verb'] == ACTIVITY_DISLIKE)) { $datarray['type'] = 'activity'; $datarray['gravity'] = GRAVITY_LIKE; + // only one like or dislike per person + $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1", + intval($datarray['uid']), + intval($datarray['contact-id']), + dbesc($datarray['verb']) + ); + if($r && count($r)) + continue; + } if(($datarray['verb'] === ACTIVITY_TAG) && ($datarray['object-type'] === ACTIVITY_OBJ_TAGTERM)) { diff --git a/include/text.php b/include/text.php index 042ee982c..c8c03174e 100755 --- a/include/text.php +++ b/include/text.php @@ -737,7 +737,7 @@ function smilies($s, $sample = false) { ':headdesk', '~friendika', '~friendica', - 'Diaspora*' +// 'Diaspora*' ); $icons = array( @@ -778,7 +778,7 @@ function smilies($s, $sample = false) { '<img src="' . $a->get_baseurl() . '/images/smiley-bangheaddesk.gif" alt=":headdesk" />', '<a href="http://project.friendika.com">~friendika <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>', '<a href="http://friendica.com">~friendica <img src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>', - '<a href="http://diasporafoundation.org">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>', +// '<a href="http://diasporafoundation.org">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>', ); diff --git a/library/spam/b8/storage/storage_frndc.php b/library/spam/b8/storage/storage_frndc.php index 7702c108b..62909d471 100644 --- a/library/spam/b8/storage/storage_frndc.php +++ b/library/spam/b8/storage/storage_frndc.php @@ -174,20 +174,44 @@ class b8_storage_frndc extends b8_storage_base array_push($where, $token); } - $where = 'token IN ("' . implode('", "', $where) . '")'; + $where = 'term IN ("' . implode('", "', $where) . '")'; } else { $token = dbesc($token); - $where = 'token = "' . $token . '"'; + $where = 'term = "' . $token . '"'; } # ... and fetch the data $result = q(' - SELECT * - FROM ' . $this->config['table_name'] . ' - WHERE ' . $where . ' AND uid = ' . $uid ); + SELECT * FROM spam WHERE ' . $where . ' AND uid = ' . $uid ); + + + $returned_tokens = array(); + if(count($result)) { + foreach($result as $rr) + $returned_tokens[] = $rr['term']; + } + $to_create = array(); + + if(count($tokens) > 0) { + foreach($tokens as $token) + if(! in_array($token,$returned_tokens)) + $to_create[] = str_tolower($token); + } + if(count($to_create)) { + $sql = ''; + foreach($to_create as $term) { + if(strlen($sql)) + $sql .= ','; + $sql .= sprintf("(term,datetime,uid) values('%s','%s',%d)", + dbesc(str_tolower($term)) + dbesc(datetime_convert()), + intval($uid) + ); + q("insert into spam " . $sql); + } return $result; |