Using POST instead of GET.
This commit is contained in:
parent
cc653a8a40
commit
f8337c9d72
|
@ -28,6 +28,6 @@ OCP\User::checkLoggedIn();
|
||||||
OCP\App::checkAppEnabled('bookmarks');
|
OCP\App::checkAppEnabled('bookmarks');
|
||||||
|
|
||||||
require_once('bookmarksHelper.php');
|
require_once('bookmarksHelper.php');
|
||||||
addBookmark($_GET['url'], '', 'Read-Later');
|
addBookmark($_POST['url'], '', 'Read-Later');
|
||||||
|
|
||||||
include 'templates/addBm.php';
|
include 'templates/addBm.php';
|
||||||
|
|
|
@ -31,5 +31,5 @@ OCP\JSON::checkLoggedIn();
|
||||||
OCP\JSON::checkAppEnabled('bookmarks');
|
OCP\JSON::checkAppEnabled('bookmarks');
|
||||||
|
|
||||||
require_once(OC::$APPSROOT . '/apps/bookmarks/bookmarksHelper.php');
|
require_once(OC::$APPSROOT . '/apps/bookmarks/bookmarksHelper.php');
|
||||||
$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']);
|
$id = addBookmark($_POST['url'], $_POST['title'], $_POST['tags']);
|
||||||
OCP\JSON::success(array('data' => $id));
|
OCP\JSON::success(array('data' => $id));
|
|
@ -30,7 +30,7 @@ $RUNTIME_NOSETUPFS=true;
|
||||||
OCP\JSON::checkLoggedIn();
|
OCP\JSON::checkLoggedIn();
|
||||||
OCP\JSON::checkAppEnabled('bookmarks');
|
OCP\JSON::checkAppEnabled('bookmarks');
|
||||||
|
|
||||||
$id = $_GET['id'];
|
$id = $_POST['id'];
|
||||||
if (!OC_Bookmarks_Bookmarks::deleteUrl($id)){
|
if (!OC_Bookmarks_Bookmarks::deleteUrl($id)){
|
||||||
OC_JSON::error();
|
OC_JSON::error();
|
||||||
exit();
|
exit();
|
||||||
|
|
|
@ -39,7 +39,7 @@ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
||||||
$_ut = "UNIX_TIMESTAMP()";
|
$_ut = "UNIX_TIMESTAMP()";
|
||||||
}
|
}
|
||||||
|
|
||||||
$bookmark_id = (int)$_GET["id"];
|
$bookmark_id = (int)$_POST["id"];
|
||||||
|
|
||||||
$query = OCP\DB::prepare("
|
$query = OCP\DB::prepare("
|
||||||
UPDATE *PREFIX*bookmarks
|
UPDATE *PREFIX*bookmarks
|
||||||
|
@ -48,8 +48,8 @@ $query = OCP\DB::prepare("
|
||||||
");
|
");
|
||||||
|
|
||||||
$params=array(
|
$params=array(
|
||||||
htmlspecialchars_decode($_GET["url"]),
|
htmlspecialchars_decode($_POST["url"]),
|
||||||
htmlspecialchars_decode($_GET["title"]),
|
htmlspecialchars_decode($_POST["title"]),
|
||||||
);
|
);
|
||||||
$query->execute($params);
|
$query->execute($params);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ $query = OCP\DB::prepare("
|
||||||
VALUES (?, ?)
|
VALUES (?, ?)
|
||||||
");
|
");
|
||||||
|
|
||||||
$tags = explode(' ', urldecode($_GET["tags"]));
|
$tags = explode(' ', urldecode($_POST["tags"]));
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
if(empty($tag)) {
|
if(empty($tag)) {
|
||||||
//avoid saving blankspaces
|
//avoid saving blankspaces
|
||||||
|
|
|
@ -37,7 +37,7 @@ $query = OCP\DB::prepare("
|
||||||
AND url LIKE ?
|
AND url LIKE ?
|
||||||
");
|
");
|
||||||
|
|
||||||
$params=array(OCP\USER::getUser(), htmlspecialchars_decode($_GET["url"]));
|
$params=array(OCP\USER::getUser(), htmlspecialchars_decode($_POST["url"]));
|
||||||
$bookmarks = $query->execute($params);
|
$bookmarks = $query->execute($params);
|
||||||
|
|
||||||
header( "HTTP/1.1 204 No Content" );
|
header( "HTTP/1.1 204 No Content" );
|
||||||
|
|
|
@ -33,11 +33,11 @@ OCP\JSON::checkAppEnabled('bookmarks');
|
||||||
|
|
||||||
|
|
||||||
//Filter for tag?
|
//Filter for tag?
|
||||||
$filterTag = isset($_GET['tag']) ? htmlspecialchars_decode($_GET['tag']) : false;
|
$filterTag = isset($_POST['tag']) ? htmlspecialchars_decode($_POST['tag']) : false;
|
||||||
|
|
||||||
$offset = isset($_GET['page']) ? intval($_GET['page']) * 10 : 0;
|
$offset = isset($_POST['page']) ? intval($_POST['page']) * 10 : 0;
|
||||||
|
|
||||||
$sort = isset($_GET['sort']) ? ($_GET['sort']) : 'bookmarks_sorting_recent';
|
$sort = isset($_POST['sort']) ? ($_POST['sort']) : 'bookmarks_sorting_recent';
|
||||||
if($sort == 'bookmarks_sorting_clicks') {
|
if($sort == 'bookmarks_sorting_clicks') {
|
||||||
$sqlSortColumn = 'clickcount';
|
$sqlSortColumn = 'clickcount';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,6 +6,7 @@ function addBookmark(event) {
|
||||||
var url = $('#bookmark_add_url').val();
|
var url = $('#bookmark_add_url').val();
|
||||||
var tags = $('#bookmark_add_tags').val();
|
var tags = $('#bookmark_add_tags').val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
url: 'ajax/addBookmark.php',
|
url: 'ajax/addBookmark.php',
|
||||||
data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags),
|
data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags),
|
||||||
success: function(data){
|
success: function(data){
|
||||||
|
|
|
@ -20,6 +20,7 @@ function getBookmarks() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
url: OC.filePath('bookmarks', 'ajax', 'updateList.php'),
|
url: OC.filePath('bookmarks', 'ajax', 'updateList.php'),
|
||||||
data: 'tag=' + encodeURIComponent($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
|
data: 'tag=' + encodeURIComponent($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
|
||||||
success: function(bookmarks){
|
success: function(bookmarks){
|
||||||
|
@ -70,6 +71,7 @@ function addOrEditBookmark(event) {
|
||||||
}
|
}
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
url: OC.filePath('bookmarks', 'ajax', 'addBookmark.php'),
|
url: OC.filePath('bookmarks', 'ajax', 'addBookmark.php'),
|
||||||
data: 'url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
|
data: 'url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
|
||||||
success: function(response){
|
success: function(response){
|
||||||
|
@ -82,6 +84,7 @@ function addOrEditBookmark(event) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
url: OC.filePath('bookmarks', 'ajax', 'editBookmark.php'),
|
url: OC.filePath('bookmarks', 'ajax', 'editBookmark.php'),
|
||||||
data: 'id=' + id + '&url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
|
data: 'id=' + id + '&url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
|
||||||
success: function(){
|
success: function(){
|
||||||
|
@ -99,6 +102,7 @@ function addOrEditBookmark(event) {
|
||||||
function delBookmark(event) {
|
function delBookmark(event) {
|
||||||
var record = $(this).parent().parent();
|
var record = $(this).parent().parent();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
url: OC.filePath('bookmarks', 'ajax', 'delBookmark.php'),
|
url: OC.filePath('bookmarks', 'ajax', 'delBookmark.php'),
|
||||||
data: 'id=' + record.data('id'),
|
data: 'id=' + record.data('id'),
|
||||||
success: function(data){
|
success: function(data){
|
||||||
|
@ -177,6 +181,7 @@ function updateOnBottom() {
|
||||||
|
|
||||||
function recordClick(event) {
|
function recordClick(event) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
url: OC.filePath('bookmarks', 'ajax', 'recordClick.php'),
|
url: OC.filePath('bookmarks', 'ajax', 'recordClick.php'),
|
||||||
data: 'url=' + encodeURIComponent($(this).attr('href')),
|
data: 'url=' + encodeURIComponent($(this).attr('href')),
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,6 +16,7 @@ function recordClick(event) {
|
||||||
var jsFileLocation = $('script[src*=bookmarksearch]').attr('src');
|
var jsFileLocation = $('script[src*=bookmarksearch]').attr('src');
|
||||||
jsFileLocation = jsFileLocation.replace('js/bookmarksearch.js', '');
|
jsFileLocation = jsFileLocation.replace('js/bookmarksearch.js', '');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
url: jsFileLocation + 'ajax/recordClick.php',
|
url: jsFileLocation + 'ajax/recordClick.php',
|
||||||
data: 'url=' + encodeURI($(this).attr('href')),
|
data: 'url=' + encodeURI($(this).attr('href')),
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue