Skip to content
Browse files

Allow non-user to tag posts

When setting "allow_tagging_everything" is enabled, everyone can tag
posts without special permissions
  • Loading branch information...
1 parent 18b841f commit bff0113b48b3dd60379e176a4edc83c34ab9ad38 @theclimber committed
Showing with 32 additions and 3 deletions.
  1. +27 −1 javascript/main.js
  2. +1 −1 user/api/index.php
  3. +4 −1 user/api/tagging_api.php
View
28 javascript/main.js
@@ -5,6 +5,7 @@ this.popular = getUrlParameter('popular');
this.tags = new Array();
this.users = new Array();
this.period = '';
+this.post_status = 1;
this.trigger = function() {};
$(document).ready(function() {
this.page = getUrlParameter('num_page');
@@ -17,6 +18,7 @@ $(document).ready(function() {
this.tags = new Array();
this.users = new Array();
this.period = '';
+ this.post_status = 1;
var urlVars = getUrlVars();
if (urlVars['tags']) {
@@ -37,6 +39,13 @@ $(document).ready(function() {
add_user(v, true);
});
}
+ if (urlVars['uncensored']) {
+ var varF = urlVars['uncensored'];
+ varF = varF.split('#')[0];
+ if (varF != '') {
+ this.post_status = 2;
+ }
+ }
/*
if (urlVars['filter']) {
var varF = urlVars['filter'];
@@ -143,7 +152,8 @@ function updatePostList() {
'popular' : this.popular,
'tags' : arrayToString(this.tags),
'users' : arrayToString(this.users),
- 'period' : this.period
+ 'period' : this.period,
+ 'post_status' : this.post_status
},
success: function(msg){
$('div#'+main_div).html(msg);
@@ -373,6 +383,22 @@ function tag_post(post_id, post_title) {
title: "Add tags to this post",
});
}
+function rm_tag_post(post_id, tag) {
+ var content = $('#tag-post-form form').clone();
+ Boxy.confirm('Are you sure you want to remove <b>'+tag+'</b> from this post?', function(val) {
+// Boxy.askform(content, function(val) {
+ $.ajax({
+ type: "POST",
+ url: "user/api/",
+ data : {'ajax' : 'tagging', 'action' : 'rm_tag', 'post_id' : post_id, 'tag' : tag},
+ success: function(msg){
+ updatePostList();
+ }
+ });
+ }, {
+ title: "Remove tag to this post",
+ });
+}
function toggle_post_comments(post_id, comment_status) {
$.ajax({
View
2 user/api/index.php
@@ -56,7 +56,7 @@
require_once(dirname(__FILE__).'/feed_api.php');
break;
case 'tagging':
- if (!$core->hasRole('user')){
+ if (!$blog_settings->get('allow_tagging_everything') && !$core->hasRole('user')){
print 'Permission denied';
exit;
}
View
5 user/api/tagging_api.php
@@ -71,7 +71,10 @@
##########################################################
case 'add_tags':
$post_id = $_POST['post_id'];
- $user_id = $core->auth->userID();
+ $user_id = '';
+ if ($core->auth->sessionExists()){
+ $user_id = $core->auth->userID();
+ }
if (!$blog_settings->get('allow_post_modification')) {
print 'forbidden';
exit;

0 comments on commit bff0113

Please sign in to comment.
Something went wrong with that request. Please try again.