Browse Source

Fixed tags not getting edited correctly

pull/24/head
Teknikode 5 years ago
parent
commit
78508ca145
4 changed files with 32 additions and 21 deletions
  1. 3
    3
      ricehalla/edit_tags.php
  2. 14
    4
      ricehalla/main.php
  3. 14
    4
      ricehalla/view_image.php
  4. 1
    10
      templates/default/js/common.js

+ 3
- 3
ricehalla/edit_tags.php View File

@@ -2,10 +2,10 @@
include('../includes/config.php');
$filename = "";
if(isset($_GET) && $logged_in)
if(isset($_POST) && $logged_in)
{
$id = rawurldecode($_GET['id']);
$tags = rawurldecode($_GET['tags']);
$id = rawurldecode($_POST['id']);
$tags = rawurldecode($_POST['tags']);
$user_id = $user->id;
$desktop = $db->select('ricehalla', 'id=? AND user_id=?', array($id, $user_id));
if ($desktop)

+ 14
- 4
ricehalla/main.php View File

@@ -134,13 +134,23 @@
tagClass: "btn-primary",
afterAddingTag: function(tag){
var current_tags = $('#taglist-<?php echo $result['id']; ?>').tags().getTags();
var url = "../edit_tags.php?id=<?php echo $result['id']; ?>&tags="+current_tags;
postServerData(url);
var url = "../edit_tags.php";
var data = "id="+encodeURIComponent(<?php echo $result['id']; ?>)+"&tags="+encodeURIComponent(current_tags);
$.ajax({
type: "POST",
url: url,
data: data
});
},
afterDeletingTag: function(tag){
var current_tags = $('#taglist-<?php echo $result['id']; ?>').tags().getTags();
var url = "../edit_tags.php?id=<?php echo $result['id']; ?>&tags="+current_tags;
postServerData(url);
var url = "../edit_tags.php";
var data = "id="+encodeURIComponent(<?php echo $result['id']; ?>)+"&tags="+encodeURIComponent(current_tags);
$.ajax({
type: "POST",
url: url,
data: data
});
}
});
});

+ 14
- 4
ricehalla/view_image.php View File

@@ -114,13 +114,23 @@ if (isset($_GET['id']))
tagClass: "btn-primary",
afterAddingTag: function(tag){
var current_tags = $('#taglist-<?php echo $result['id']; ?>').tags().getTags();
var url = "../edit_tags.php?id=<?php echo $result['id']; ?>&tags="+current_tags;
var response = Get_Server_Response(url);
var url = "../edit_tags.php";
var data = "id="+encodeURIComponent(<?php echo $result['id']; ?>)+"&tags="+encodeURIComponent(current_tags);
$.ajax({
type: "POST",
url: url,
data: data
});
},
afterDeletingTag: function(tag){
var current_tags = $('#taglist-<?php echo $result['id']; ?>').tags().getTags();
var url = "../edit_tags.php?id=<?php echo $result['id']; ?>&tags="+current_tags;
var response = Get_Server_Response(url);
var url = "../edit_tags.php";
var data = "id="+encodeURIComponent(<?php echo $result['id']; ?>)+"&tags="+encodeURIComponent(current_tags);
$.ajax({
type: "POST",
url: url,
data: data
});
}
});
});

+ 1
- 10
templates/default/js/common.js View File

@@ -95,16 +95,7 @@ $(function() {
// Fix input element click problem
$('.dropdown input, .dropdown label').click(function(e) {
e.stopPropagation();
});

function postServerData(url, data)
{
$.ajax({
type: "POST",
url: url,
data: data
});
}
});
});

function removeAmp(code)

Loading…
Cancel
Save