aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-04-10 03:36:12 -0700
committerFriendika <info@friendika.com>2011-04-10 03:36:12 -0700
commit58508201a5fe1f4c3bd6bb93e626c46739afda46 (patch)
tree5b6dbdd21e29cb13b42e73eb624beed1124882cb
parentbf865f0210aee4c6742b10bb63cd05f0de9b9d12 (diff)
downloadvolse-hubzilla-58508201a5fe1f4c3bd6bb93e626c46739afda46.tar.gz
volse-hubzilla-58508201a5fe1f4c3bd6bb93e626c46739afda46.tar.bz2
volse-hubzilla-58508201a5fe1f4c3bd6bb93e626c46739afda46.zip
bug #37, ampersand + everything following in url is stripped when using link icon to share link
-rw-r--r--include/main.js23
-rw-r--r--mod/parse_url.php6
-rw-r--r--mod/share.php2
-rw-r--r--view/jot-header.tpl1
4 files changed, 30 insertions, 2 deletions
diff --git a/include/main.js b/include/main.js
index 18e884b31..8779f8413 100644
--- a/include/main.js
+++ b/include/main.js
@@ -255,3 +255,26 @@
return false;
}
+
+ function bin2hex(s){
+ // Converts the binary representation of data to hex
+ //
+ // version: 812.316
+ // discuss at: http://phpjs.org/functions/bin2hex
+ // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ // + bugfixed by: Onno Marsman
+ // + bugfixed by: Linuxworld
+ // * example 1: bin2hex('Kev');
+ // * returns 1: '4b6576'
+ // * example 2: bin2hex(String.fromCharCode(0x00));
+ // * returns 2: '00'
+ var v,i, f = 0, a = [];
+ s += '';
+ f = s.length;
+
+ for (i = 0; i<f; i++) {
+ a[i] = s.charCodeAt(i).toString(16).replace(/^([\da-f])$/,"0$1");
+ }
+
+ return a.join('');
+ } \ No newline at end of file
diff --git a/mod/parse_url.php b/mod/parse_url.php
index b3b42b6cb..a65215ca1 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -5,7 +5,11 @@ require_once('library/HTML5/Parser.php');
function parse_url_content(&$a) {
- $url = trim($_GET['url']);
+ logger('parse_url: ' . $_GET['url']);
+
+ $url = trim(hex2bin($_GET['url']));
+
+ logger('parse_url: ' . $url);
$text = null;
diff --git a/mod/share.php b/mod/share.php
index 94cd035b4..f355a842a 100644
--- a/mod/share.php
+++ b/mod/share.php
@@ -20,4 +20,4 @@ function share_init(&$a) {
$o .= bbcode($r[0]['body'], true);
echo $o . '<br />';
killme();
-} \ No newline at end of file
+}
diff --git a/view/jot-header.tpl b/view/jot-header.tpl
index eebaf803a..94f0f58f8 100644
--- a/view/jot-header.tpl
+++ b/view/jot-header.tpl
@@ -89,6 +89,7 @@ tinyMCE.init({
function jotGetLink() {
reply = prompt("$linkurl");
if(reply && reply.length) {
+ reply = bin2hex(reply);
$('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data);