Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
5d310ebf
Commit
5d310ebf
authored
13 years ago
by
Golnaz Nilieh
Browse files
Options
Downloads
Patches
Plain Diff
* Use encodeEntities() function to check input
* Separate tags by space
parent
bb127a36
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/bookmarks/js/bookmarks.js
+32
-27
32 additions, 27 deletions
apps/bookmarks/js/bookmarks.js
apps/bookmarks/templates/list.php
+1
-0
1 addition, 0 deletions
apps/bookmarks/templates/list.php
with
33 additions
and
27 deletions
apps/bookmarks/js/bookmarks.js
+
32
−
27
View file @
5d310ebf
...
...
@@ -20,7 +20,7 @@ function getBookmarks() {
}
$
.
ajax
({
url
:
'
ajax/updateList.php
'
,
data
:
"
tag=
"
+
encodeURI
(
$
(
'
#bookmarkFilterTag
'
).
val
())
+
"
&page=
"
+
bookmarks_page
,
data
:
'
tag=
'
+
encodeURI
(
$
(
'
#bookmarkFilterTag
'
).
val
())
+
'
&page=
'
+
bookmarks_page
,
success
:
function
(
bookmarks
){
bookmarks_page
+=
1
;
$
(
'
.bookmark_link
'
).
unbind
(
'
click
'
,
recordClick
);
...
...
@@ -37,24 +37,29 @@ function getBookmarks() {
}
function
addBookmark
(
event
)
{
var
url
=
$
(
'
#bookmark_add_url
'
).
val
()
var
title
=
$
(
'
#bookmark_add_title
'
).
val
()
var
description
=
$
(
'
#bookmark_add_description
'
).
val
()
var
tags
=
$
(
'
#bookmark_add_tags
'
).
val
()
var
url
=
encodeEntities
(
$
(
'
#bookmark_add_url
'
).
val
())
var
title
=
encodeEntities
(
$
(
'
#bookmark_add_title
'
).
val
())
var
description
=
encodeEntities
(
$
(
'
#bookmark_add_description
'
).
val
())
var
tags
=
encodeEntities
(
$
(
'
#bookmark_add_tags
'
).
val
())
var
taglist
=
tags
.
split
(
'
'
)
var
tagshtml
=
''
;
for
(
var
i
=
0
,
len
=
taglist
.
length
;
i
<
len
;
++
i
){
tagshtml
+=
'
<a class="bookmark_tags" href="?tag=
'
+
encodeURI
(
taglist
[
i
])
+
'
">
'
+
taglist
[
i
]
+
'
</a>
'
;
}
$
.
ajax
({
url
:
'
ajax/addBookmark.php
'
,
data
:
"
url=
"
+
encodeURI
(
url
)
+
"
&title=
"
+
encodeURI
(
title
)
+
"
&description=
"
+
encodeURI
(
description
)
+
"
&tags=
"
+
encodeURI
(
tags
),
data
:
'
url=
'
+
encodeURI
(
url
)
+
'
&title=
'
+
encodeURI
(
title
)
+
'
&description=
'
+
encodeURI
(
description
)
+
'
&tags=
'
+
encodeURI
(
tags
),
success
:
function
(
data
){
$
(
'
.bookmarks_add
'
).
slideToggle
();
$
(
'
.bookmarks_add
'
).
children
(
'
p
'
).
children
(
'
.bookmarks_input
'
).
val
(
''
);
$
(
'
.bookmarks_list
'
).
prepend
(
"
<div class=
\
"
bookmark_single
\
"
>
"
+
"
<p class=
\
"
bookmark_title
\
"
><a href=
\"
"
+
url
+
"
\
"
target=
\
"
_new
\
"
class=
\
"
bookmark_link
\
"
>
"
+
title
+
"
</a></p>
"
+
"
<p class=
\
"
bookmark_url
\
"
>
"
+
url
+
"
</p>
"
+
"
<p class=
\
"
bookmark_description
\
"
>
"
+
description
+
"
</p>
"
+
"
<p>
"
+
tags
+
"
</p>
"
+
"
<p class=
\
"
bookmark_actions
\
"
><span class=
\
"
bookmark_delete
\
"
>Delete</span></p>
"
+
"
</div>
"
'
<div class="bookmark_single">
'
+
'
<p class="bookmark_title"><a href="
'
+
url
+
'
" target="_new" class="bookmark_link">
'
+
title
+
'
</a></p>
'
+
'
<p class="bookmark_url">
'
+
url
+
'
</p>
'
+
'
<p class="bookmark_description">
'
+
description
+
'
</p>
'
+
'
<p>
'
+
tags
html
+
'
</p>
'
+
'
<p class="bookmark_actions"><span class="bookmark_delete">Delete</span></p>
'
+
'
</div>
'
);
}
});
...
...
@@ -64,25 +69,25 @@ function delBookmark(event) {
var
record
=
$
(
this
).
parent
().
parent
()
$
.
ajax
({
url
:
'
ajax/delBookmark.php
'
,
data
:
"
url=
"
+
encodeURI
(
$
(
this
).
parent
().
parent
().
children
(
'
.bookmark_url:first
'
).
text
()),
success
:
function
(
data
){
record
.
animate
({
opacity
:
"
hide
"
},
"
fast
"
);
}
data
:
'
url=
'
+
encodeURI
(
$
(
this
).
parent
().
parent
().
children
(
'
.bookmark_url:first
'
).
text
()),
success
:
function
(
data
){
record
.
animate
({
opacity
:
'
hide
'
},
'
fast
'
);
}
});
}
function
updateBookmarksList
(
bookmark
)
{
var
tags
=
encodeEntities
(
bookmark
.
tags
).
split
(
"
"
);
var
taglist
=
""
;
var
tags
=
encodeEntities
(
bookmark
.
tags
).
split
(
'
'
);
var
taglist
=
''
;
for
(
var
i
=
0
,
len
=
tags
.
length
;
i
<
len
;
++
i
){
taglist
=
taglist
+
"
<a class=
\
"
bookmark_tags
\
"
href=
\
"
?tag=
"
+
encodeURI
(
tags
[
i
])
+
"
\
"
>
"
+
tags
[
i
]
+
"
</a>
"
;
taglist
=
taglist
+
'
<a class="bookmark_tags" href="?tag=
'
+
encodeURI
(
tags
[
i
])
+
'
">
'
+
tags
[
i
]
+
'
</a>
'
;
}
$
(
'
.bookmarks_list
'
).
append
(
"
<div class=
\
"
bookmark_single
\
"
>
"
+
"
<p class=
\
"
bookmark_title
\
"
><a href=
\"
"
+
encodeEntities
(
bookmark
.
url
)
+
"
\
"
target=
\
"
_new
\
"
class=
\
"
bookmark_link
\
"
>
"
+
encodeEntities
(
bookmark
.
title
)
+
"
</a></p>
"
+
"
<p class=
\
"
bookmark_url
\
"
>
"
+
encodeEntities
(
bookmark
.
url
)
+
"
</p>
"
+
"
<p class=
\
"
bookmark_description
\
"
>
"
+
encodeEntities
(
bookmark
.
description
)
+
"
</p>
"
+
"
<p>
"
+
taglist
+
"
</p>
"
+
"
<p class=
\
"
bookmark_actions
\
"
><span class=
\
"
bookmark_delete
\
"
>Delete</span></p>
"
+
"
</div>
"
'
<div class="bookmark_single">
'
+
'
<p class="bookmark_title"><a href="
'
+
encodeEntities
(
bookmark
.
url
)
+
'
" target="_new" class="bookmark_link">
'
+
encodeEntities
(
bookmark
.
title
)
+
'
</a></p>
'
+
'
<p class="bookmark_url">
'
+
encodeEntities
(
bookmark
.
url
)
+
'
</p>
'
+
'
<p class="bookmark_description">
'
+
encodeEntities
(
bookmark
.
description
)
+
'
</p>
'
+
'
<p>
'
+
taglist
+
'
</p>
'
+
'
<p class="bookmark_actions"><span class="bookmark_delete">Delete</span></p>
'
+
'
</div>
'
);
}
...
...
@@ -96,13 +101,13 @@ function updateOnBottom() {
function
recordClick
(
event
)
{
$
.
ajax
({
url
:
'
ajax/recordClick.php
'
,
data
:
"
url=
"
+
encodeURI
(
$
(
this
).
attr
(
'
href
'
)),
data
:
'
url=
'
+
encodeURI
(
$
(
this
).
attr
(
'
href
'
)),
});
}
function
encodeEntities
(
s
){
try
{
return
$
(
"
<div/>
"
).
text
(
s
).
html
();
return
$
(
'
<div/>
'
).
text
(
s
).
html
();
}
catch
(
ex
)
{
return
""
;
...
...
This diff is collapsed.
Click to expand it.
apps/bookmarks/templates/list.php
+
1
−
0
View file @
5d310ebf
...
...
@@ -8,6 +8,7 @@
<p><label
class=
"bookmarks_label"
>
Title
</label><input
type=
"text"
id=
"bookmark_add_title"
class=
"bookmarks_input"
/></p>
<p><label
class=
"bookmarks_label"
>
Description
</label><input
type=
"text"
id=
"bookmark_add_description"
class=
"bookmarks_input"
/></p>
<p><label
class=
"bookmarks_label"
>
Tags
</label><input
type=
"text"
id=
"bookmark_add_tags"
class=
"bookmarks_input"
/></p>
<p><label
class=
"bookmarks_label"
>
</label><label
class=
"bookmarks_hint"
>
Hint: Use space to separate tags.
</label></p>
<p><label
class=
"bookmarks_label"
></label><input
type=
"submit"
id=
"bookmark_add_submit"
/></p>
</div>
<div
class=
"bookmarks_list"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment