You can now upvote topics and replies. The number of upvotes is visible on the posts.
The static resources now support Gzip Compression. Software-wide support is coming with the upcoming router rewrite! Revamped Tempra Simple's topic view. We now use emojis instead of text for the fields. Experimental. Simplified the json permissions in the installer. Fixed some places where the wrong error handler is used. Fixed a bug in the word counter where it was off by one. The word count is now tracked by the topics and replies.
This commit is contained in:
parent
0e5d0e649e
commit
534ef10194
17
data.sql
17
data.sql
|
@ -77,6 +77,8 @@ CREATE TABLE `topics`(
|
|||
`parentID` int DEFAULT 2 not null,
|
||||
`ipaddress` varchar(200) DEFAULT '0.0.0.0.0' not null,
|
||||
`postCount` int DEFAULT 1 not null,
|
||||
`likeCount` int DEFAULT 0 not null,
|
||||
`words` int DEFAULT 0 not null,
|
||||
`data` varchar(200) DEFAULT '' not null,
|
||||
primary key(`tid`)
|
||||
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
|
@ -91,6 +93,8 @@ CREATE TABLE `replies`(
|
|||
`lastEdit` int not null,
|
||||
`lastEditBy` int not null,
|
||||
`ipaddress` varchar(200) DEFAULT '0.0.0.0.0' not null,
|
||||
`likeCount` int DEFAULT 0 not null,
|
||||
`words` int DEFAULT 1 not null,
|
||||
primary key(`rid`)
|
||||
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
|
||||
|
@ -108,8 +112,8 @@ CREATE TABLE `users_replies`(
|
|||
|
||||
CREATE TABLE `likes`(
|
||||
`weight` tinyint DEFAULT 1 not null,
|
||||
`type` tinyint not null, /* Regular Post = 1, Big Post = 2, Mega Post = 3, etc.*/
|
||||
`targetItem` int not null,
|
||||
`targetType` varchar(50) DEFAULT 'replies' not null,
|
||||
`sentBy` int not null,
|
||||
`recalc` tinyint DEFAULT 0 not null
|
||||
);
|
||||
|
@ -162,6 +166,7 @@ ManagePlugins
|
|||
ViewIPs
|
||||
|
||||
ViewTopic
|
||||
LikeItem
|
||||
CreateTopic
|
||||
EditTopic
|
||||
DeleteTopic
|
||||
|
@ -172,11 +177,11 @@ PinTopic
|
|||
CloseTopic
|
||||
*/
|
||||
|
||||
INSERT INTO users_groups(`name`,`permissions`,`is_mod`,`is_admin`,`tag`) VALUES ('Administrator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserEmail":true,"EditUserPassword":true,"EditUserGroup":true,"EditUserGroupSuperMod":true,"EditUserGroupAdmin":false,"ManageForums":true,"EditSettings":true,"ManageThemes":true,"ManagePlugins":true,"ViewIPs":true,"ViewTopic":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true}',1,1,"Admin");
|
||||
INSERT INTO users_groups(`name`,`permissions`,`is_mod`,`tag`) VALUES ('Moderator','{"BanUsers":true,"ActivateUsers":false,"EditUser":true,"EditUserEmail":false,"EditUserPassword":false,"EditUserGroup":true,"EditUserGroupSuperMod":false,"EditUserGroupAdmin":false,"ManageForums":false,"EditSettings":false,"ManageThemes":false,"ManagePlugins":false,"ViewIPs":true,"ViewTopic":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true}',1,"Mod");
|
||||
INSERT INTO users_groups(`name`,`permissions`) VALUES ('Member','{"BanUsers":false,"ActivateUsers":false,"EditUser":false,"EditUserEmail":false,"EditUserPassword":false,"EditUserGroup":false,"EditUserGroupSuperMod":false,"EditUserGroupAdmin":false,"ManageForums":false,"EditSettings":false,"ManageThemes":false,"ManagePlugins":false,"ViewIPs":false,"ViewTopic":true,"CreateTopic":true,"EditTopic":false,"DeleteTopic":false,"CreateReply":true,"EditReply":false,"DeleteReply":false,"PinTopic":false,"CloseTopic":false}');
|
||||
INSERT INTO users_groups(`name`,`permissions`,`is_banned`) VALUES ('Banned','{"BanUsers":false,"ActivateUsers":false,"EditUser":false,"EditUserEmail":false,"EditUserPassword":false,"EditUserGroup":false,"EditUserGroupSuperMod":false,"EditUserGroupAdmin":false,"ManageForums":false,"EditSettings":false,"ManageThemes":false,"ManagePlugins":false,"ViewIPs":false,"ViewTopic":true,"CreateTopic":false,"EditTopic":false,"DeleteTopic":false,"CreateReply":false,"EditReply":false,"DeleteReply":false,"PinTopic":false,"CloseTopic":false}',1);
|
||||
INSERT INTO users_groups(`name`,`permissions`) VALUES ('Awaiting Activation','{"BanUsers":false,"ActivateUsers":false,"EditUser":false,"EditUserEmail":false,"EditUserPassword":false,"EditUserGroup":false,"EditUserGroupSuperMod":false,"EditUserGroupAdmin":false,"ManageForums":false,"EditSettings":false,"ManageThemes":false,"ManagePlugins":false,"ViewIPs":false,"ViewTopic":true,"CreateTopic":false,"EditTopic":false,"DeleteTopic":false,"CreateReply":false,"EditReply":false,"DeleteReply":false,"PinTopic":false,"CloseTopic":false}');
|
||||
INSERT INTO users_groups(`name`,`permissions`,`is_mod`,`is_admin`,`tag`) VALUES ('Administrator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserEmail":true,"EditUserPassword":true,"EditUserGroup":true,"EditUserGroupSuperMod":true,"EditUserGroupAdmin":false,"ManageForums":true,"EditSettings":true,"ManageThemes":true,"ManagePlugins":true,"ViewIPs":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true}',1,1,"Admin");
|
||||
INSERT INTO users_groups(`name`,`permissions`,`is_mod`,`tag`) VALUES ('Moderator','{"BanUsers":true,"ActivateUsers":false,"EditUser":true,"EditUserEmail":false,"EditUserPassword":false,"EditUserGroup":true,"EditUserGroupSuperMod":false,"EditUserGroupAdmin":false,"ManageForums":false,"EditSettings":false,"ManageThemes":false,"ManagePlugins":false,"ViewIPs":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true}',1,"Mod");
|
||||
INSERT INTO users_groups(`name`,`permissions`) VALUES ('Member','{"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"CreateReply":true}');
|
||||
INSERT INTO users_groups(`name`,`permissions`,`is_banned`) VALUES ('Banned','{"ViewTopic":true}',1);
|
||||
INSERT INTO users_groups(`name`,`permissions`) VALUES ('Awaiting Activation','{"ViewTopic":true}');
|
||||
INSERT INTO users_groups(`name`,`permissions`,`tag`) VALUES ('Not Loggedin','{"ViewTopic":true}','Guest');
|
||||
|
||||
INSERT INTO forums(`name`,`active`) VALUES ('Reports',0);
|
||||
|
|
14
files.go
14
files.go
|
@ -1,5 +1,7 @@
|
|||
package main
|
||||
|
||||
import "log"
|
||||
import "bytes"
|
||||
import "strings"
|
||||
import "mime"
|
||||
import "errors"
|
||||
|
@ -8,10 +10,12 @@ import "io"
|
|||
import "io/ioutil"
|
||||
import "path/filepath"
|
||||
import "net/http"
|
||||
import "compress/gzip"
|
||||
|
||||
type SFile struct
|
||||
{
|
||||
Data []byte
|
||||
GzipData []byte
|
||||
Pos int64
|
||||
Length int64
|
||||
Mimetype string
|
||||
|
@ -74,6 +78,14 @@ func add_static_file(path string, prefix string) error {
|
|||
path = strings.TrimPrefix(path, prefix)
|
||||
log.Print("Added the '" + path + "' static file")
|
||||
|
||||
static_files["/static" + path] = SFile{data,0,int64(len(data)),mime.TypeByExtension(filepath.Ext(prefix + path)),f,f.ModTime().UTC().Format(http.TimeFormat)}
|
||||
static_files["/static" + path] = SFile{data,compress_bytes_gzip(data),0,int64(len(data)),mime.TypeByExtension(filepath.Ext(prefix + path)),f,f.ModTime().UTC().Format(http.TimeFormat)}
|
||||
return nil
|
||||
}
|
||||
|
||||
func compress_bytes_gzip(in []byte) []byte {
|
||||
var buff bytes.Buffer
|
||||
gz := gzip.NewWriter(&buff)
|
||||
gz.Write(in)
|
||||
gz.Close()
|
||||
return buff.Bytes()
|
||||
}
|
||||
|
|
12
main.go
12
main.go
|
@ -51,9 +51,9 @@ func compile_templates() {
|
|||
|
||||
log.Print("Compiling the templates")
|
||||
|
||||
topic := TopicUser{1,"Blah",template.HTML("Hey there!"),0,false,false,"Date","Date",0,"","127.0.0.1",0,"","",no_css_tmpl,0,"","","","",58}
|
||||
topic := TopicUser{1,"Blah",template.HTML("Hey there!"),0,false,false,"Date","Date",0,"","127.0.0.1",0,1,"","",no_css_tmpl,0,"","","","",58,false}
|
||||
var replyList []Reply
|
||||
replyList = append(replyList, Reply{0,0,"",template.HTML("Yo!"),0,"","",0,0,"",no_css_tmpl,0,"","","","",0,"127.0.0.1"})
|
||||
replyList = append(replyList, Reply{0,0,"",template.HTML("Yo!"),0,"","",0,0,"",no_css_tmpl,0,"","","","",0,"127.0.0.1",false,1})
|
||||
|
||||
var varList map[string]VarItem = make(map[string]VarItem)
|
||||
tpage := TopicPage{"Title",user,noticeList,replyList,topic,1,1,false}
|
||||
|
@ -75,12 +75,12 @@ func compile_templates() {
|
|||
forums_tmpl := c.compile_template("forums.html","templates/","ForumsPage", forums_page, varList)
|
||||
|
||||
var topicsList []TopicsRow
|
||||
topicsList = append(topicsList, TopicsRow{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,"Admin","","",0,"","","","",58,"General"})
|
||||
topicsList = append(topicsList,TopicsRow{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"Admin","","",0,"","","","",58,"General"})
|
||||
topics_page := TopicsPage{"Topic List",user,noticeList,topicsList,""}
|
||||
topics_tmpl := c.compile_template("topics.html","templates/","TopicsPage", topics_page, varList)
|
||||
|
||||
var topicList []TopicUser
|
||||
topicList = append(topicList, TopicUser{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,"Admin","","",0,"","","","",58})
|
||||
topicList = append(topicList,TopicUser{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"Admin","","",0,"","","","",58,false})
|
||||
forum_item := Forum{1,"General Forum",true,"all",0,"",0,"",0,""}
|
||||
forum_page := ForumPage{"General Forum",user,noticeList,topicList,forum_item,1,1,nil}
|
||||
forum_tmpl := c.compile_template("forum.html","templates/","ForumPage", forum_page, varList)
|
||||
|
@ -157,7 +157,7 @@ func main(){
|
|||
|
||||
path = strings.TrimPrefix(path,"public/")
|
||||
log.Print("Added the '" + path + "' static file.")
|
||||
static_files["/static/" + path] = SFile{data,0,int64(len(data)),mime.TypeByExtension(filepath.Ext("/public/" + path)),f,f.ModTime().UTC().Format(http.TimeFormat)}
|
||||
static_files["/static/" + path] = SFile{data,compress_bytes_gzip(data),0,int64(len(data)),mime.TypeByExtension(filepath.Ext("/public/" + path)),f,f.ModTime().UTC().Format(http.TimeFormat)}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -188,11 +188,13 @@ func main(){
|
|||
//router.HandleFunc("/reply/delete/", route_reply_delete)
|
||||
router.HandleFunc("/reply/edit/submit/", route_reply_edit_submit)
|
||||
router.HandleFunc("/reply/delete/submit/", route_reply_delete_submit)
|
||||
router.HandleFunc("/reply/like/submit/", route_reply_like_submit)
|
||||
router.HandleFunc("/report/submit/", route_report_submit)
|
||||
router.HandleFunc("/topic/edit/submit/", route_edit_topic)
|
||||
router.HandleFunc("/topic/delete/submit/", route_delete_topic)
|
||||
router.HandleFunc("/topic/stick/submit/", route_stick_topic)
|
||||
router.HandleFunc("/topic/unstick/submit/", route_unstick_topic)
|
||||
router.HandleFunc("/topic/like/submit/", route_like_topic)
|
||||
|
||||
// Custom Pages
|
||||
router.HandleFunc("/pages/", route_custom_page)
|
||||
|
|
|
@ -30,10 +30,10 @@ func route_edit_topic(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
err = db.QueryRow("select parentID from topics where tid = ?", tid).Scan(&fid)
|
||||
if err == sql.ErrNoRows {
|
||||
PreError("The topic you tried to edit doesn't exist.",w,r)
|
||||
PreErrorJSQ("The topic you tried to edit doesn't exist.",w,r,is_js)
|
||||
return
|
||||
} else if err != nil {
|
||||
InternalError(err,w,r)
|
||||
InternalErrorJSQ(err,w,r,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -197,14 +197,14 @@ func route_reply_edit_submit(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
rid, err := strconv.Atoi(r.URL.Path[len("/reply/edit/submit/"):])
|
||||
if err != nil {
|
||||
PreError("The provided Reply ID is not a valid number.",w,r)
|
||||
PreErrorJSQ("The provided Reply ID is not a valid number.",w,r,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
content := html.EscapeString(preparse_message(r.PostFormValue("edit_item")))
|
||||
_, err = edit_reply_stmt.Exec(content, parse_message(content), rid)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
InternalErrorJSQ(err,w,r,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -212,17 +212,17 @@ func route_reply_edit_submit(w http.ResponseWriter, r *http.Request) {
|
|||
var tid int
|
||||
err = db.QueryRow("select tid from replies where rid = ?", rid).Scan(&tid)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
InternalErrorJSQ(err,w,r,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
var fid int
|
||||
err = db.QueryRow("select parentID from topics where tid = ?", tid).Scan(&fid)
|
||||
if err == sql.ErrNoRows {
|
||||
PreError("The parent topic doesn't exist.",w,r)
|
||||
PreErrorJSQ("The parent topic doesn't exist.",w,r,is_js)
|
||||
return
|
||||
} else if err != nil {
|
||||
InternalError(err,w,r)
|
||||
InternalErrorJSQ(err,w,r,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ func route_reply_edit_submit(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
if !user.Perms.ViewTopic || !user.Perms.EditReply {
|
||||
NoPermissions(w,r,user)
|
||||
NoPermissionsJSQ(w,r,user,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -274,10 +274,10 @@ func route_reply_delete_submit(w http.ResponseWriter, r *http.Request) {
|
|||
var fid int
|
||||
err = db.QueryRow("select parentID from topics where tid = ?", tid).Scan(&fid)
|
||||
if err == sql.ErrNoRows {
|
||||
PreError("The parent topic doesn't exist.",w,r)
|
||||
PreErrorJSQ("The parent topic doesn't exist.",w,r,is_js)
|
||||
return
|
||||
} else if err != nil {
|
||||
InternalError(err,w,r)
|
||||
InternalErrorJSQ(err,w,r,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ func route_reply_delete_submit(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
if !user.Perms.ViewTopic || !user.Perms.DeleteReply {
|
||||
NoPermissions(w,r,user)
|
||||
NoPermissionsJSQ(w,r,user,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -305,12 +305,12 @@ func route_reply_delete_submit(w http.ResponseWriter, r *http.Request) {
|
|||
wcount := word_count(content)
|
||||
err = decrease_post_user_stats(wcount, createdBy, false, user)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
InternalErrorJSQ(err,w,r,is_js)
|
||||
return
|
||||
}
|
||||
_, err = remove_replies_from_topic_stmt.Exec(1,tid)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
InternalErrorJSQ(err,w,r,is_js)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ func route_profile_reply_edit_submit(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
rid, err := strconv.Atoi(r.URL.Path[len("/profile/reply/edit/submit/"):])
|
||||
if err != nil {
|
||||
LocalError("The provided Reply ID is not a valid number.",w,r,user)
|
||||
LocalErrorJSQ("The provided Reply ID is not a valid number.",w,r,user,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ func route_profile_reply_edit_submit(w http.ResponseWriter, r *http.Request) {
|
|||
var uid int
|
||||
err = db.QueryRow("select uid from users_replies where rid = ?", rid).Scan(&uid)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
InternalErrorJSQ(err,w,r,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ func route_profile_reply_edit_submit(w http.ResponseWriter, r *http.Request) {
|
|||
content := html.EscapeString(preparse_message(r.PostFormValue("edit_item")))
|
||||
_, err = edit_profile_reply_stmt.Exec(content, parse_message(content), rid)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
InternalErrorJSQ(err,w,r,is_js)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
31
mysql.go
31
mysql.go
|
@ -24,6 +24,9 @@ var remove_replies_from_topic_stmt *sql.Stmt
|
|||
var add_topics_to_forum_stmt *sql.Stmt
|
||||
var remove_topics_from_forum_stmt *sql.Stmt
|
||||
var update_forum_cache_stmt *sql.Stmt
|
||||
var create_like_stmt *sql.Stmt
|
||||
var add_likes_to_topic_stmt *sql.Stmt
|
||||
var add_likes_to_reply_stmt *sql.Stmt
|
||||
var edit_topic_stmt *sql.Stmt
|
||||
var edit_reply_stmt *sql.Stmt
|
||||
var delete_reply_stmt *sql.Stmt
|
||||
|
@ -100,7 +103,7 @@ func init_database(err error) {
|
|||
}
|
||||
|
||||
log.Print("Preparing get_topic_user statement.")
|
||||
get_topic_user_stmt, err = db.Prepare("select topics.title, topics.content, topics.createdBy, topics.createdAt, topics.is_closed, topics.sticky, topics.parentID, topics.ipaddress, topics.postCount, users.name, users.avatar, users.group, users.url_prefix, users.url_name, users.level from topics left join users ON topics.createdBy = users.uid where tid = ?")
|
||||
get_topic_user_stmt, err = db.Prepare("select topics.title, topics.content, topics.createdBy, topics.createdAt, topics.is_closed, topics.sticky, topics.parentID, topics.ipaddress, topics.postCount, topics.likeCount, users.name, users.avatar, users.group, users.url_prefix, users.url_name, users.level from topics left join users ON topics.createdBy = users.uid where tid = ?")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -112,7 +115,7 @@ func init_database(err error) {
|
|||
}
|
||||
|
||||
log.Print("Preparing get_topic_replies_offset statement.")
|
||||
get_topic_replies_offset_stmt, err = db.Prepare("select replies.rid, replies.content, replies.createdBy, replies.createdAt, replies.lastEdit, replies.lastEditBy, users.avatar, users.name, users.group, users.url_prefix, users.url_name, users.level, replies.ipaddress from replies left join users on replies.createdBy = users.uid where tid = ? limit ?, " + strconv.Itoa(items_per_page))
|
||||
get_topic_replies_offset_stmt, err = db.Prepare("select replies.rid, replies.content, replies.createdBy, replies.createdAt, replies.lastEdit, replies.lastEditBy, users.avatar, users.name, users.group, users.url_prefix, users.url_name, users.level, replies.ipaddress, replies.likeCount from replies left join users on replies.createdBy = users.uid where tid = ? limit ?, " + strconv.Itoa(items_per_page))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -124,13 +127,13 @@ func init_database(err error) {
|
|||
}
|
||||
|
||||
log.Print("Preparing get_forum_topics_offset statement.")
|
||||
get_forum_topics_offset_stmt, err = db.Prepare("select topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, topics.lastReplyAt, topics.parentID, users.name, users.avatar from topics left join users ON topics.createdBy = users.uid WHERE topics.parentID = ? order by topics.sticky DESC, topics.lastReplyAt DESC, topics.createdBy DESC limit ?, " + strconv.Itoa(items_per_page))
|
||||
get_forum_topics_offset_stmt, err = db.Prepare("select topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, topics.lastReplyAt, topics.parentID, topics.likeCount, users.name, users.avatar from topics left join users ON topics.createdBy = users.uid WHERE topics.parentID = ? order by topics.sticky DESC, topics.lastReplyAt DESC, topics.createdBy DESC limit ?, " + strconv.Itoa(items_per_page))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Print("Preparing create_topic statement.")
|
||||
create_topic_stmt, err = db.Prepare("insert into topics(parentID,title,content,parsed_content,createdAt,lastReplyAt,ipaddress,createdBy) VALUES(?,?,?,?,NOW(),NOW(),?,?)")
|
||||
create_topic_stmt, err = db.Prepare("insert into topics(parentID,title,content,parsed_content,createdAt,lastReplyAt,ipaddress,words,createdBy) VALUES(?,?,?,?,NOW(),NOW(),?,?,?)")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -142,7 +145,7 @@ func init_database(err error) {
|
|||
}
|
||||
|
||||
log.Print("Preparing create_reply statement.")
|
||||
create_reply_stmt, err = db.Prepare("INSERT INTO replies(tid,content,parsed_content,createdAt,ipaddress,createdBy) VALUES(?,?,?,NOW(),?,?)")
|
||||
create_reply_stmt, err = db.Prepare("INSERT INTO replies(tid,content,parsed_content,createdAt,ipaddress,words,createdBy) VALUES(?,?,?,NOW(),?,?,?)")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -177,6 +180,24 @@ func init_database(err error) {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Print("Preparing create_like statement.")
|
||||
create_like_stmt, err = db.Prepare("INSERT INTO likes(weight, targetItem, targetType, sentBy) VALUES(?,?,?,?)")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Print("Preparing add_likes_to_topic statement.")
|
||||
add_likes_to_topic_stmt, err = db.Prepare("UPDATE topics SET likeCount = likeCount + ? WHERE tid = ?")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Print("Preparing add_likes_to_reply statement.")
|
||||
add_likes_to_reply_stmt, err = db.Prepare("UPDATE replies SET likeCount = likeCount + ? WHERE rid = ?")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Print("Preparing edit_topic statement.")
|
||||
edit_topic_stmt, err = db.Prepare("UPDATE topics SET title = ?, content = ?, parsed_content = ?, is_closed = ? WHERE tid = ?")
|
||||
if err != nil {
|
||||
|
|
|
@ -34,6 +34,7 @@ type Perms struct
|
|||
|
||||
// Forum permissions
|
||||
ViewTopic bool
|
||||
LikeItem bool
|
||||
CreateTopic bool
|
||||
EditTopic bool
|
||||
DeleteTopic bool
|
||||
|
@ -53,6 +54,7 @@ type Perms struct
|
|||
type ForumPerms struct
|
||||
{
|
||||
ViewTopic bool
|
||||
LikeItem bool
|
||||
CreateTopic bool
|
||||
EditTopic bool
|
||||
DeleteTopic bool
|
||||
|
@ -99,6 +101,7 @@ func init() {
|
|||
ViewIPs: true,
|
||||
|
||||
ViewTopic: true,
|
||||
LikeItem: true,
|
||||
CreateTopic: true,
|
||||
EditTopic: true,
|
||||
DeleteTopic: true,
|
||||
|
@ -113,6 +116,7 @@ func init() {
|
|||
|
||||
AllForumPerms = ForumPerms{
|
||||
ViewTopic: true,
|
||||
LikeItem: true,
|
||||
CreateTopic: true,
|
||||
EditTopic: true,
|
||||
DeleteTopic: true,
|
||||
|
@ -128,6 +132,7 @@ func init() {
|
|||
|
||||
ReadWriteForumPerms = ForumPerms{
|
||||
ViewTopic: true,
|
||||
LikeItem: true,
|
||||
CreateTopic: true,
|
||||
CreateReply: true,
|
||||
Overrides: true,
|
||||
|
@ -136,6 +141,7 @@ func init() {
|
|||
|
||||
ReadReplyForumPerms = ForumPerms{
|
||||
ViewTopic: true,
|
||||
LikeItem: true,
|
||||
CreateReply: true,
|
||||
Overrides: true,
|
||||
ExtData: make(map[string]bool),
|
||||
|
|
3
reply.go
3
reply.go
|
@ -22,4 +22,7 @@ type Reply struct
|
|||
URLName string
|
||||
Level int
|
||||
IpAddress string
|
||||
Liked bool
|
||||
LikeCount int
|
||||
}
|
||||
|
||||
|
|
165
routes.go
165
routes.go
|
@ -44,7 +44,12 @@ func route_static(w http.ResponseWriter, r *http.Request){
|
|||
h.Set("Content-Length", strconv.FormatInt(file.Length, 10)) // Avoid doing a type conversion every time?
|
||||
//http.ServeContent(w,r,r.URL.Path,file.Info.ModTime(),file)
|
||||
//w.Write(file.Data)
|
||||
io.Copy(w, bytes.NewReader(file.Data)) // Use w.Write instead?
|
||||
if strings.Contains(r.Header.Get("Accept-Encoding"),"gzip") {
|
||||
h.Set("Content-Encoding","gzip")
|
||||
io.Copy(w, bytes.NewReader(file.GzipData)) // Use w.Write instead?
|
||||
} else {
|
||||
io.Copy(w, bytes.NewReader(file.Data))
|
||||
}
|
||||
//io.CopyN(w, bytes.NewReader(file.Data), static_files[r.URL.Path].Length)
|
||||
}
|
||||
|
||||
|
@ -101,7 +106,7 @@ func route_topics(w http.ResponseWriter, r *http.Request){
|
|||
}
|
||||
|
||||
var topicList []TopicsRow
|
||||
rows, err := db.Query("select topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, topics.lastReplyAt, topics.parentID, users.name, users.avatar from topics left join users ON topics.createdBy = users.uid where parentID in("+strings.Join(fidList,",")+") order by topics.sticky DESC, topics.lastReplyAt DESC, topics.createdBy DESC")
|
||||
rows, err := db.Query("select topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, topics.lastReplyAt, topics.parentID, topics.likeCount, users.name, users.avatar from topics left join users ON topics.createdBy = users.uid where parentID in("+strings.Join(fidList,",")+") order by topics.sticky DESC, topics.lastReplyAt DESC, topics.createdBy DESC")
|
||||
//rows, err := get_topic_list_stmt.Query()
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
|
@ -110,7 +115,7 @@ func route_topics(w http.ResponseWriter, r *http.Request){
|
|||
|
||||
topicItem := TopicsRow{ID: 0,}
|
||||
for rows.Next() {
|
||||
err := rows.Scan(&topicItem.ID, &topicItem.Title, &topicItem.Content, &topicItem.CreatedBy, &topicItem.Is_Closed, &topicItem.Sticky, &topicItem.CreatedAt, &topicItem.LastReplyAt, &topicItem.ParentID, &topicItem.CreatedByName, &topicItem.Avatar)
|
||||
err := rows.Scan(&topicItem.ID, &topicItem.Title, &topicItem.Content, &topicItem.CreatedBy, &topicItem.Is_Closed, &topicItem.Sticky, &topicItem.CreatedAt, &topicItem.LastReplyAt, &topicItem.ParentID, &topicItem.LikeCount, &topicItem.CreatedByName, &topicItem.Avatar)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
|
@ -200,7 +205,7 @@ func route_forum(w http.ResponseWriter, r *http.Request){
|
|||
var topicList []TopicUser
|
||||
topicItem := TopicUser{ID: 0}
|
||||
for rows.Next() {
|
||||
err := rows.Scan(&topicItem.ID, &topicItem.Title, &topicItem.Content, &topicItem.CreatedBy, &topicItem.Is_Closed, &topicItem.Sticky, &topicItem.CreatedAt, &topicItem.LastReplyAt, &topicItem.ParentID, &topicItem.CreatedByName, &topicItem.Avatar)
|
||||
err := rows.Scan(&topicItem.ID, &topicItem.Title, &topicItem.Content, &topicItem.CreatedBy, &topicItem.Is_Closed, &topicItem.Sticky, &topicItem.CreatedAt, &topicItem.LastReplyAt, &topicItem.ParentID, &topicItem.LikeCount, &topicItem.CreatedByName, &topicItem.Avatar)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
|
@ -299,7 +304,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request){
|
|||
}
|
||||
|
||||
// Get the topic..
|
||||
err = get_topic_user_stmt.QueryRow(topic.ID).Scan(&topic.Title, &content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.CreatedByName, &topic.Avatar, &group, &topic.URLPrefix, &topic.URLName, &topic.Level)
|
||||
err = get_topic_user_stmt.QueryRow(topic.ID).Scan(&topic.Title, &content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.LikeCount, &topic.CreatedByName, &topic.Avatar, &group, &topic.URLPrefix, &topic.URLName, &topic.Level)
|
||||
if err == sql.ErrNoRows {
|
||||
NotFound(w,r)
|
||||
return
|
||||
|
@ -377,7 +382,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request){
|
|||
|
||||
replyItem := Reply{Css: no_css_tmpl}
|
||||
for rows.Next() {
|
||||
err := rows.Scan(&replyItem.ID, &replyItem.Content, &replyItem.CreatedBy, &replyItem.CreatedAt, &replyItem.LastEdit, &replyItem.LastEditBy, &replyItem.Avatar, &replyItem.CreatedByName, &group, &replyItem.URLPrefix, &replyItem.URLName, &replyItem.Level, &replyItem.IpAddress)
|
||||
err := rows.Scan(&replyItem.ID, &replyItem.Content, &replyItem.CreatedBy, &replyItem.CreatedAt, &replyItem.LastEdit, &replyItem.LastEditBy, &replyItem.Avatar, &replyItem.CreatedByName, &group, &replyItem.URLPrefix, &replyItem.URLName, &replyItem.Level, &replyItem.IpAddress, &replyItem.LikeCount)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
|
@ -402,7 +407,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request){
|
|||
|
||||
replyItem.Tag = groups[group].Tag
|
||||
|
||||
if settings["url_tags"] == false {
|
||||
/*if settings["url_tags"] == false {
|
||||
replyItem.URLName = ""
|
||||
} else {
|
||||
replyItem.URL, ok = external_sites[replyItem.URLPrefix]
|
||||
|
@ -411,7 +416,9 @@ func route_topic_id(w http.ResponseWriter, r *http.Request){
|
|||
} else {
|
||||
replyItem.URL = replyItem.URL + replyItem.URLName
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
replyItem.Liked = false
|
||||
|
||||
if hooks["rrow_assign"] != nil {
|
||||
replyItem = run_hook("rrow_assign", replyItem).(Reply)
|
||||
|
@ -528,6 +535,7 @@ func route_profile(w http.ResponseWriter, r *http.Request){
|
|||
} else {
|
||||
replyAvatar = strings.Replace(noavatar,"{id}",strconv.Itoa(replyCreatedBy),1)
|
||||
}
|
||||
|
||||
if groups[group].Tag != "" {
|
||||
replyTag = groups[group].Tag
|
||||
} else if puser.ID == replyCreatedBy {
|
||||
|
@ -536,7 +544,10 @@ func route_profile(w http.ResponseWriter, r *http.Request){
|
|||
replyTag = ""
|
||||
}
|
||||
|
||||
replyList = append(replyList, Reply{rid,puser.ID,replyContent,template.HTML(parse_message(replyContent)),replyCreatedBy,replyCreatedByName,replyCreatedAt,replyLastEdit,replyLastEditBy,replyAvatar,replyCss,replyLines,replyTag,"","","",0,""})
|
||||
replyLiked := false
|
||||
replyLikeCount := 0
|
||||
|
||||
replyList = append(replyList, Reply{rid,puser.ID,replyContent,template.HTML(parse_message(replyContent)),replyCreatedBy,replyCreatedByName,replyCreatedAt,replyLastEdit,replyLastEditBy,replyAvatar,replyCss,replyLines,replyTag,"","","",0,"",replyLiked,replyLikeCount})
|
||||
}
|
||||
err = rows.Err()
|
||||
if err != nil {
|
||||
|
@ -626,7 +637,8 @@ func route_create_topic(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
res, err := create_topic_stmt.Exec(fid,topic_name,content,parse_message(content),ipaddress,user.ID)
|
||||
wcount := word_count(content)
|
||||
res, err := create_topic_stmt.Exec(fid,topic_name,content,parse_message(content),ipaddress,wcount,user.ID)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
|
@ -656,7 +668,6 @@ func route_create_topic(w http.ResponseWriter, r *http.Request) {
|
|||
forums[fid].LastTopicTime = ""
|
||||
|
||||
http.Redirect(w, r, "/topic/" + strconv.FormatInt(lastId,10), http.StatusSeeOther)
|
||||
wcount := word_count(content)
|
||||
err = increase_post_user_stats(wcount,user.ID,true,user)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
|
@ -703,7 +714,8 @@ func route_create_reply(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
_, err = create_reply_stmt.Exec(tid,content,parse_message(content),ipaddress,user.ID)
|
||||
wcount := word_count(content)
|
||||
_, err = create_reply_stmt.Exec(tid,content,parse_message(content),ipaddress,wcount, user.ID)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
|
@ -721,7 +733,6 @@ func route_create_reply(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
http.Redirect(w,r, "/topic/" + strconv.Itoa(tid), http.StatusSeeOther)
|
||||
wcount := word_count(content)
|
||||
err = increase_post_user_stats(wcount, user.ID, false, user)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
|
@ -729,6 +740,134 @@ func route_create_reply(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
func route_like_topic(w http.ResponseWriter, r *http.Request) {
|
||||
err := r.ParseForm()
|
||||
if err != nil {
|
||||
PreError("Bad Form",w,r)
|
||||
return
|
||||
}
|
||||
|
||||
tid, err := strconv.Atoi(r.URL.Path[len("/topic/like/submit/"):])
|
||||
if err != nil {
|
||||
PreError("Topic IDs can only ever be numbers.",w,r)
|
||||
return
|
||||
}
|
||||
|
||||
var words int
|
||||
var fid int
|
||||
err = db.QueryRow("select parentID, words from topics where tid = ?", tid).Scan(&fid,&words)
|
||||
if err == sql.ErrNoRows {
|
||||
PreError("The requested topic doesn't exist.",w,r)
|
||||
return
|
||||
} else if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
}
|
||||
|
||||
user, ok := SimpleForumSessionCheck(w,r,fid)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if !user.Perms.ViewTopic || !user.Perms.LikeItem {
|
||||
NoPermissions(w,r,user)
|
||||
return
|
||||
}
|
||||
|
||||
err = db.QueryRow("select targetItem from likes where sentBy = ? and targetItem = ? and targetType = 'topics'", user.ID, tid).Scan(&tid)
|
||||
if err != nil && err != sql.ErrNoRows {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
} else if err != sql.ErrNoRows {
|
||||
LocalError("You already liked this!",w,r,user)
|
||||
return
|
||||
}
|
||||
|
||||
//score := words_to_score(words,true)
|
||||
score := 1
|
||||
_, err = create_like_stmt.Exec(score,tid,"topics",user.ID)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = add_likes_to_topic_stmt.Exec(1,tid)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
}
|
||||
|
||||
http.Redirect(w,r,"/topic/" + strconv.Itoa(tid),http.StatusSeeOther)
|
||||
}
|
||||
|
||||
func route_reply_like_submit(w http.ResponseWriter, r *http.Request) {
|
||||
err := r.ParseForm()
|
||||
if err != nil {
|
||||
PreError("Bad Form",w,r)
|
||||
return
|
||||
}
|
||||
|
||||
rid, err := strconv.Atoi(r.URL.Path[len("/reply/like/submit/"):])
|
||||
if err != nil {
|
||||
PreError("The provided Reply ID is not a valid number.",w,r)
|
||||
return
|
||||
}
|
||||
|
||||
var tid int
|
||||
var words int
|
||||
err = db.QueryRow("select tid, words from replies where rid = ?", rid).Scan(&tid, &words)
|
||||
if err == sql.ErrNoRows {
|
||||
PreError("You can't like something which doesn't exist!",w,r)
|
||||
return
|
||||
} else if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
}
|
||||
|
||||
var fid int
|
||||
err = db.QueryRow("select parentID from topics where tid = ?", tid).Scan(&fid)
|
||||
if err == sql.ErrNoRows {
|
||||
PreError("The parent topic doesn't exist.",w,r)
|
||||
return
|
||||
} else if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
}
|
||||
|
||||
user, ok := SimpleForumSessionCheck(w,r,fid)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if !user.Perms.ViewTopic || !user.Perms.LikeItem {
|
||||
NoPermissions(w,r,user)
|
||||
return
|
||||
}
|
||||
|
||||
err = db.QueryRow("select targetItem from likes where sentBy = ? and targetItem = ? and targetType = 'replies'", user.ID, rid).Scan(&rid)
|
||||
if err != nil && err != sql.ErrNoRows {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
} else if err != sql.ErrNoRows {
|
||||
LocalError("You already liked this!",w,r,user)
|
||||
return
|
||||
}
|
||||
|
||||
//score := words_to_score(words,false)
|
||||
score := 1
|
||||
_, err = create_like_stmt.Exec(score,rid,"replies",user.ID)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = add_likes_to_reply_stmt.Exec(1,rid)
|
||||
if err != nil {
|
||||
InternalError(err,w,r)
|
||||
return
|
||||
}
|
||||
|
||||
http.Redirect(w,r,"/topic/" + strconv.Itoa(tid),http.StatusSeeOther)
|
||||
}
|
||||
|
||||
func route_profile_reply_create(w http.ResponseWriter, r *http.Request) {
|
||||
user, ok := SimpleSessionCheck(w,r)
|
||||
if !ok {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||
package main
|
||||
import "io"
|
||||
import "strconv"
|
||||
import "io"
|
||||
|
||||
func init() {
|
||||
template_forum_handle = template_forum
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||
package main
|
||||
import "io"
|
||||
import "strconv"
|
||||
import "io"
|
||||
|
||||
func init() {
|
||||
template_forums_handle = template_forums
|
||||
|
|
217
template_list.go
217
template_list.go
|
@ -72,87 +72,103 @@ var topic_13 []byte = []byte(`</a>
|
|||
`)
|
||||
var topic_14 []byte = []byte(`<span class='username hide_on_micro topic_status_e topic_status_closed hide_on_edit' title='Status: Closed' style="font-weight:normal;float: right;position:relative;top:-5px;">🔒︎</span>`)
|
||||
var topic_15 []byte = []byte(`
|
||||
<a href='/topic/edit/`)
|
||||
var topic_16 []byte = []byte(`' class="username hide_on_edit open_edit" style="font-weight: normal;margin-left: 6px;">Edit</a>
|
||||
<a href='/topic/delete/submit/`)
|
||||
var topic_17 []byte = []byte(`' class="username" style="font-weight: normal;">Delete</a>
|
||||
`)
|
||||
var topic_18 []byte = []byte(`<a href='/topic/unstick/submit/`)
|
||||
var topic_19 []byte = []byte(`' class="username" style="font-weight: normal;">Unpin</a>`)
|
||||
var topic_20 []byte = []byte(`<a href='/topic/stick/submit/`)
|
||||
var topic_21 []byte = []byte(`' class="username" style="font-weight: normal;">Pin</a>`)
|
||||
var topic_22 []byte = []byte(`
|
||||
|
||||
<input class='show_on_edit topic_name_input' name="topic_name" value='`)
|
||||
var topic_23 []byte = []byte(`' type="text" />
|
||||
var topic_16 []byte = []byte(`' type="text" />
|
||||
<select name="topic_status" class='show_on_edit topic_status_input' style='float: right;'>
|
||||
<option>open</option>
|
||||
<option>closed</option>
|
||||
</select>
|
||||
<button name="topic-button" class="formbutton show_on_edit submit_edit">Update</button>
|
||||
`)
|
||||
var topic_24 []byte = []byte(`
|
||||
<a href="/report/submit/`)
|
||||
var topic_25 []byte = []byte(`?session=`)
|
||||
var topic_26 []byte = []byte(`&type=topic" class="username report_item" style="font-weight: normal;">Report</a>
|
||||
var topic_17 []byte = []byte(`
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="rowblock post_container">
|
||||
<div class="rowitem passive editable_parent post_item" style="border-bottom: none;`)
|
||||
var topic_27 []byte = []byte(`background-image: url(`)
|
||||
var topic_28 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px `)
|
||||
var topic_29 []byte = []byte(`-1`)
|
||||
var topic_30 []byte = []byte(`0px;background-repeat: no-repeat, repeat-y;background-size: 128px;padding-left: 136px;`)
|
||||
var topic_31 []byte = []byte(`">
|
||||
var topic_18 []byte = []byte(`background-image:url(`)
|
||||
var topic_19 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px `)
|
||||
var topic_20 []byte = []byte(`-1`)
|
||||
var topic_21 []byte = []byte(`0px;background-repeat:no-repeat, repeat-y;background-size:128px;padding-left:136px;`)
|
||||
var topic_22 []byte = []byte(`">
|
||||
<p class="hide_on_edit topic_content user_content" style="margin:0;padding:0;">`)
|
||||
var topic_32 []byte = []byte(`</p>
|
||||
var topic_23 []byte = []byte(`</p>
|
||||
<textarea name="topic_content" class="show_on_edit topic_content_input">`)
|
||||
var topic_33 []byte = []byte(`</textarea><br /><br />
|
||||
var topic_24 []byte = []byte(`</textarea><br /><br />
|
||||
<a href="/user/`)
|
||||
var topic_34 []byte = []byte(`" class="username real_username">`)
|
||||
var topic_35 []byte = []byte(`</a>
|
||||
<a class="username hide_on_micro" `)
|
||||
var topic_36 []byte = []byte(`style="float: right;">`)
|
||||
var topic_37 []byte = []byte(`style="color: #505050;float: right;">Level `)
|
||||
var topic_38 []byte = []byte(`</a>
|
||||
var topic_25 []byte = []byte(`" class="username real_username">`)
|
||||
var topic_26 []byte = []byte(`</a>
|
||||
<a href="/topic/like/submit/`)
|
||||
var topic_27 []byte = []byte(`" class="mod_button" title="Love it" style="color:#202020;"><button class="username" style="`)
|
||||
var topic_28 []byte = []byte(`background-color:/*#eaffea*/#D6FFD6;`)
|
||||
var topic_29 []byte = []byte(`">😀</button></a>
|
||||
`)
|
||||
var topic_30 []byte = []byte(`<a href='/topic/edit/`)
|
||||
var topic_31 []byte = []byte(`' class="mod_button open_edit" style="font-weight:normal;" title="Edit Topic"><button class="username">🖊️</button></a>
|
||||
<a href='/topic/delete/submit/`)
|
||||
var topic_32 []byte = []byte(`' class="mod_button" style="font-weight:normal;" title="Delete Topic"><button class="username">🗑️</button></a>
|
||||
`)
|
||||
var topic_33 []byte = []byte(`<a class="mod_button" href='/topic/unstick/submit/`)
|
||||
var topic_34 []byte = []byte(`' style="font-weight:normal;" title="Unpin Topic"><button class="username" style="background-color:/*#eaffea*/#D6FFD6;">📌</button></a>`)
|
||||
var topic_35 []byte = []byte(`<a href='/topic/stick/submit/`)
|
||||
var topic_36 []byte = []byte(`' class="mod_button" style="font-weight:normal;" title="Pin Topic"><button class="username">📌</button></a>`)
|
||||
var topic_37 []byte = []byte(`
|
||||
<a href="/report/submit/`)
|
||||
var topic_38 []byte = []byte(`?session=`)
|
||||
var topic_39 []byte = []byte(`&type=topic" class="mod_button report_item" style="font-weight:normal;" title="Flag Topic"><button class="username">🚩</button></a>
|
||||
`)
|
||||
var topic_40 []byte = []byte(`<a class="username hide_on_micro" style="float: right;color:#505050;border-left:none;padding-left:5px;padding-right:5px;font-size:17px;">`)
|
||||
var topic_41 []byte = []byte(`</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;margin-left:5px;" title="Like Count">😀</a>`)
|
||||
var topic_42 []byte = []byte(`<a class="username hide_on_micro" style="float:right;color:#505050;font-size:16px;">`)
|
||||
var topic_43 []byte = []byte(`</a>`)
|
||||
var topic_44 []byte = []byte(`<a class="username hide_on_micro" style="float: right;color:#505050;border-left:none;padding-left:5px;padding-right:5px;font-size:17px;">`)
|
||||
var topic_45 []byte = []byte(`</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;" title="Level">👑</a>`)
|
||||
var topic_46 []byte = []byte(`
|
||||
</div>
|
||||
</div><br />
|
||||
<div class="rowblock post_container" style="overflow: hidden;">`)
|
||||
var topic_39 []byte = []byte(`
|
||||
var topic_47 []byte = []byte(`
|
||||
<div class="rowitem rowhead passive deletable_block editable_parent post_item" style="`)
|
||||
var topic_40 []byte = []byte(`background-image: url(`)
|
||||
var topic_41 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px `)
|
||||
var topic_42 []byte = []byte(`-1`)
|
||||
var topic_43 []byte = []byte(`0px;background-repeat: no-repeat, repeat-y;background-size: 128px;padding-left: 136px;`)
|
||||
var topic_44 []byte = []byte(`">
|
||||
var topic_48 []byte = []byte(`background-image:url(`)
|
||||
var topic_49 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px `)
|
||||
var topic_50 []byte = []byte(`-1`)
|
||||
var topic_51 []byte = []byte(`0px;background-repeat:no-repeat, repeat-y;background-size:128px;padding-left:136px;`)
|
||||
var topic_52 []byte = []byte(`">
|
||||
<p class="editable_block user_content" style="margin: 0;padding: 0;">`)
|
||||
var topic_45 []byte = []byte(`</p><br /><br />
|
||||
var topic_53 []byte = []byte(`</p><br /><br />
|
||||
<a href="/user/`)
|
||||
var topic_46 []byte = []byte(`" class="username real_username">`)
|
||||
var topic_47 []byte = []byte(`</a>
|
||||
var topic_54 []byte = []byte(`" class="username real_username">`)
|
||||
var topic_55 []byte = []byte(`</a>
|
||||
<a href="/reply/like/submit/`)
|
||||
var topic_56 []byte = []byte(`" class="mod_button" title="Love it" style="color:#202020;"><button class="username" style="`)
|
||||
var topic_57 []byte = []byte(`background-color:/*#eaffea*/#D6FFD6;`)
|
||||
var topic_58 []byte = []byte(`">😀</button></a>
|
||||
`)
|
||||
var topic_48 []byte = []byte(`<a href="/reply/edit/submit/`)
|
||||
var topic_49 []byte = []byte(`" class="mod_button"><button class="username edit_item">Edit</button></a> `)
|
||||
var topic_50 []byte = []byte(`<a href="/reply/delete/submit/`)
|
||||
var topic_51 []byte = []byte(`" class="mod_button"><button class="username delete_item">Delete</button></a> `)
|
||||
var topic_52 []byte = []byte(`
|
||||
var topic_59 []byte = []byte(`<a href="/reply/edit/submit/`)
|
||||
var topic_60 []byte = []byte(`" class="mod_button" title="Edit Reply"><button class="username edit_item">🖊️</button></a> `)
|
||||
var topic_61 []byte = []byte(`<a href="/reply/delete/submit/`)
|
||||
var topic_62 []byte = []byte(`" class="mod_button" title="Delete Reply"><button class="username delete_item">🗑️</button></a> `)
|
||||
var topic_63 []byte = []byte(`
|
||||
<a href="/report/submit/`)
|
||||
var topic_53 []byte = []byte(`?session=`)
|
||||
var topic_54 []byte = []byte(`&type=reply" class="mod_button"><button class="username report_item">Report</button></a>
|
||||
<a class="username hide_on_micro" `)
|
||||
var topic_55 []byte = []byte(`style="float: right;">`)
|
||||
var topic_56 []byte = []byte(`style="color: #505050;float: right;">Level `)
|
||||
var topic_57 []byte = []byte(`</a>
|
||||
var topic_64 []byte = []byte(`?session=`)
|
||||
var topic_65 []byte = []byte(`&type=reply" class="mod_button" title="Flag Reply"><button class="username report_item">🚩</button></a>
|
||||
`)
|
||||
var topic_66 []byte = []byte(`<a class="username hide_on_micro" style="float: right;color:#505050;border-left:none;padding-left:5px;padding-right:5px;font-size:17px;">`)
|
||||
var topic_67 []byte = []byte(`</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;margin-left:5px;" title="Like Count">😀</a>`)
|
||||
var topic_68 []byte = []byte(`<a class="username hide_on_micro" style="float: right;color:#505050;font-size:16px;">`)
|
||||
var topic_69 []byte = []byte(`</a>`)
|
||||
var topic_70 []byte = []byte(`<a class="username hide_on_micro" style="float: right;color:#505050;border-left:none;padding-left:5px;padding-right:5px;font-size:17px;">`)
|
||||
var topic_71 []byte = []byte(`</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;" title="Level">👑`)
|
||||
var topic_72 []byte = []byte(`</a>
|
||||
</div>
|
||||
`)
|
||||
var topic_58 []byte = []byte(`</div>
|
||||
var topic_73 []byte = []byte(`</div>
|
||||
`)
|
||||
var topic_59 []byte = []byte(`
|
||||
var topic_74 []byte = []byte(`
|
||||
<div class="rowblock">
|
||||
<form action="/reply/create/" method="post">
|
||||
<input name="tid" value='`)
|
||||
var topic_60 []byte = []byte(`' type="hidden" />
|
||||
var topic_75 []byte = []byte(`' type="hidden" />
|
||||
<div class="formrow">
|
||||
<div class="formitem"><textarea name="reply-content" placeholder="Insert reply here"></textarea></div>
|
||||
</div>
|
||||
|
@ -187,30 +203,31 @@ var topic_alt_12 []byte = []byte(`">
|
|||
var topic_alt_13 []byte = []byte(`</a>
|
||||
`)
|
||||
var topic_alt_14 []byte = []byte(`<span class='username hide_on_micro topic_status_e topic_status_closed hide_on_edit' title='Status: Closed' style="font-weight:normal;float: right;position:relative;top:-5px;">🔒︎</span>`)
|
||||
var topic_alt_15 []byte = []byte(`
|
||||
var topic_alt_15 []byte = []byte(`<span class='username hide_on_micro' title='Love it' style="font-weight:normal;float: right;position:relative;top:-5px;">🖤︎</span>`)
|
||||
var topic_alt_16 []byte = []byte(`
|
||||
<a href='/topic/edit/`)
|
||||
var topic_alt_16 []byte = []byte(`' class="username hide_on_edit open_edit topic_button" style="font-weight: normal;margin-left: 6px;">Edit</a>
|
||||
var topic_alt_17 []byte = []byte(`' class="username hide_on_edit open_edit topic_button" style="font-weight: normal;margin-left: 6px;">Edit</a>
|
||||
<a href='/topic/delete/submit/`)
|
||||
var topic_alt_17 []byte = []byte(`' class="username topic_button" style="font-weight: normal;">Delete</a>
|
||||
var topic_alt_18 []byte = []byte(`' class="username topic_button" style="font-weight: normal;">Delete</a>
|
||||
`)
|
||||
var topic_alt_18 []byte = []byte(`<a href='/topic/unstick/submit/`)
|
||||
var topic_alt_19 []byte = []byte(`' class="username topic_button" style="font-weight: normal;">Unpin</a>`)
|
||||
var topic_alt_20 []byte = []byte(`<a href='/topic/stick/submit/`)
|
||||
var topic_alt_21 []byte = []byte(`' class="username topic_button" style="font-weight: normal;">Pin</a>`)
|
||||
var topic_alt_22 []byte = []byte(`
|
||||
var topic_alt_19 []byte = []byte(`<a href='/topic/unstick/submit/`)
|
||||
var topic_alt_20 []byte = []byte(`' class="username topic_button" style="font-weight: normal;">Unpin</a>`)
|
||||
var topic_alt_21 []byte = []byte(`<a href='/topic/stick/submit/`)
|
||||
var topic_alt_22 []byte = []byte(`' class="username topic_button" style="font-weight: normal;">Pin</a>`)
|
||||
var topic_alt_23 []byte = []byte(`
|
||||
|
||||
<input class='show_on_edit topic_name_input' name="topic_name" value='`)
|
||||
var topic_alt_23 []byte = []byte(`' type="text" />
|
||||
var topic_alt_24 []byte = []byte(`' type="text" />
|
||||
<select name="topic_status" class='show_on_edit topic_status_input' style='float: right;'>
|
||||
<option>open</option>
|
||||
<option>closed</option>
|
||||
</select>
|
||||
<button name="topic-button" class="formbutton show_on_edit submit_edit">Update</button>
|
||||
`)
|
||||
var topic_alt_24 []byte = []byte(`
|
||||
var topic_alt_25 []byte = []byte(`
|
||||
<a href="/report/submit/`)
|
||||
var topic_alt_25 []byte = []byte(`?session=`)
|
||||
var topic_alt_26 []byte = []byte(`&type=topic" class="username report_item topic_button" style="font-weight: normal;">Report</a>
|
||||
var topic_alt_26 []byte = []byte(`?session=`)
|
||||
var topic_alt_27 []byte = []byte(`&type=topic" class="username report_item topic_button" style="font-weight: normal;">Report</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -219,75 +236,75 @@ var topic_alt_26 []byte = []byte(`&type=topic" class="username report_item topic
|
|||
<div class="rowitem passive deletable_block editable_parent post_item" style="background-color: #eaeaea;padding-top: 4px;padding-left: 5px;clear: both;border-bottom: none;padding-right: 4px;padding-bottom: 2px;">
|
||||
<div class="userinfo">
|
||||
<div class="avatar_item" style="background-image: url(`)
|
||||
var topic_alt_27 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;"> </div>
|
||||
var topic_alt_28 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;"> </div>
|
||||
<a href="/user/`)
|
||||
var topic_alt_28 []byte = []byte(`" class="the_name">`)
|
||||
var topic_alt_29 []byte = []byte(`</a>
|
||||
var topic_alt_29 []byte = []byte(`" class="the_name">`)
|
||||
var topic_alt_30 []byte = []byte(`</a>
|
||||
`)
|
||||
var topic_alt_30 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`)
|
||||
var topic_alt_31 []byte = []byte(`</div><div class="tag_post"></div></div>`)
|
||||
var topic_alt_32 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
|
||||
var topic_alt_33 []byte = []byte(`</div><div class="tag_post"></div></div>`)
|
||||
var topic_alt_34 []byte = []byte(`
|
||||
var topic_alt_31 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`)
|
||||
var topic_alt_32 []byte = []byte(`</div><div class="tag_post"></div></div>`)
|
||||
var topic_alt_33 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
|
||||
var topic_alt_34 []byte = []byte(`</div><div class="tag_post"></div></div>`)
|
||||
var topic_alt_35 []byte = []byte(`
|
||||
</div>
|
||||
<div class="content_container">
|
||||
<div class="hide_on_edit topic_content user_content">`)
|
||||
var topic_alt_35 []byte = []byte(`</div>
|
||||
var topic_alt_36 []byte = []byte(`</div>
|
||||
<textarea name="topic_content" class="show_on_edit topic_content_input">`)
|
||||
var topic_alt_36 []byte = []byte(`</textarea>
|
||||
var topic_alt_37 []byte = []byte(`</textarea>
|
||||
<div class="button_container">
|
||||
`)
|
||||
var topic_alt_37 []byte = []byte(`<a href="#" title="IP Address" class="action_button action_button_right ip_item">`)
|
||||
var topic_alt_38 []byte = []byte(`</a>`)
|
||||
var topic_alt_39 []byte = []byte(`
|
||||
var topic_alt_38 []byte = []byte(`<a href="#" title="IP Address" class="action_button action_button_right ip_item">`)
|
||||
var topic_alt_39 []byte = []byte(`</a>`)
|
||||
var topic_alt_40 []byte = []byte(`
|
||||
</div>
|
||||
</div><div style="clear:both;"></div>
|
||||
</div>
|
||||
`)
|
||||
var topic_alt_40 []byte = []byte(`
|
||||
var topic_alt_41 []byte = []byte(`
|
||||
<div class="rowitem passive deletable_block editable_parent post_item">
|
||||
<div class="userinfo">
|
||||
<div class="avatar_item" style="background-image: url(`)
|
||||
var topic_alt_41 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;"> </div>
|
||||
var topic_alt_42 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;"> </div>
|
||||
<a href="/user/`)
|
||||
var topic_alt_42 []byte = []byte(`" class="the_name">`)
|
||||
var topic_alt_43 []byte = []byte(`</a>
|
||||
var topic_alt_43 []byte = []byte(`" class="the_name">`)
|
||||
var topic_alt_44 []byte = []byte(`</a>
|
||||
`)
|
||||
var topic_alt_44 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`)
|
||||
var topic_alt_45 []byte = []byte(`</div><div class="tag_post"></div></div>`)
|
||||
var topic_alt_46 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
|
||||
var topic_alt_47 []byte = []byte(`</div><div class="tag_post"></div></div>`)
|
||||
var topic_alt_48 []byte = []byte(`
|
||||
var topic_alt_45 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`)
|
||||
var topic_alt_46 []byte = []byte(`</div><div class="tag_post"></div></div>`)
|
||||
var topic_alt_47 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
|
||||
var topic_alt_48 []byte = []byte(`</div><div class="tag_post"></div></div>`)
|
||||
var topic_alt_49 []byte = []byte(`
|
||||
</div>
|
||||
<div class="content_container">
|
||||
<div class="editable_block user_content">`)
|
||||
var topic_alt_49 []byte = []byte(`</div>
|
||||
var topic_alt_50 []byte = []byte(`</div>
|
||||
<div class="button_container">
|
||||
`)
|
||||
var topic_alt_50 []byte = []byte(`<a href="/reply/edit/submit/`)
|
||||
var topic_alt_51 []byte = []byte(`" class="action_button edit_item">Edit</a>`)
|
||||
var topic_alt_52 []byte = []byte(`<a href="/reply/delete/submit/`)
|
||||
var topic_alt_53 []byte = []byte(`" class="action_button delete_item">Delete</a>`)
|
||||
var topic_alt_54 []byte = []byte(`
|
||||
var topic_alt_51 []byte = []byte(`<a href="/reply/edit/submit/`)
|
||||
var topic_alt_52 []byte = []byte(`" class="action_button edit_item">Edit</a>`)
|
||||
var topic_alt_53 []byte = []byte(`<a href="/reply/delete/submit/`)
|
||||
var topic_alt_54 []byte = []byte(`" class="action_button delete_item">Delete</a>`)
|
||||
var topic_alt_55 []byte = []byte(`
|
||||
<a href="/report/submit/`)
|
||||
var topic_alt_55 []byte = []byte(`?session=`)
|
||||
var topic_alt_56 []byte = []byte(`&type=reply" class="action_button report_item">Report</a>
|
||||
var topic_alt_56 []byte = []byte(`?session=`)
|
||||
var topic_alt_57 []byte = []byte(`&type=reply" class="action_button report_item">Report</a>
|
||||
`)
|
||||
var topic_alt_57 []byte = []byte(`<a href="#" title="IP Address" class="action_button action_button_right ip_item">`)
|
||||
var topic_alt_58 []byte = []byte(`</a>`)
|
||||
var topic_alt_59 []byte = []byte(`
|
||||
var topic_alt_58 []byte = []byte(`<a href="#" title="IP Address" class="action_button action_button_right ip_item">`)
|
||||
var topic_alt_59 []byte = []byte(`</a>`)
|
||||
var topic_alt_60 []byte = []byte(`
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
`)
|
||||
var topic_alt_60 []byte = []byte(`</div>
|
||||
var topic_alt_61 []byte = []byte(`</div>
|
||||
`)
|
||||
var topic_alt_61 []byte = []byte(`
|
||||
var topic_alt_62 []byte = []byte(`
|
||||
<div class="rowblock" style="border-top: none;">
|
||||
<form action="/reply/create/" method="post">
|
||||
<input name="tid" value='`)
|
||||
var topic_alt_62 []byte = []byte(`' type="hidden" />
|
||||
var topic_alt_63 []byte = []byte(`' type="hidden" />
|
||||
<div class="formrow">
|
||||
<div class="formitem"><textarea name="reply-content" placeholder="Insert reply here"></textarea></div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||
package main
|
||||
import "strconv"
|
||||
import "io"
|
||||
import "strconv"
|
||||
|
||||
func init() {
|
||||
template_profile_handle = template_profile
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||
package main
|
||||
import "io"
|
||||
import "strconv"
|
||||
import "html/template"
|
||||
import "io"
|
||||
|
||||
func init() {
|
||||
template_topic_handle = template_topic
|
||||
|
@ -77,105 +77,134 @@ w.Write(topic_14)
|
|||
}
|
||||
if tmpl_topic_vars.CurrentUser.Is_Mod {
|
||||
w.Write(topic_15)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_16)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_17)
|
||||
if tmpl_topic_vars.Topic.Sticky {
|
||||
w.Write(topic_18)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_19)
|
||||
} else {
|
||||
w.Write(topic_20)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_21)
|
||||
}
|
||||
w.Write(topic_22)
|
||||
w.Write([]byte(tmpl_topic_vars.Topic.Title))
|
||||
w.Write(topic_23)
|
||||
w.Write(topic_16)
|
||||
}
|
||||
w.Write(topic_24)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_25)
|
||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||
w.Write(topic_26)
|
||||
w.Write(topic_17)
|
||||
if tmpl_topic_vars.Topic.Avatar != "" {
|
||||
w.Write(topic_27)
|
||||
w.Write(topic_18)
|
||||
w.Write([]byte(tmpl_topic_vars.Topic.Avatar))
|
||||
w.Write(topic_28)
|
||||
w.Write(topic_19)
|
||||
if tmpl_topic_vars.Topic.ContentLines <= 5 {
|
||||
w.Write(topic_29)
|
||||
w.Write(topic_20)
|
||||
}
|
||||
w.Write(topic_30)
|
||||
w.Write(topic_21)
|
||||
w.Write([]byte(string(tmpl_topic_vars.Topic.Css)))
|
||||
}
|
||||
w.Write(topic_31)
|
||||
w.Write(topic_22)
|
||||
w.Write([]byte(string(tmpl_topic_vars.Topic.Content.(template.HTML))))
|
||||
w.Write(topic_32)
|
||||
w.Write(topic_23)
|
||||
w.Write([]byte(string(tmpl_topic_vars.Topic.Content.(template.HTML))))
|
||||
w.Write(topic_33)
|
||||
w.Write(topic_24)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.CreatedBy)))
|
||||
w.Write(topic_34)
|
||||
w.Write(topic_25)
|
||||
w.Write([]byte(tmpl_topic_vars.Topic.CreatedByName))
|
||||
w.Write(topic_35)
|
||||
if tmpl_topic_vars.Topic.Tag != "" {
|
||||
w.Write(topic_36)
|
||||
w.Write([]byte(tmpl_topic_vars.Topic.Tag))
|
||||
} else {
|
||||
w.Write(topic_37)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level)))
|
||||
w.Write(topic_26)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_27)
|
||||
if tmpl_topic_vars.Topic.Liked {
|
||||
w.Write(topic_28)
|
||||
}
|
||||
w.Write(topic_29)
|
||||
if tmpl_topic_vars.CurrentUser.Is_Mod {
|
||||
w.Write(topic_30)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_31)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_32)
|
||||
if tmpl_topic_vars.Topic.Sticky {
|
||||
w.Write(topic_33)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_34)
|
||||
} else {
|
||||
w.Write(topic_35)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_36)
|
||||
}
|
||||
}
|
||||
w.Write(topic_37)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_38)
|
||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||
w.Write(topic_39)
|
||||
if tmpl_topic_vars.Topic.LikeCount > 0 {
|
||||
w.Write(topic_40)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.LikeCount)))
|
||||
w.Write(topic_41)
|
||||
}
|
||||
if tmpl_topic_vars.Topic.Tag != "" {
|
||||
w.Write(topic_42)
|
||||
w.Write([]byte(tmpl_topic_vars.Topic.Tag))
|
||||
w.Write(topic_43)
|
||||
} else {
|
||||
w.Write(topic_44)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level)))
|
||||
w.Write(topic_45)
|
||||
}
|
||||
w.Write(topic_46)
|
||||
if len(tmpl_topic_vars.ItemList) != 0 {
|
||||
for _, item := range tmpl_topic_vars.ItemList {
|
||||
w.Write(topic_39)
|
||||
w.Write(topic_47)
|
||||
if item.Avatar != "" {
|
||||
w.Write(topic_40)
|
||||
w.Write(topic_48)
|
||||
w.Write([]byte(item.Avatar))
|
||||
w.Write(topic_41)
|
||||
w.Write(topic_49)
|
||||
if item.ContentLines <= 5 {
|
||||
w.Write(topic_42)
|
||||
w.Write(topic_50)
|
||||
}
|
||||
w.Write(topic_43)
|
||||
w.Write(topic_51)
|
||||
w.Write([]byte(string(item.Css)))
|
||||
}
|
||||
w.Write(topic_44)
|
||||
w.Write([]byte(string(item.ContentHtml)))
|
||||
w.Write(topic_45)
|
||||
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
|
||||
w.Write(topic_46)
|
||||
w.Write([]byte(item.CreatedByName))
|
||||
w.Write(topic_47)
|
||||
if tmpl_topic_vars.CurrentUser.Perms.EditReply {
|
||||
w.Write(topic_48)
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write(topic_49)
|
||||
}
|
||||
if tmpl_topic_vars.CurrentUser.Perms.DeleteReply {
|
||||
w.Write(topic_50)
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write(topic_51)
|
||||
}
|
||||
w.Write(topic_52)
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write([]byte(string(item.ContentHtml)))
|
||||
w.Write(topic_53)
|
||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
|
||||
w.Write(topic_54)
|
||||
if item.Tag != "" {
|
||||
w.Write([]byte(item.CreatedByName))
|
||||
w.Write(topic_55)
|
||||
w.Write([]byte(item.Tag))
|
||||
} else {
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write(topic_56)
|
||||
w.Write([]byte(strconv.Itoa(item.Level)))
|
||||
}
|
||||
if item.Liked {
|
||||
w.Write(topic_57)
|
||||
}
|
||||
}
|
||||
w.Write(topic_58)
|
||||
if tmpl_topic_vars.CurrentUser.Perms.CreateReply {
|
||||
if tmpl_topic_vars.CurrentUser.Perms.EditReply {
|
||||
w.Write(topic_59)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write(topic_60)
|
||||
}
|
||||
if tmpl_topic_vars.CurrentUser.Perms.DeleteReply {
|
||||
w.Write(topic_61)
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write(topic_62)
|
||||
}
|
||||
w.Write(topic_63)
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write(topic_64)
|
||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||
w.Write(topic_65)
|
||||
if item.LikeCount > 0 {
|
||||
w.Write(topic_66)
|
||||
w.Write([]byte(strconv.Itoa(item.LikeCount)))
|
||||
w.Write(topic_67)
|
||||
}
|
||||
if item.Tag != "" {
|
||||
w.Write(topic_68)
|
||||
w.Write([]byte(item.Tag))
|
||||
w.Write(topic_69)
|
||||
} else {
|
||||
w.Write(topic_70)
|
||||
w.Write([]byte(strconv.Itoa(item.Level)))
|
||||
w.Write(topic_71)
|
||||
}
|
||||
w.Write(topic_72)
|
||||
}
|
||||
}
|
||||
w.Write(topic_73)
|
||||
if tmpl_topic_vars.CurrentUser.Perms.CreateReply {
|
||||
w.Write(topic_74)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||
w.Write(topic_75)
|
||||
}
|
||||
w.Write(footer_0)
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||
package main
|
||||
import "html/template"
|
||||
import "io"
|
||||
import "strconv"
|
||||
import "html/template"
|
||||
|
||||
func init() {
|
||||
template_topic_alt_handle = template_topic_alt
|
||||
|
@ -74,106 +74,108 @@ w.Write([]byte(tmpl_topic_alt_vars.Topic.Title))
|
|||
w.Write(topic_alt_13)
|
||||
if tmpl_topic_alt_vars.Topic.Is_Closed {
|
||||
w.Write(topic_alt_14)
|
||||
} else {
|
||||
w.Write(topic_alt_15)
|
||||
}
|
||||
if tmpl_topic_alt_vars.CurrentUser.Is_Mod {
|
||||
w.Write(topic_alt_15)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
w.Write(topic_alt_16)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
w.Write(topic_alt_17)
|
||||
if tmpl_topic_alt_vars.Topic.Sticky {
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
w.Write(topic_alt_18)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
if tmpl_topic_alt_vars.Topic.Sticky {
|
||||
w.Write(topic_alt_19)
|
||||
} else {
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
w.Write(topic_alt_20)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
w.Write(topic_alt_21)
|
||||
}
|
||||
w.Write(topic_alt_22)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.Title))
|
||||
w.Write(topic_alt_23)
|
||||
}
|
||||
w.Write(topic_alt_24)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
w.Write(topic_alt_25)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||
w.Write(topic_alt_26)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar))
|
||||
w.Write(topic_alt_27)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.CreatedBy)))
|
||||
w.Write(topic_alt_28)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName))
|
||||
w.Write(topic_alt_29)
|
||||
if tmpl_topic_alt_vars.Topic.Tag != "" {
|
||||
w.Write(topic_alt_30)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag))
|
||||
w.Write(topic_alt_31)
|
||||
} else {
|
||||
w.Write(topic_alt_32)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level)))
|
||||
w.Write(topic_alt_33)
|
||||
w.Write(topic_alt_21)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
w.Write(topic_alt_22)
|
||||
}
|
||||
w.Write(topic_alt_23)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.Title))
|
||||
w.Write(topic_alt_24)
|
||||
}
|
||||
w.Write(topic_alt_25)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
w.Write(topic_alt_26)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||
w.Write(topic_alt_27)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar))
|
||||
w.Write(topic_alt_28)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.CreatedBy)))
|
||||
w.Write(topic_alt_29)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName))
|
||||
w.Write(topic_alt_30)
|
||||
if tmpl_topic_alt_vars.Topic.Tag != "" {
|
||||
w.Write(topic_alt_31)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag))
|
||||
w.Write(topic_alt_32)
|
||||
} else {
|
||||
w.Write(topic_alt_33)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level)))
|
||||
w.Write(topic_alt_34)
|
||||
w.Write([]byte(string(tmpl_topic_alt_vars.Topic.Content.(template.HTML))))
|
||||
}
|
||||
w.Write(topic_alt_35)
|
||||
w.Write([]byte(string(tmpl_topic_alt_vars.Topic.Content.(template.HTML))))
|
||||
w.Write(topic_alt_36)
|
||||
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
|
||||
w.Write([]byte(string(tmpl_topic_alt_vars.Topic.Content.(template.HTML))))
|
||||
w.Write(topic_alt_37)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.IpAddress))
|
||||
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
|
||||
w.Write(topic_alt_38)
|
||||
}
|
||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.IpAddress))
|
||||
w.Write(topic_alt_39)
|
||||
}
|
||||
w.Write(topic_alt_40)
|
||||
if len(tmpl_topic_alt_vars.ItemList) != 0 {
|
||||
for _, item := range tmpl_topic_alt_vars.ItemList {
|
||||
w.Write(topic_alt_40)
|
||||
w.Write([]byte(item.Avatar))
|
||||
w.Write(topic_alt_41)
|
||||
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
|
||||
w.Write([]byte(item.Avatar))
|
||||
w.Write(topic_alt_42)
|
||||
w.Write([]byte(item.CreatedByName))
|
||||
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
|
||||
w.Write(topic_alt_43)
|
||||
if item.Tag != "" {
|
||||
w.Write([]byte(item.CreatedByName))
|
||||
w.Write(topic_alt_44)
|
||||
w.Write([]byte(item.Tag))
|
||||
if item.Tag != "" {
|
||||
w.Write(topic_alt_45)
|
||||
} else {
|
||||
w.Write([]byte(item.Tag))
|
||||
w.Write(topic_alt_46)
|
||||
w.Write([]byte(strconv.Itoa(item.Level)))
|
||||
} else {
|
||||
w.Write(topic_alt_47)
|
||||
}
|
||||
w.Write([]byte(strconv.Itoa(item.Level)))
|
||||
w.Write(topic_alt_48)
|
||||
w.Write([]byte(string(item.ContentHtml)))
|
||||
}
|
||||
w.Write(topic_alt_49)
|
||||
if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply {
|
||||
w.Write([]byte(string(item.ContentHtml)))
|
||||
w.Write(topic_alt_50)
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply {
|
||||
w.Write(topic_alt_51)
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write(topic_alt_52)
|
||||
}
|
||||
if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply {
|
||||
w.Write(topic_alt_52)
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write(topic_alt_53)
|
||||
}
|
||||
w.Write(topic_alt_54)
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write(topic_alt_55)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||
w.Write(topic_alt_56)
|
||||
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
|
||||
w.Write(topic_alt_57)
|
||||
w.Write([]byte(item.IpAddress))
|
||||
w.Write(topic_alt_58)
|
||||
w.Write(topic_alt_54)
|
||||
}
|
||||
w.Write(topic_alt_55)
|
||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||
w.Write(topic_alt_56)
|
||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||
w.Write(topic_alt_57)
|
||||
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
|
||||
w.Write(topic_alt_58)
|
||||
w.Write([]byte(item.IpAddress))
|
||||
w.Write(topic_alt_59)
|
||||
}
|
||||
}
|
||||
w.Write(topic_alt_60)
|
||||
if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply {
|
||||
}
|
||||
}
|
||||
w.Write(topic_alt_61)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply {
|
||||
w.Write(topic_alt_62)
|
||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||
w.Write(topic_alt_63)
|
||||
}
|
||||
w.Write(footer_0)
|
||||
}
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
<a class='topic_name hide_on_edit'>{{.Topic.Title}}</a>
|
||||
{{if .Topic.Is_Closed}}<span class='username hide_on_micro topic_status_e topic_status_closed hide_on_edit' title='Status: Closed' style="font-weight:normal;float: right;position:relative;top:-5px;">🔒︎</span>{{end}}
|
||||
{{if .CurrentUser.Is_Mod}}
|
||||
<a href='/topic/edit/{{.Topic.ID}}' class="username hide_on_edit open_edit" style="font-weight: normal;margin-left: 6px;">Edit</a>
|
||||
<a href='/topic/delete/submit/{{.Topic.ID}}' class="username" style="font-weight: normal;">Delete</a>
|
||||
{{if .Topic.Sticky}}<a href='/topic/unstick/submit/{{.Topic.ID}}' class="username" style="font-weight: normal;">Unpin</a>{{else}}<a href='/topic/stick/submit/{{.Topic.ID}}' class="username" style="font-weight: normal;">Pin</a>{{end}}
|
||||
|
||||
<input class='show_on_edit topic_name_input' name="topic_name" value='{{.Topic.Title}}' type="text" />
|
||||
<select name="topic_status" class='show_on_edit topic_status_input' style='float: right;'>
|
||||
<option>open</option>
|
||||
|
@ -19,7 +15,6 @@
|
|||
</select>
|
||||
<button name="topic-button" class="formbutton show_on_edit submit_edit">Update</button>
|
||||
{{end}}
|
||||
<a href="/report/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}&type=topic" class="username report_item" style="font-weight: normal;">Report</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -28,17 +23,26 @@
|
|||
<p class="hide_on_edit topic_content user_content" style="margin:0;padding:0;">{{.Topic.Content}}</p>
|
||||
<textarea name="topic_content" class="show_on_edit topic_content_input">{{.Topic.Content}}</textarea><br /><br />
|
||||
<a href="/user/{{.Topic.CreatedBy}}" class="username real_username">{{.Topic.CreatedByName}}</a>
|
||||
<a class="username hide_on_micro" {{if .Topic.Tag}}style="float: right;">{{.Topic.Tag}}{{else}}style="color: #505050;float: right;">Level {{.Topic.Level}}{{end}}</a>
|
||||
<a href="/topic/like/submit/{{.Topic.ID}}" class="mod_button" title="Love it" style="color:#202020;"><button class="username" style="{{if .Topic.Liked}}background-color:/*#eaffea*/#D6FFD6;{{end}}">😀</button></a>
|
||||
{{if .CurrentUser.Is_Mod}}<a href='/topic/edit/{{.Topic.ID}}' class="mod_button open_edit" style="font-weight:normal;" title="Edit Topic"><button class="username">🖊️</button></a>
|
||||
<a href='/topic/delete/submit/{{.Topic.ID}}' class="mod_button" style="font-weight:normal;" title="Delete Topic"><button class="username">🗑️</button></a>
|
||||
{{if .Topic.Sticky}}<a class="mod_button" href='/topic/unstick/submit/{{.Topic.ID}}' style="font-weight:normal;" title="Unpin Topic"><button class="username" style="background-color:/*#eaffea*/#D6FFD6;">📌</button></a>{{else}}<a href='/topic/stick/submit/{{.Topic.ID}}' class="mod_button" style="font-weight:normal;" title="Pin Topic"><button class="username">📌</button></a>{{end}}
|
||||
{{end}}
|
||||
<a href="/report/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}&type=topic" class="mod_button report_item" style="font-weight:normal;" title="Flag Topic"><button class="username">🚩</button></a>
|
||||
{{if .Topic.LikeCount}}<a class="username hide_on_micro" style="float: right;color:#505050;border-left:none;padding-left:5px;padding-right:5px;font-size:17px;">{{.Topic.LikeCount}}</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;margin-left:5px;" title="Like Count">😀</a>{{end}}
|
||||
{{if .Topic.Tag}}<a class="username hide_on_micro" style="float:right;color:#505050;font-size:16px;">{{.Topic.Tag}}</a>{{else}}<a class="username hide_on_micro" style="float: right;color:#505050;border-left:none;padding-left:5px;padding-right:5px;font-size:17px;">{{.Topic.Level}}</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;" title="Level">👑</a>{{end}}
|
||||
</div>
|
||||
</div><br />
|
||||
<div class="rowblock post_container" style="overflow: hidden;">{{range .ItemList}}
|
||||
<div class="rowitem rowhead passive deletable_block editable_parent post_item" style="{{if .Avatar}}background-image:url({{.Avatar}}), url(/static/white-dot.jpg);background-position: 0px {{if le .ContentLines 5}}-1{{end}}0px;background-repeat:no-repeat, repeat-y;background-size:128px;padding-left:136px;{{.Css}}{{end}}">
|
||||
<p class="editable_block user_content" style="margin: 0;padding: 0;">{{.ContentHtml}}</p><br /><br />
|
||||
<a href="/user/{{.CreatedBy}}" class="username real_username">{{.CreatedByName}}</a>
|
||||
{{if $.CurrentUser.Perms.EditReply}}<a href="/reply/edit/submit/{{.ID}}" class="mod_button"><button class="username edit_item">Edit</button></a> {{end}}
|
||||
{{if $.CurrentUser.Perms.DeleteReply}}<a href="/reply/delete/submit/{{.ID}}" class="mod_button"><button class="username delete_item">Delete</button></a> {{end}}
|
||||
<a href="/report/submit/{{.ID}}?session={{$.CurrentUser.Session}}&type=reply" class="mod_button"><button class="username report_item">Report</button></a>
|
||||
<a class="username hide_on_micro" {{if .Tag}}style="float: right;">{{.Tag}}{{else}}style="color: #505050;float: right;">Level {{.Level}}{{end}}</a>
|
||||
<a href="/reply/like/submit/{{.ID}}" class="mod_button" title="Love it" style="color:#202020;"><button class="username" style="{{if .Liked}}background-color:/*#eaffea*/#D6FFD6;{{end}}">😀</button></a>
|
||||
{{if $.CurrentUser.Perms.EditReply}}<a href="/reply/edit/submit/{{.ID}}" class="mod_button" title="Edit Reply"><button class="username edit_item">🖊️</button></a> {{end}}
|
||||
{{if $.CurrentUser.Perms.DeleteReply}}<a href="/reply/delete/submit/{{.ID}}" class="mod_button" title="Delete Reply"><button class="username delete_item">🗑️</button></a> {{end}}
|
||||
<a href="/report/submit/{{.ID}}?session={{$.CurrentUser.Session}}&type=reply" class="mod_button" title="Flag Reply"><button class="username report_item">🚩</button></a>
|
||||
{{if .LikeCount}}<a class="username hide_on_micro" style="float: right;color:#505050;border-left:none;padding-left:5px;padding-right:5px;font-size:17px;">{{.LikeCount}}</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;margin-left:5px;" title="Like Count">😀</a>{{end}}
|
||||
{{if .Tag}}<a class="username hide_on_micro" style="float: right;color:#505050;font-size:16px;">{{.Tag}}</a>{{else}}<a class="username hide_on_micro" style="float: right;color:#505050;border-left:none;padding-left:5px;padding-right:5px;font-size:17px;">{{.Level}}</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;" title="Level">👑{{end}}</a>
|
||||
</div>
|
||||
{{end}}</div>
|
||||
{{if .CurrentUser.Perms.CreateReply}}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<form action='/topic/edit/submit/{{.Topic.ID}}' method="post">
|
||||
<div class="rowitem topic_item rowhead{{if .Topic.Sticky}} topic_sticky_head{{else if .Topic.Is_Closed}} topic_closed_head{{end}}">
|
||||
<a class='topic_name hide_on_edit'>{{.Topic.Title}}</a>
|
||||
{{if .Topic.Is_Closed}}<span class='username hide_on_micro topic_status_e topic_status_closed hide_on_edit' title='Status: Closed' style="font-weight:normal;float: right;position:relative;top:-5px;">🔒︎</span>{{end}}
|
||||
{{if .Topic.Is_Closed}}<span class='username hide_on_micro topic_status_e topic_status_closed hide_on_edit' title='Status: Closed' style="font-weight:normal;float: right;position:relative;top:-5px;">🔒︎</span>{{else}}<span class='username hide_on_micro' title='Love it' style="font-weight:normal;float: right;position:relative;top:-5px;">🖤︎</span>{{end}}
|
||||
{{if .CurrentUser.Is_Mod}}
|
||||
<a href='/topic/edit/{{.Topic.ID}}' class="username hide_on_edit open_edit topic_button" style="font-weight: normal;margin-left: 6px;">Edit</a>
|
||||
<a href='/topic/delete/submit/{{.Topic.ID}}' class="username topic_button" style="font-weight: normal;">Delete</a>
|
||||
|
|
|
@ -105,7 +105,7 @@ func add_theme_static_files(themeName string) {
|
|||
path = strings.TrimPrefix(path,"themes/" + themeName + "/public")
|
||||
log.Print("Added the '" + path + "' static file for default theme " + themeName + ".")
|
||||
|
||||
static_files["/static" + path] = SFile{data,0,int64(len(data)),mime.TypeByExtension(filepath.Ext("/themes/" + themeName + "/public" + path)),f,f.ModTime().UTC().Format(http.TimeFormat)}
|
||||
static_files["/static" + path] = SFile{data,compress_bytes_gzip(data),0,int64(len(data)),mime.TypeByExtension(filepath.Ext("/themes/" + themeName + "/public" + path)),f,f.ModTime().UTC().Format(http.TimeFormat)}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
@ -179,20 +179,9 @@ li a
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.formitem:first-child
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.formitem:not(:last-child)
|
||||
{
|
||||
border-right: 1px dotted #ccc;
|
||||
}
|
||||
|
||||
.formitem.invisible_border
|
||||
{
|
||||
border: none;
|
||||
}
|
||||
.formitem:first-child { font-weight: bold; }
|
||||
.formitem:not(:last-child) { border-right: 1px dotted #ccc; }
|
||||
.formitem.invisible_border { border: none; }
|
||||
|
||||
/* Mostly for textareas */
|
||||
.formitem:only-child { width: 100%; }
|
||||
|
@ -250,6 +239,8 @@ button.username
|
|||
top: -0.25px;
|
||||
}
|
||||
.username.level { color: #303030; }
|
||||
.username.real_username { color: #404040; font-size: 17px; }
|
||||
.username.real_username:hover { color: black; }
|
||||
.tag-mini
|
||||
{
|
||||
text-transform: none;
|
||||
|
@ -266,6 +257,15 @@ button.username
|
|||
font-size: 10px;
|
||||
}
|
||||
|
||||
.post_item > .mod_button > button {
|
||||
font-size: 15px;
|
||||
color: #202020;
|
||||
opacity: 0.7;
|
||||
}
|
||||
.post_item > .mod_button > button:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.show_on_edit { display: none; }
|
||||
.alert
|
||||
{
|
||||
|
@ -335,10 +335,7 @@ button.username
|
|||
font-weight: normal;
|
||||
text-transform: none;
|
||||
}
|
||||
.rowitem
|
||||
{
|
||||
text-transform: none;
|
||||
}
|
||||
.rowitem { text-transform: none; }
|
||||
}
|
||||
|
||||
@media (max-width: 620px) {
|
||||
|
@ -381,6 +378,9 @@ button.username
|
|||
position: relative;
|
||||
top: -14px;
|
||||
}
|
||||
.post_item > .mod_button > button {
|
||||
opacity: 1;
|
||||
}
|
||||
.post_item > .real_username {
|
||||
position: absolute;
|
||||
top: 70px;
|
||||
|
|
3
topic.go
3
topic.go
|
@ -30,6 +30,7 @@ type TopicUser struct
|
|||
Status string // Deprecated. Marked for removal.
|
||||
IpAddress string
|
||||
PostCount int
|
||||
LikeCount int
|
||||
|
||||
CreatedByName string
|
||||
Avatar string
|
||||
|
@ -40,6 +41,7 @@ type TopicUser struct
|
|||
URLPrefix string
|
||||
URLName string
|
||||
Level int
|
||||
Liked bool
|
||||
}
|
||||
|
||||
type TopicsRow struct
|
||||
|
@ -56,6 +58,7 @@ type TopicsRow struct
|
|||
Status string // Deprecated. Marked for removal.
|
||||
IpAddress string
|
||||
PostCount int
|
||||
LikeCount int
|
||||
|
||||
CreatedByName string
|
||||
Avatar string
|
||||
|
|
17
user.go
17
user.go
|
@ -82,6 +82,7 @@ func SimpleForumSessionCheck(w http.ResponseWriter, r *http.Request, fid int) (u
|
|||
fperms := groups[user.Group].Forums[fid]
|
||||
if fperms.Overrides && !user.Is_Super_Admin {
|
||||
user.Perms.ViewTopic = fperms.ViewTopic
|
||||
user.Perms.LikeItem = fperms.LikeItem
|
||||
user.Perms.CreateTopic = fperms.CreateTopic
|
||||
user.Perms.EditTopic = fperms.EditTopic
|
||||
user.Perms.DeleteTopic = fperms.DeleteTopic
|
||||
|
@ -103,6 +104,7 @@ func ForumSessionCheck(w http.ResponseWriter, r *http.Request, fid int) (user Us
|
|||
fperms := groups[user.Group].Forums[fid]
|
||||
if fperms.Overrides && !user.Is_Super_Admin {
|
||||
user.Perms.ViewTopic = fperms.ViewTopic
|
||||
user.Perms.LikeItem = fperms.LikeItem
|
||||
user.Perms.CreateTopic = fperms.CreateTopic
|
||||
user.Perms.EditTopic = fperms.EditTopic
|
||||
user.Perms.DeleteTopic = fperms.DeleteTopic
|
||||
|
@ -198,6 +200,21 @@ func SimpleSessionCheck(w http.ResponseWriter, r *http.Request) (user User, succ
|
|||
return user, true
|
||||
}
|
||||
|
||||
func words_to_score(wcount int, topic bool) (score int) {
|
||||
if topic {
|
||||
score = 2
|
||||
} else {
|
||||
score = 1
|
||||
}
|
||||
|
||||
if wcount > settings["megapost_min_chars"].(int) {
|
||||
score += 4
|
||||
} else if wcount > settings["bigpost_min_chars"].(int) {
|
||||
score += 1
|
||||
}
|
||||
return score
|
||||
}
|
||||
|
||||
func increase_post_user_stats(wcount int, uid int, topic bool, user User) error {
|
||||
var mod int
|
||||
base_score := 1
|
||||
|
|
5
utils.go
5
utils.go
|
@ -122,6 +122,9 @@ func write_file(name string, content string) {
|
|||
|
||||
func word_count(input string) (count int) {
|
||||
input = strings.TrimSpace(input)
|
||||
if input == "" {
|
||||
return 0
|
||||
}
|
||||
in_space := false
|
||||
for _, value := range input {
|
||||
if unicode.IsSpace(value) {
|
||||
|
@ -133,7 +136,7 @@ func word_count(input string) (count int) {
|
|||
in_space = false
|
||||
}
|
||||
}
|
||||
return count
|
||||
return count + 1
|
||||
}
|
||||
|
||||
func getLevel(score int) (level int) {
|
||||
|
|
Loading…
Reference in New Issue