Browse Source

starting on comment moderation

master
unknown 1 year ago
parent
commit
59141ae39c
2 changed files with 23 additions and 1 deletions
  1. +22
    -0
      src/routes/augmented.rb
  2. +1
    -1
      src/views/aug_article.erb

+ 22
- 0
src/routes/augmented.rb View File

@ -112,6 +112,28 @@ module Sinatra
end
end
app.get '/delete/:id' do |id|
if session[:author].nil? then
return [403, "Not permitted."]
else
con = make_con()
query(con, "DELETE FROM posts WHERE post_id = ?", id)
return "Success."
end
end
app.get '/ip_delete/:id/:ip' do |id, ip|
if session[:author].nil? then
return [403, "Not permitted."]
else
con = make_con()
query(con, "DELETE FROM posts WHERE parent = ? AND ip = ?", id, ip)
return "Success."
end
end
app.get '/feed' do
erb :aug_feed, :locals => {:con => make_con(), :config => Config.get}
end


+ 1
- 1
src/views/aug_article.erb View File

@ -42,7 +42,7 @@
<% additional = "" %>
<% additional = "color: #5E0E36;" if res["is_signed_author"] != 0 %>
<% res["author"] = "Anonymous" if res["author"] == "" %>
<div id="author" class="label">Author: <span style="<%= additional %>"><%= Sanitize.clean(res["author"]) %></span>, Date: <%= res["date_posted"] %></div>
<div id="author" class="label">Author: <span style="<%= additional %>"><%= Sanitize.clean(res["author"]) %></span>, Date: <%= res["date_posted"] %> <% if session[:author] %><a class="label" href="/delete/<%= res["post_id"] %>">delete</a> <a class="label" href="/ip_delete/<%= con.escape(id) %>/<%= res["ip"] %>">delete by ip</a><% end %></div>
<pre id="content" class="label">| <%= Sanitize.clean(res["content"]) %></pre>
<% end %>
</div>


Loading…
Cancel
Save