bug #37, ampersand + everything following in url is stripped when using link icon to share link

This commit is contained in:
Friendika 2011-04-10 03:36:12 -07:00
parent bf865f0210
commit 58508201a5
4 changed files with 30 additions and 2 deletions

View file

@ -255,3 +255,26 @@
return false; 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('');
}

View file

@ -5,7 +5,11 @@ require_once('library/HTML5/Parser.php');
function parse_url_content(&$a) { 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; $text = null;

View file

@ -89,6 +89,7 @@ tinyMCE.init({
function jotGetLink() { function jotGetLink() {
reply = prompt("$linkurl"); reply = prompt("$linkurl");
if(reply && reply.length) { if(reply && reply.length) {
reply = bin2hex(reply);
$('#profile-rotator').show(); $('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) { $.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data); tinyMCE.execCommand('mceInsertRawHTML',false,data);