Mercurial Hosting > freedit
comparison src/new_thread.html.luan @ 52:9f8ebc757814
add convert urls
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Wed, 23 Nov 2022 23:29:16 -0700 |
| parents | 78b2d6995244 |
| children |
comparison
equal
deleted
inserted
replaced
| 51:78b2d6995244 | 52:9f8ebc757814 |
|---|---|
| 8 local footer = Shared.footer or error() | 8 local footer = Shared.footer or error() |
| 9 local Forum = require "site:/lib/Forum.luan" | 9 local Forum = require "site:/lib/Forum.luan" |
| 10 local forum_title = Forum.title or error() | 10 local forum_title = Forum.title or error() |
| 11 local Post = require "site:/lib/Post.luan" | 11 local Post = require "site:/lib/Post.luan" |
| 12 local User = require "site:/lib/User.luan" | 12 local User = require "site:/lib/User.luan" |
| 13 local Bbcode = require "site:/bbcode/Bbcode.luan" | |
| 14 local preprocess = Bbcode.preprocess or error() | |
| 13 | 15 |
| 14 | 16 |
| 15 return function() | 17 return function() |
| 16 local user = User.current_required() | 18 local user = User.current_required() |
| 17 if user==nil then return end | 19 if user==nil then return end |
| 18 if Http.request.method == "POST" then | 20 if Http.request.method == "POST" then |
| 19 local subject = Http.request.parameters.subject or error() | 21 local subject = Http.request.parameters.subject or error() |
| 20 local content = Http.request.parameters.bbcode or error() | 22 local content = Http.request.parameters.bbcode or error() |
| 23 local convert_urls = Http.request.parameters.convert_urls or error() | |
| 24 if convert_urls == "true" then | |
| 25 content = preprocess(content) | |
| 26 end | |
| 21 local post = Post.new_thread(user,subject,content) | 27 local post = Post.new_thread(user,subject,content) |
| 22 Http.response.send_redirect("/thread.html?root="..post.id) | 28 Http.response.send_redirect("/thread.html?root="..post.id) |
| 23 return | 29 return |
| 24 end | 30 end |
| 25 Io.stdout = Http.response.text_writer() | 31 Io.stdout = Http.response.text_writer() |
