aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-02-02 21:25:52 -0800
committerfriendica <info@friendica.com>2014-02-02 21:25:52 -0800
commitee42079685dd4df721b1090bdaa0d86316e3358a (patch)
treec17bcc246b68dd4a53b7883f81f596f82cc1e3fc
parentc7cad26b4187736065d02876c3a260309a5c6691 (diff)
downloadvolse-hubzilla-ee42079685dd4df721b1090bdaa0d86316e3358a.tar.gz
volse-hubzilla-ee42079685dd4df721b1090bdaa0d86316e3358a.tar.bz2
volse-hubzilla-ee42079685dd4df721b1090bdaa0d86316e3358a.zip
The problem with a lot of packages is that it's easier to re-write them than to re-use them.
-rw-r--r--include/spam.php35
-rw-r--r--library/spam/b8/storage/storage_frndc.php8
2 files changed, 39 insertions, 4 deletions
diff --git a/include/spam.php b/include/spam.php
new file mode 100644
index 000000000..8b158b7ae
--- /dev/null
+++ b/include/spam.php
@@ -0,0 +1,35 @@
+<?php /** @file */
+
+
+function string_splitter($s) {
+
+ if(! $s)
+ return array();
+
+ $s = preg_replace('/\pP+/','',$s);
+
+ $x = mb_split("\[|\]|\s",$s);
+
+ $ret = array();
+ if($x) {
+ foreach($x as $y) {
+ if(mb_strlen($y) > 2)
+ $ret[] = substr($y,0,64);
+ }
+ }
+ return $ret;
+}
+
+
+
+function get_words($uid,$list) {
+
+ stringify($list,true);
+
+ $r = q("select * from spam where term in ( " . $list . ") and uid = %d",
+ intval($uid)
+ );
+
+ return $r;
+}
+
diff --git a/library/spam/b8/storage/storage_frndc.php b/library/spam/b8/storage/storage_frndc.php
index 62909d471..f211d4431 100644
--- a/library/spam/b8/storage/storage_frndc.php
+++ b/library/spam/b8/storage/storage_frndc.php
@@ -205,7 +205,7 @@ class b8_storage_frndc extends b8_storage_base
foreach($to_create as $term) {
if(strlen($sql))
$sql .= ',';
- $sql .= sprintf("(term,datetime,uid) values('%s','%s',%d)",
+ $sql .= sprintf("(term,date,uid) values('%s','%s',%d)",
dbesc(str_tolower($term))
dbesc(datetime_convert()),
intval($uid)
@@ -280,16 +280,16 @@ class b8_storage_frndc extends b8_storage_base
$result = q('
DELETE FROM ' . $this->config['table_name'] . '
- WHERE token IN ("' . implode('", "', $this->_deletes) . '") AND uid = ' . $this->uid);
+ WHERE term IN ("' . implode('", "', $this->_deletes) . '") AND uid = ' . $this->uid);
$this->_deletes = array();
}
if(count($this->_puts) > 0) {
-
+//fixme
$result = q('
- INSERT INTO ' . $this->config['table_name'] . '(token, count, uid)
+ INSERT INTO ' . $this->config['table_name'] . '(term, count, uid)
VALUES ' . implode(', ', $this->_puts));
$this->_puts = array();