diff options
Diffstat (limited to 'library')
-rwxr-xr-x | library/phpsec/Net/SSH1.php | 4 | ||||
-rw-r--r-- | library/spam/b8/storage/storage_frndc.php | 34 |
2 files changed, 31 insertions, 7 deletions
diff --git a/library/phpsec/Net/SSH1.php b/library/phpsec/Net/SSH1.php index 6986a8450..7220ee402 100755 --- a/library/phpsec/Net/SSH1.php +++ b/library/phpsec/Net/SSH1.php @@ -730,8 +730,8 @@ class Net_SSH1 { /**
* Reads the output of an interactive shell.
*
- * Requires PHP 4.3.0 or later due to the use of the stream_select() function. If you see stuff like
- * "[00m", you're seeing ANSI escape codes. According to
+ * Requires PHP 4.3.0 or later due to the use of the stream_select() function. If you see crap,
+ * you're seeing ANSI escape codes. According to
* {@link http://support.microsoft.com/kb/101875 How to Enable ANSI.SYS in a Command Window}, "Windows NT
* does not support ANSI escape sequences in Win32 Console applications", so if you're a Windows user,
* there's not going to be much recourse.
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; |