1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2024-12-02 06:24:11 +01:00

Bookmarks: handle input with & and ?, fixes oc-201

This commit is contained in:
Arthur Schiwon 2012-04-15 15:53:30 +02:00
parent 7bfad1f3b8
commit 349597c8b7

View File

@ -21,7 +21,7 @@ function getBookmarks() {
$.ajax({
url: 'ajax/updateList.php',
data: 'tag=' + encodeURI($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
data: 'tag=' + encodeURIComponent($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
success: function(bookmarks){
if (bookmarks.data.length) {
bookmarks_page += 1;
@ -64,7 +64,7 @@ function addOrEditBookmark(event) {
if (id == 0) {
$.ajax({
url: 'ajax/addBookmark.php',
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
data: 'url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
success: function(response){
$('.bookmarks_input').val('');
$('.bookmarks_list').empty();
@ -76,7 +76,7 @@ function addOrEditBookmark(event) {
else {
$.ajax({
url: 'ajax/editBookmark.php',
data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
data: 'id=' + id + '&url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
success: function(){
$('.bookmarks_input').val('');
$('#bookmark_add_id').val('0');
@ -93,7 +93,7 @@ function delBookmark(event) {
var record = $(this).parent().parent();
$.ajax({
url: 'ajax/delBookmark.php',
data: 'url=' + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()),
data: 'url=' + encodeURIComponent($(this).parent().parent().children('.bookmark_url:first').text()),
success: function(data){
record.remove();
if($('.bookmarks_list').is(':empty')) {
@ -124,7 +124,7 @@ function updateBookmarksList(bookmark) {
var taglist = '';
for ( var i=0, len=tags.length; i<len; ++i ){
if(tags[i] != '')
taglist = taglist + '<a class="bookmark_tag" href="?tag=' + encodeURI(tags[i]) + '">' + tags[i] + '</a> ';
taglist = taglist + '<a class="bookmark_tag" href="?tag=' + encodeURIComponent(tags[i]) + '">' + tags[i] + '</a> ';
}
if(!hasProtocol(bookmark.url)) {
bookmark.url = 'http://' + bookmark.url;
@ -165,7 +165,7 @@ function updateOnBottom() {
function recordClick(event) {
$.ajax({
url: 'ajax/recordClick.php',
data: 'url=' + encodeURI($(this).attr('href')),
data: 'url=' + encodeURIComponent($(this).attr('href')),
});
}