aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2012-02-29 14:58:37 +0100
committerFabio Comuni <fabrix.xm@gmail.com>2012-02-29 14:58:37 +0100
commitb71a3af4570ccf349804b9ffa151fc1d35287d88 (patch)
tree264c012a0c8ca28c4035666d35c547a829968a2a /library
parentf5b8654818e63a0583e58caecc8a13c2d83c12d5 (diff)
parentfb33b4f2bcd18e63d311e6dba3aaa2ea5efdec3b (diff)
downloadvolse-hubzilla-b71a3af4570ccf349804b9ffa151fc1d35287d88.tar.gz
volse-hubzilla-b71a3af4570ccf349804b9ffa151fc1d35287d88.tar.bz2
volse-hubzilla-b71a3af4570ccf349804b9ffa151fc1d35287d88.zip
Merge remote-tracking branch 'friendica/master' into randomerror
Diffstat (limited to 'library')
-rw-r--r--library/spam/b8/storage/storage_frndc.php60
-rwxr-xr-xlibrary/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js73
2 files changed, 70 insertions, 63 deletions
diff --git a/library/spam/b8/storage/storage_frndc.php b/library/spam/b8/storage/storage_frndc.php
index 2b9374f67..7702c108b 100644
--- a/library/spam/b8/storage/storage_frndc.php
+++ b/library/spam/b8/storage/storage_frndc.php
@@ -147,58 +147,8 @@ class b8_storage_frndc extends b8_storage_base
public function connect()
{
- return TRUE;
-
- # Are we already connected?
- if($this->connected === TRUE)
- return TRUE;
-
- # Are we using an existing passed resource?
- if($this->config['connection'] === FALSE) {
- # ... yes we are, but the connection is not a resource, so return an error
- $this->connected = FALSE;
- return self::DATABASE_CONNECTION_BAD_RESOURCE;
- }
-
- elseif($this->config['connection'] === NULL) {
-
- # ... no we aren't so we have to connect.
-
- if($this->_connection = mysql_connect($this->config['host'], $this->config['user'], $this->config['pass'])) {
- if(mysql_select_db($this->config['database'], $this->_connection) === FALSE) {
- $this->connected = FALSE;
- return self::DATABASE_SELECT_ERROR . ": " . mysql_error();
- }
- }
- else {
- $this->connected = FALSE;
- return self::DATABASE_CONNECTION_ERROR;
- }
-
- }
-
- else {
- # ... yes we are
- $this->_connection = $this->config['connection'];
- }
-
- # Just in case ...
- if($this->_connection === NULL) {
- $this->connected = FALSE;
- return self::DATABASE_CONNECTION_FAIL;
- }
-
- # Check to see if the wordlist table exists
- if(mysql_query('DESCRIBE ' . $this->config['table_name'], $this->_connection) === FALSE) {
- $this->connected = FALSE;
- return self::DATABASE_TABLE_ACCESS_FAIL . ": " . mysql_error();
- }
-
- # Everything is okay and connected
$this->connected = TRUE;
-
- # Let's see if this is a b8 database and the version is okay
- return $this->check_database();
+ return TRUE;
}
@@ -235,7 +185,7 @@ class b8_storage_frndc extends b8_storage_base
# ... and fetch the data
$result = q('
- SELECT token, count
+ SELECT *
FROM ' . $this->config['table_name'] . '
WHERE ' . $where . ' AND uid = ' . $uid );
@@ -256,7 +206,7 @@ class b8_storage_frndc extends b8_storage_base
$token = dbesc($token);
$count = dbesc($count);
$uid = dbesc($uid);
- array_push($this->_puts, '("' . $token . '", "' . $count . '", '"' . $uid .'")');
+ array_push($this->_puts, '("' . $token . '", "' . $count . '", "' . $uid .'")');
}
/**
@@ -273,7 +223,7 @@ class b8_storage_frndc extends b8_storage_base
$token = dbesc($token);
$count = dbesc($count);
$uid = dbesc($uid);
- array_push($this->_puts, '("' . $token . '", "' . $count . '", '"' . $uid .'")');
+ array_push($this->_puts, '("' . $token . '", "' . $count . '", "' . $uid .'")');
}
/**
@@ -325,7 +275,7 @@ class b8_storage_frndc extends b8_storage_base
if(count($this->_updates) > 0) {
// this still needs work
- $result = q("select * from " . $this->config['table_name'] . ' where token = ';
+ $result = q("select * from " . $this->config['table_name'] . ' where token = ');
$result = q('
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
index e5f716b29..44d1473a9 100755
--- a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
+++ b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
@@ -44,9 +44,35 @@
_dfrn_html2bbcode : function(s) {
s = tinymce.trim(s);
- function rep(re, str) {
- s = s.replace(re, str);
- };
+ function rep(re, str) {
+
+ //modify code to keep stuff intact within [code][/code] blocks
+ //Waitman Gobble NO WARRANTY
+
+
+ var o = new Array();
+ var x = s.split("[code]");
+ var i = 0;
+
+ var si = "";
+ si = x.shift();
+ si = si.replace(re,str);
+ o.push(si);
+
+ for (i = 0; i < x.length; i++) {
+ var no = new Array();
+ var j = x.shift();
+ var g = j.split("[/code]");
+ no.push(g.shift());
+ si = g.shift();
+ si = si.replace(re,str);
+ no.push(si);
+ o.push(no.join("[/code]"));
+ }
+
+ s = o.join("[code]");
+
+ };
@@ -123,11 +149,42 @@
// BBCode -> HTML from DFRN dialect
_dfrn_bbcode2html : function(s) {
s = tinymce.trim(s);
-
- function rep(re, str) {
- s = s.replace(re, str);
- };
-
+
+
+ function rep(re, str) {
+
+ //modify code to keep stuff intact within [code][/code] blocks
+ //Waitman Gobble NO WARRANTY
+
+
+ var o = new Array();
+ var x = s.split("[code]");
+ var i = 0;
+
+ var si = "";
+ si = x.shift();
+ si = si.replace(re,str);
+ o.push(si);
+
+ for (i = 0; i < x.length; i++) {
+ var no = new Array();
+ var j = x.shift();
+ var g = j.split("[/code]");
+ no.push(g.shift());
+ si = g.shift();
+ si = si.replace(re,str);
+ no.push(si);
+ o.push(no.join("[/code]"));
+ }
+
+ s = o.join("[code]");
+
+ };
+
+
+
+
+
// example: [b] to <strong>
rep(/\n/gi,"<br />");
rep(/\[b\]/gi,"<strong>");