Added pagination for forums.

You can now use the left and right keyboard keys to go to the next and previous page.
Making the shell files a little friendlier. Needs testing.
The main executable will always be named gosora.exe or the Linux equivalent ./Gosora
Reports is now a physical forum and not a "virtual" one.
Added create_forum() and delete_forum() for creating and deleting forums.
Synced the installer's config.go with the main one.
Forums are now stored in slices rather than maps for improved performance and concurrency.
You can now set a forum as hidden when initially creating it.
BBCode tag names may only be seven characters long now. This is part of a new anti-overflow measure that's much faster and simpler than the previous one.
Updated the last block of code in routes.go which uses the antiquated "success = 0" error detection method.
Fixed a visual bug in the Control Panel CSS.
Seperated the system forums from the normal ones in the Forum Manager.
You can now see if a forum is marked as Hidden in the Forum Manager.
Fixed the position of the lock status indicator.
IP Addresses now have a simple title attribute explaining that this long incomprehensible string is in fact an IP Address.
Textareas look a little better now.
Next / Previous buttons are now visible on mobile.
.bat files always say what they're doing now.
This commit is contained in:
Azareal 2017-01-26 13:37:50 +00:00
parent 16bc3a82e2
commit 5e3b61d910
38 changed files with 626 additions and 440 deletions

View File

@ -2,7 +2,7 @@
A super fast forum software written in Go.
The initial code-base was forked from one of my side projects, but has now gone far beyond that.
The initial code-base was forked from one of my side projects, but has now gone far beyond that. We're still fairly early in development, so the code-base might change at an incredible rate. We plan to start stabilising it somewhat once we enter alpha.
Azareal's Discord Chat: https://discord.gg/eyYvtTf
@ -106,7 +106,7 @@ We're looking for ways to clean-up the plugin system so that all of them (except
# Dependencies
Go 1.7
* Go 1.7
* MariaDB
@ -120,6 +120,6 @@ There are several plugins which are bundled with the software by default. These
* Hello World / Skeleton - Example plugins for helping you learn how to develop plugins.
* BBCode - A plugin in early development for converting BBCode Tags into HTML. Don't use this in production yet.
* BBCode - A plugin in early development for converting BBCode Tags into HTML.
* Markdown - An extremely simple plugin for converting Markdown into HTML.

View File

@ -37,4 +37,4 @@ Add support for multi-factor authentication.
Add support for secondary emails for users.
Improve the shell scripts and possibly add support for Make?
Improve the shell scripts and possibly add support for Make? A make.go might be a good solution?

View File

@ -1,2 +1,4 @@
go build
echo "Building Gosora"
go build -o Gosora
echo "Building the installer"
go build ./install

View File

@ -7,7 +7,7 @@ if %errorlevel% neq 0 (
)
echo Building the executable
go build
go build -o gosora.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%

View File

@ -30,6 +30,7 @@ var enable_ssl = false
var ssl_privkey = ""
var ssl_fullchain = ""
// Developer flag
// Developer flags
var debug = false
var profiling = false

View File

@ -47,6 +47,7 @@ CREATE TABLE `forums`(
`fid` int not null AUTO_INCREMENT,
`name` varchar(100) not null,
`active` tinyint DEFAULT 1 not null,
`topicCount` int DEFAULT 0 not null,
`lastTopic` varchar(100) DEFAULT '' not null,
`lastTopicID` int DEFAULT 0 not null,
`lastReplyer` varchar(100) DEFAULT '' not null,
@ -169,6 +170,7 @@ INSERT INTO users_groups(`name`,`permissions`) VALUES ('Member','{"BanUsers":fal
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 forums(`name`,`active`) VALUES ('Reports',0);
INSERT INTO forums(`name`,`lastTopicTime`) VALUES ('General',NOW());
INSERT INTO topics(`title`,`content`,`createdAt`,`lastReplyAt`,`createdBy`,`parentID`)
VALUES ('Test Topic','A topic automatically generated by the software.',NOW(),NOW(),1,1);

View File

@ -1,10 +1,13 @@
package main
import "database/sql"
import _ "github.com/go-sql-driver/mysql"
type Forum struct
{
ID int
Name string
Active bool
TopicCount int
LastTopic string
LastTopicID int
LastReplyer string
@ -18,3 +21,42 @@ type ForumSimple struct
Name string
Active bool
}
func create_forum(forum_name string, active bool) (int, error) {
var fid int
err := forum_entry_exists_stmt.QueryRow().Scan(&fid)
if err != nil && err != sql.ErrNoRows {
return 0, err
}
if err != sql.ErrNoRows {
_, err = update_forum_stmt.Exec(forum_name, active, fid)
if err != nil {
return fid, err
}
forums[fid].Name = forum_name
forums[fid].Active = active
return fid, nil
}
res, err := create_forum_stmt.Exec(forum_name, active)
if err != nil {
return 0, err
}
fid64, err := res.LastInsertId()
if err != nil {
return 0, err
}
forums = append(forums, Forum{int(fid64),forum_name,active,0,"",0,"",0,""})
return fid, nil
}
func delete_forum(fid int) error {
_, err := delete_forum_stmt.Exec(fid)
if err != nil {
return err
}
forums[fid].Name = ""
return nil
}

BIN
images/forum_manager.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,5 +1,10 @@
echo "Installing the MySQL Driver"
go get -u github.com/go-sql-driver/mysql
echo "Installing bcrypt"
go get -u golang.org/x/crypto/bcrypt
go build
echo "Preparing the installer"
go generate
go build -o Gosora
go build ./install
./Install

View File

@ -12,6 +12,11 @@ if %errorlevel% neq 0 (
)
echo Preparing the installer
go generate
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
go build
if %errorlevel% neq 0 (
pause

View File

@ -160,7 +160,7 @@ var site_email = "" // Should be a setting
var smtp_server = ""
//var noavatar = "https://api.adorable.io/avatars/{width}/{id}@{site_url}.png"
var noavatar = "https://api.adorable.io/avatars/285/{id}@" + site_url + ".png"
var items_per_page = 40 // Should be a setting
var items_per_page = 25
var site_url = "` + site_url + `"
var server_port = "` + server_port + `"
@ -170,6 +170,7 @@ var ssl_fullchain = ""
// Developer flag
var debug = false
var profiling = false
`)
fmt.Println("Opening the configuration file")

View File

@ -30,7 +30,9 @@ var staff_css_tmpl = template.CSS(staff_css)
var settings map[string]interface{} = make(map[string]interface{})
var external_sites map[string]string = make(map[string]string)
var groups map[int]Group = make(map[int]Group)
var forums map[int]Forum = make(map[int]Forum)
var forums []Forum // The IDs for a forum tend to be low and sequential for the most part, so we can get more performance out of using a slice instead of a map AND it has better concurrency
var groupCapCount int
var forumCapCount int
var static_files map[string]SFile = make(map[string]SFile)
var template_topic_handle func(TopicPage,io.Writer) = nil
@ -75,7 +77,8 @@ func compile_templates() {
topics_page := TopicsPage{"Topic List",user,noticeList,topicList,""}
topics_tmpl := c.compile_template("topics.html","templates/","TopicsPage", topics_page, varList)
forum_page := ForumPage{"General Forum",user,noticeList,topicList,"There aren't any topics in this forum yet."}
forum_item := Forum{1,"General Forum",true,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)
log.Print("Writing the templates")

View File

@ -72,7 +72,8 @@ func route_delete_topic(w http.ResponseWriter, r *http.Request) {
var content string
var createdBy int
err = db.QueryRow("select tid, content, createdBy from topics where tid = ?", tid).Scan(&tid, &content, &createdBy)
var fid int
err = db.QueryRow("select tid, content, createdBy, parentID from topics where tid = ?", tid).Scan(&tid, &content, &createdBy, &fid)
if err == sql.ErrNoRows {
LocalError("The topic you tried to delete doesn't exist.",w,r,user)
return
@ -95,6 +96,18 @@ func route_delete_topic(w http.ResponseWriter, r *http.Request) {
InternalError(err,w,r,user)
return
}
if (fid > forumCapCount) || (fid < 0) || forums[fid].Name=="" {
LocalError("The topic's parent forum doesn't exist.",w,r,user)
return
}
_, err = remove_topics_from_forum_stmt.Exec(1, fid)
if err != nil {
InternalError(err,w,r,user)
return
}
forums[fid].TopicCount -= 1
}
func route_stick_topic(w http.ResponseWriter, r *http.Request) {
@ -571,12 +584,12 @@ func route_panel_forums(w http.ResponseWriter, r *http.Request){
var forumList []interface{}
for _, forum := range forums {
if forum.ID > -1 {
if forum.Name != "" {
forumList = append(forumList, forum)
}
}
pi := Page{"Forum Manager",user,noticeList,forumList,0}
pi := Page{"Forum Manager",user,noticeList,forumList,nil}
templates.ExecuteTemplate(w,"panel-forums.html", pi)
}
@ -600,20 +613,20 @@ func route_panel_forums_create_submit(w http.ResponseWriter, r *http.Request){
return
}
var active bool
fname := r.PostFormValue("forum-name")
res, err := create_forum_stmt.Exec(fname)
factive := r.PostFormValue("forum-name")
if factive == "on" || factive == "1" {
active = true
} else {
active = false
}
_, err = create_forum(fname, active)
if err != nil {
InternalError(err,w,r,user)
return
}
lastId, err := res.LastInsertId()
if err != nil {
InternalError(err,w,r,user)
return
}
forums[int(lastId)] = Forum{int(lastId),fname,true,"",0,"",0,""}
http.Redirect(w,r,"/panel/forums/",http.StatusSeeOther)
}
@ -637,8 +650,7 @@ func route_panel_forums_delete(w http.ResponseWriter, r *http.Request){
return
}
_, ok = forums[fid];
if !ok {
if (fid > forumCapCount) || (fid < 0) || forums[fid].Name=="" {
LocalError("The forum you're trying to delete doesn't exist.",w,r,user)
return
}
@ -671,20 +683,17 @@ func route_panel_forums_delete_submit(w http.ResponseWriter, r *http.Request) {
return
}
_, ok = forums[fid];
if !ok {
if (fid > forumCapCount) || (fid < 0) || forums[fid].Name=="" {
LocalError("The forum you're trying to delete doesn't exist.",w,r,user)
return
}
_, err = delete_forum_stmt.Exec(fid)
err = delete_forum(fid)
if err != nil {
InternalError(err,w,r,user)
return
}
// Remove this forum from the forum cache
delete(forums,fid);
http.Redirect(w,r,"/panel/forums/",http.StatusSeeOther)
}
@ -715,8 +724,7 @@ func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request) {
}
forum_name := r.PostFormValue("edit_item")
forum, ok := forums[fid];
if !ok {
if (fid > forumCapCount) || (fid < 0) || forums[fid].Name=="" {
LocalError("The forum you're trying to edit doesn't exist.",w,r,user)
return
}
@ -726,8 +734,7 @@ func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request) {
InternalError(err,w,r,user)
return
}
forum.Name = forum_name
forums[fid] = forum
forums[fid].Name = forum_name
http.Redirect(w,r,"/panel/forums/",http.StatusSeeOther)
}

View File

@ -15,11 +15,14 @@ var get_topic_user_stmt *sql.Stmt
var get_topic_replies_stmt *sql.Stmt
var get_topic_replies_offset_stmt *sql.Stmt
var get_forum_topics_stmt *sql.Stmt
var get_forum_topics_offset_stmt *sql.Stmt
var create_topic_stmt *sql.Stmt
var create_report_stmt *sql.Stmt
var create_reply_stmt *sql.Stmt
var add_replies_to_topic_stmt *sql.Stmt
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 edit_topic_stmt *sql.Stmt
var edit_reply_stmt *sql.Stmt
@ -55,6 +58,7 @@ var delete_profile_reply_stmt *sql.Stmt
var create_forum_stmt *sql.Stmt
var delete_forum_stmt *sql.Stmt
var update_forum_stmt *sql.Stmt
var forum_entry_exists_stmt *sql.Stmt
var update_setting_stmt *sql.Stmt
var add_plugin_stmt *sql.Stmt
var update_plugin_stmt *sql.Stmt
@ -102,13 +106,19 @@ 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 from replies left join users on replies.createdBy = users.uid where tid = ? limit ?, " + strconv.Itoa(items_per_page))
if err != nil {
log.Fatal(err)
}
log.Print("Preparing get_forum_topics statement.")
get_forum_topics_stmt, err = db.Prepare("select topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, 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")
get_forum_topics_stmt, err = db.Prepare("select topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, 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")
if err != nil {
log.Fatal(err)
}
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.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))
if err != nil {
log.Fatal(err)
}
@ -120,7 +130,7 @@ func init_database(err error) {
}
log.Print("Preparing create_report statement.")
create_report_stmt, err = db.Prepare("INSERT INTO topics(title,content,parsed_content,createdAt,createdBy,data,parentID) VALUES(?,?,?,NOW(),?,?,-1)")
create_report_stmt, err = db.Prepare("INSERT INTO topics(title,content,parsed_content,createdAt,createdBy,data,parentID) VALUES(?,?,?,NOW(),?,?,1)")
if err != nil {
log.Fatal(err)
}
@ -143,6 +153,18 @@ func init_database(err error) {
log.Fatal(err)
}
log.Print("Preparing add_topics_to_forum statement.")
add_topics_to_forum_stmt, err = db.Prepare("UPDATE forums SET topicCount = topicCount + ? WHERE fid = ?")
if err != nil {
log.Fatal(err)
}
log.Print("Preparing remove_topics_from_forum statement.")
remove_topics_from_forum_stmt, err = db.Prepare("UPDATE forums SET topicCount = topicCount - ? WHERE fid = ?")
if err != nil {
log.Fatal(err)
}
log.Print("Preparing update_forum_cache statement.")
update_forum_cache_stmt, err = db.Prepare("UPDATE forums SET lastTopic = ?, lastTopicID = ?, lastReplyer = ?, lastReplyerID = ?, lastTopicTime = NOW() WHERE fid = ?")
if err != nil {
@ -249,7 +271,7 @@ func init_database(err error) {
}
log.Print("Preparing change_group statement.")
change_group_stmt, err = db.Prepare("UPDATE `users` SET `group` = ? WHERE `uid` = ?")
change_group_stmt, err = db.Prepare("update `users` set `group` = ? where `uid` = ?")
if err != nil {
log.Fatal(err)
}
@ -333,19 +355,26 @@ func init_database(err error) {
}
log.Print("Preparing create_forum statement.")
create_forum_stmt, err = db.Prepare("INSERT INTO forums(name) VALUES(?)")
create_forum_stmt, err = db.Prepare("INSERT INTO forums(name,active) VALUES(?,?)")
if err != nil {
log.Fatal(err)
}
log.Print("Preparing delete_forum statement.")
delete_forum_stmt, err = db.Prepare("DELETE FROM forums WHERE fid = ?")
//delete_forum_stmt, err = db.Prepare("DELETE FROM forums WHERE fid = ?")
delete_forum_stmt, err = db.Prepare("update forums set name= '', active = 0 where fid = ?")
if err != nil {
log.Fatal(err)
}
log.Print("Preparing update_forum statement.")
update_forum_stmt, err = db.Prepare("UPDATE forums SET name = ? WHERE fid = ?")
update_forum_stmt, err = db.Prepare("update forums set name = ?, active = ? where fid = ?")
if err != nil {
log.Fatal(err)
}
log.Print("Preparing forum_entry_exists statement.")
forum_entry_exists_stmt, err = db.Prepare("SELECT `fid` FROM `forums` WHERE `name` = '' order by fid asc limit 1")
if err != nil {
log.Fatal(err)
}
@ -418,19 +447,30 @@ func init_database(err error) {
}
log.Print("Loading the forums.")
rows, err = db.Query("SELECT fid, name, active, lastTopic, lastTopicID, lastReplyer, lastReplyerID, lastTopicTime FROM forums")
log.Print("Adding the uncategorised forum")
forums = append(forums, Forum{0,"Uncategorised",uncategorised_forum_visible,0,"",0,"",0,""})
//rows, err = db.Query("SELECT fid, name, active, lastTopic, lastTopicID, lastReplyer, lastReplyerID, lastTopicTime FROM forums")
rows, err = db.Query("SELECT fid, name, active, topicCount, lastTopic, lastTopicID, lastReplyer, lastReplyerID, lastTopicTime FROM forums ORDER BY fid ASC")
if err != nil {
log.Fatal(err)
}
defer rows.Close()
for rows.Next() {
forum := Forum{0,"",true,"",0,"",0,""}
err := rows.Scan(&forum.ID, &forum.Name, &forum.Active, &forum.LastTopic, &forum.LastTopicID, &forum.LastReplyer, &forum.LastReplyerID, &forum.LastTopicTime)
i := 1
for ;rows.Next();i++ {
forum := Forum{0,"",true,0,"",0,"",0,""}
err := rows.Scan(&forum.ID, &forum.Name, &forum.Active, &forum.TopicCount, &forum.LastTopic, &forum.LastTopicID, &forum.LastReplyer, &forum.LastReplyerID, &forum.LastTopicTime)
if err != nil {
log.Fatal(err)
}
// Ugh, you really shouldn't physically delete these items, it makes a big mess of things
if forum.ID != i {
fmt.Println("Stop physically deleting forums. You are messing up the IDs. Use the Forum Manager or delete_forums() instead x.x")
fill_forum_id_gap(i, forum.ID)
}
if forum.LastTopicID != 0 {
forum.LastTopicTime, err = relative_time(forum.LastTopicTime)
if err != nil {
@ -440,17 +480,18 @@ func init_database(err error) {
forum.LastTopic = "None"
forum.LastTopicTime = ""
}
forums[forum.ID] = forum
log.Print("Adding the " + forum.Name + " forum")
forums = append(forums,forum)
}
err = rows.Err()
if err != nil {
log.Fatal(err)
}
forumCapCount = i
log.Print("Adding the uncategorised forum")
forums[0] = Forum{0,"Uncategorised",uncategorised_forum_visible,"",0,"",0,""}
log.Print("Adding the reports forum")
forums[-1] = Forum{-1,"Reports",false,"",0,"",0,""}
//log.Print("Adding the reports forum")
//forums[-1] = Forum{-1,"Reports",false,0,"",0,"",0,""}
log.Print("Loading the settings.")
rows, err = db.Query("SELECT name, content, type, constraints FROM settings")
@ -541,6 +582,4 @@ func init_database(err error) {
if err != nil {
log.Fatal(err)
}
}

View File

@ -38,6 +38,9 @@ type ForumPage struct
CurrentUser User
NoticeList []string
ItemList []TopicUser
Forum Forum
Page int
LastPage int
ExtData interface{}
}

View File

@ -1,6 +1,6 @@
package main
//import "log"
import "fmt"
//import "fmt"
import "bytes"
//import "strings"
import "strconv"
@ -15,6 +15,8 @@ var bbcode_missing_tag []byte
var bbcode_url_open []byte
var bbcode_url_open2 []byte
var bbcode_url_close []byte
var bbcode_space_gap []byte
var bbcode_bold *regexp.Regexp
var bbcode_italic *regexp.Regexp
var bbcode_underline *regexp.Regexp
@ -36,6 +38,7 @@ func init_bbcode() {
bbcode_url_open = []byte("<a href='")
bbcode_url_open2 = []byte("'>")
bbcode_url_close = []byte("</a>")
bbcode_space_gap = []byte(" ")
bbcode_bold = regexp.MustCompile(`(?s)\[b\](.*)\[/b\]`)
bbcode_italic = regexp.MustCompile(`(?s)\[i\](.*)\[/i\]`)
@ -188,8 +191,8 @@ func bbcode_full_parse(data interface{}) interface{} {
has_s := false
has_c := false
complex_bbc := false
msglen := len(msgbytes)
for i := 0; (i + 3) < msglen; i++ {
msgbytes = append(msgbytes,bbcode_space_gap...)
for i := 0; i < len(msgbytes); i++ {
if msgbytes[i] == '[' {
if msgbytes[i + 2] != ']' {
if msgbytes[i + 1] == '/' {
@ -215,7 +218,7 @@ func bbcode_full_parse(data interface{}) interface{} {
i += 3
}
} else {
if msglen >= (i+6) && msgbytes[i+2] == 'c' && msgbytes[i+3] == 'o' && msgbytes[i+4] == 'd' && msgbytes[i+5] == 'e' && msgbytes[i+6] == ']' {
if msgbytes[i+2] == 'c' && msgbytes[i+3] == 'o' && msgbytes[i+4] == 'd' && msgbytes[i+5] == 'e' && msgbytes[i+6] == ']' {
has_c = false
i += 7
}
@ -228,7 +231,7 @@ func bbcode_full_parse(data interface{}) interface{} {
complex_bbc = true
}
} else {
if msglen >= (i+5) && msgbytes[i+1] == 'c' && msgbytes[i+2] == 'o' && msgbytes[i+3] == 'd' && msgbytes[i+4] == 'e' && msgbytes[i+5] == ']' {
if msgbytes[i+1] == 'c' && msgbytes[i+2] == 'o' && msgbytes[i+3] == 'd' && msgbytes[i+4] == 'e' && msgbytes[i+5] == ']' {
has_c = true
i += 6
}
@ -271,14 +274,14 @@ func bbcode_full_parse(data interface{}) interface{} {
i := 0
var start int
var lastTag int
outbytes := make([]byte, msglen)
fmt.Println(string(msgbytes))
for ; (i+3) < msglen; i++ {
outbytes := make([]byte, len(msgbytes))
//fmt.Println(string(msgbytes))
for ; i < len(msgbytes); i++ {
MainLoop:
if msgbytes[i] == '[' {
OuterComplex:
if msgbytes[i + 1] == 'u' {
if (msglen-1) >= (i+6) && msgbytes[i+2] == 'r' && msgbytes[i+3] == 'l' && msgbytes[i+4] == ']' {
if msgbytes[i+2] == 'r' && msgbytes[i+3] == 'l' && msgbytes[i+4] == ']' {
outbytes = append(outbytes, msgbytes[lastTag:i]...)
start = i + 5
i = start
@ -300,7 +303,7 @@ func bbcode_full_parse(data interface{}) interface{} {
}
for ;; i++ {
if msglen < (i + 6) {
if len(msgbytes) < (i + 10) {
//fmt.Println(msglen)
//fmt.Println(i+6)
outbytes = append(outbytes, bbcode_missing_tag...)
@ -329,7 +332,7 @@ func bbcode_full_parse(data interface{}) interface{} {
lastTag = i
}
} else if msgbytes[i + 1] == 'r' {
if msglen >= (i+6) && bytes.Equal(msgbytes[i+2:i+6],[]byte("and]")) {
if bytes.Equal(msgbytes[i+2:i+6],[]byte("and]")) {
outbytes = append(outbytes, msgbytes[lastTag:i]...)
start = i + 6
i = start
@ -340,7 +343,7 @@ func bbcode_full_parse(data interface{}) interface{} {
goto OuterComplex
}
break
} else if (len(msgbytes) - 1) < (i + 7) {
} else if (len(msgbytes) - 1) < (i + 10) {
outbytes = append(outbytes, bbcode_missing_tag...)
goto OuterComplex
}
@ -364,7 +367,7 @@ func bbcode_full_parse(data interface{}) interface{} {
//fmt.Println(outbytes)
//fmt.Println(string(outbytes))
if lastTag != i {
outbytes = append(outbytes, msgbytes[lastTag:]...)
outbytes = append(outbytes, msgbytes[lastTag:len(msgbytes) - 10]...)
}
if len(outbytes) != 0 {
return string(outbytes)

View File

@ -121,4 +121,13 @@ $(document).ready(function(){
});
}
});
$(this).keyup(function(event){
if(event.which == 37) {
$("#prevFloat a")[0].click();
}
if(event.which == 39) {
$("#nextFloat a")[0].click();
}
});
});

View File

@ -2,7 +2,7 @@
package main
import "log"
import "fmt"
//import "fmt"
import "strconv"
import "bytes"
import "regexp"
@ -150,15 +150,14 @@ func route_forum(w http.ResponseWriter, r *http.Request){
return
}
var topicList []TopicUser
page, _ := strconv.Atoi(r.FormValue("page"))
fid, err := strconv.Atoi(r.URL.Path[len("/forum/"):])
if err != nil {
LocalError("The provided ForumID is not a valid number.",w,r,user)
return
}
_, ok = forums[fid]
if !ok {
if (fid > forumCapCount) || (fid < 0) || forums[fid].Name=="" {
NotFound(w,r,user)
return
}
@ -167,12 +166,24 @@ func route_forum(w http.ResponseWriter, r *http.Request){
return
}
rows, err := get_forum_topics_stmt.Query(fid)
// Calculate the offset
var offset int
last_page := int(forums[fid].TopicCount / items_per_page) + 1
if page > 1 {
offset = (items_per_page * page) - items_per_page
} else if page == -1 {
page = last_page
offset = (items_per_page * page) - items_per_page
} else {
page = 1
}
rows, err := get_forum_topics_offset_stmt.Query(fid, offset)
if err != nil {
InternalError(err,w,r,user)
return
}
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.ParentID, &topicItem.CreatedByName, &topicItem.Avatar)
@ -201,7 +212,7 @@ func route_forum(w http.ResponseWriter, r *http.Request){
}
rows.Close()
pi := ForumPage{forums[fid].Name,user,noticeList,topicList,nil}
pi := ForumPage{forums[fid].Name,user,noticeList,topicList,forums[fid],page,last_page,nil}
if template_forum_handle != nil {
template_forum_handle(pi,w)
} else {
@ -541,6 +552,8 @@ func route_create_topic(w http.ResponseWriter, r *http.Request) {
LocalError("Bad Form", w, r, user)
return
}
fid := 2
topic_name := html.EscapeString(r.PostFormValue("topic-name"))
content := html.EscapeString(preparse_message(r.PostFormValue("topic-content")))
ipaddress, _, err := net.SplitHostPort(r.RemoteAddr)
@ -549,6 +562,11 @@ func route_create_topic(w http.ResponseWriter, r *http.Request) {
return
}
if (fid > forumCapCount) || (fid < 0) || forums[fid].Name=="" {
LocalError("The topic's parent forum doesn't exist.",w,r,user)
return
}
res, err := create_topic_stmt.Exec(topic_name,content,parse_message(content),ipaddress,user.ID)
if err != nil {
InternalError(err,w,r,user)
@ -560,7 +578,15 @@ func route_create_topic(w http.ResponseWriter, r *http.Request) {
InternalError(err,w,r,user)
return
}
_, err = update_forum_cache_stmt.Exec(topic_name, lastId, user.Name, user.ID, 1)
_, err = add_topics_to_forum_stmt.Exec(1, fid)
if err != nil {
InternalError(err,w,r,user)
return
}
forums[fid].TopicCount -= 1
_, err = update_forum_cache_stmt.Exec(topic_name, lastId, user.Name, user.ID, fid)
if err != nil {
InternalError(err,w,r,user)
return
@ -710,8 +736,8 @@ func route_report_submit(w http.ResponseWriter, r *http.Request) {
}
item_type := r.FormValue("type")
success := 1
fid := 1
var tid int
var title string
var content string
@ -719,16 +745,16 @@ func route_report_submit(w http.ResponseWriter, r *http.Request) {
if item_type == "reply" {
err = db.QueryRow("select tid, content from replies where rid = ?", item_id).Scan(&tid, &content)
if err == sql.ErrNoRows {
LocalError("We were unable to find the reported post", w, r, user)
LocalError("We were unable to find the reported post",w,r,user)
return
} else if err != nil {
InternalError(err,w,r,user)
return
}
err = db.QueryRow("select title, data from topics where tid = ?", tid).Scan(&title,&data)
err = db.QueryRow("select title, data from topics where tid = ?",tid).Scan(&title,&data)
if err == sql.ErrNoRows {
LocalError("We were unable to find the topic which the reported post is supposed to be in", w, r, user)
LocalError("We were unable to find the topic which the reported post is supposed to be in",w,r,user)
return
} else if err != nil {
InternalError(err,w,r,user)
@ -738,7 +764,7 @@ func route_report_submit(w http.ResponseWriter, r *http.Request) {
} else if item_type == "user-reply" {
err = db.QueryRow("select uid, content from users_replies where rid = ?", item_id).Scan(&tid, &content)
if err == sql.ErrNoRows {
LocalError("We were unable to find the reported post", w, r, user)
LocalError("We were unable to find the reported post",w,r,user)
return
} else if err != nil {
InternalError(err,w,r,user)
@ -747,7 +773,7 @@ func route_report_submit(w http.ResponseWriter, r *http.Request) {
err = db.QueryRow("select name from users where uid = ?", tid).Scan(&title)
if err == sql.ErrNoRows {
LocalError("We were unable to find the profile which the reported post is supposed to be on", w, r, user)
LocalError("We were unable to find the profile which the reported post is supposed to be on",w,r,user)
return
} else if err != nil {
InternalError(err,w,r,user)
@ -769,14 +795,13 @@ func route_report_submit(w http.ResponseWriter, r *http.Request) {
run_vhook_noreturn("report_preassign", &item_id, &item_type)
return
}
// Don't try to guess the type
LocalError("Unknown type", w, r, user)
LocalError("Unknown type",w,r,user)
return
}
var count int
rows, err := db.Query("select count(*) as count from topics where data = ? and data != '' and parentID = -1", item_type + "_" + strconv.Itoa(item_id))
rows, err := db.Query("select count(*) as count from topics where data = ? and data != '' and parentID = 1", item_type + "_" + strconv.Itoa(item_id))
if err != nil && err != sql.ErrNoRows {
InternalError(err,w,r,user)
return
@ -797,34 +822,28 @@ func route_report_submit(w http.ResponseWriter, r *http.Request) {
title = "Report: " + title
res, err := create_report_stmt.Exec(title,content,content,user.ID,item_type + "_" + strconv.Itoa(item_id))
if err != nil {
log.Print(err)
success = 0
InternalError(err,w,r,user)
return
}
lastId, err := res.LastInsertId()
if err != nil {
log.Print(err)
success = 0
}
_, err = update_forum_cache_stmt.Exec(title, lastId, user.Name, user.ID, 1)
if err != nil {
InternalError(err,w,r,user)
return
}
if success != 1 {
errmsg := "Unable to create the report"
pi := Page{"Error",user,nList,tList,errmsg}
var b bytes.Buffer
templates.ExecuteTemplate(&b,"error.html", pi)
errpage := b.String()
w.WriteHeader(500)
fmt.Fprintln(w,errpage)
} else {
http.Redirect(w, r, "/topic/" + strconv.FormatInt(lastId, 10), http.StatusSeeOther)
_, err = add_topics_to_forum_stmt.Exec(1, fid)
if err != nil {
InternalError(err,w,r,user)
return
}
_, err = update_forum_cache_stmt.Exec(title, lastId, user.Name, user.ID, fid)
if err != nil {
InternalError(err,w,r,user)
return
}
http.Redirect(w, r, "/topic/" + strconv.FormatInt(lastId, 10), http.StatusSeeOther)
}
func route_account_own_edit_critical(w http.ResponseWriter, r *http.Request) {

View File

@ -1,3 +1,6 @@
go build
go build ./install
echo "Generating the dynamic code"
go generate
echo "Building Gosora"
go build -o Gosora
echo "Running Gosora"
./Gosora

View File

@ -7,7 +7,7 @@ if %errorlevel% neq 0 (
)
echo Building the executable
go build
go build -o gosora.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%

View File

@ -40,37 +40,55 @@ w.Write([]byte(item))
w.Write(header_5)
}
}
if tmpl_forum_vars.Page > 1 {
w.Write(forum_0)
w.Write([]byte(tmpl_forum_vars.Title))
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
w.Write(forum_1)
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1)))
w.Write(forum_2)
}
if tmpl_forum_vars.LastPage != tmpl_forum_vars.Page {
w.Write(forum_3)
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
w.Write(forum_4)
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1)))
w.Write(forum_5)
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
w.Write(forum_6)
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1)))
w.Write(forum_7)
}
w.Write(forum_8)
w.Write([]byte(tmpl_forum_vars.Title))
w.Write(forum_9)
if len(tmpl_forum_vars.ItemList) != 0 {
for _, item := range tmpl_forum_vars.ItemList {
w.Write(forum_2)
if item.Avatar != "" {
w.Write(forum_3)
w.Write([]byte(item.Avatar))
w.Write(forum_4)
}
if item.Sticky {
w.Write(forum_5)
} else {
if item.Is_Closed {
w.Write(forum_6)
}
}
w.Write(forum_7)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(forum_8)
w.Write([]byte(item.Title))
w.Write(forum_9)
if item.Is_Closed {
w.Write(forum_10)
}
if item.Avatar != "" {
w.Write(forum_11)
}
} else {
w.Write([]byte(item.Avatar))
w.Write(forum_12)
}
if item.Sticky {
w.Write(forum_13)
} else {
if item.Is_Closed {
w.Write(forum_14)
}
}
w.Write(forum_15)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(forum_16)
w.Write([]byte(item.Title))
w.Write(forum_17)
if item.Is_Closed {
w.Write(forum_18)
}
w.Write(forum_19)
}
} else {
w.Write(forum_20)
}
w.Write(forum_21)
w.Write(footer_0)
}

View File

@ -50,106 +50,109 @@ var header_3 []byte = []byte(`
<div id="back"><div id="main">`)
var header_4 []byte = []byte(`<div class="alert">`)
var header_5 []byte = []byte(`</div>`)
var topic_0 []byte = []byte(`<div class="prev_button"><a href="/topic/`)
var topic_0 []byte = []byte(`<div id="prevFloat" class="prev_button"><a class="prev_link" href="/topic/`)
var topic_1 []byte = []byte(`?page=`)
var topic_2 []byte = []byte(`">&lt;</a></div>`)
var topic_3 []byte = []byte(`<div class="next_button"><a href="/topic/`)
var topic_3 []byte = []byte(`<link rel="prerender" href="/topic/`)
var topic_4 []byte = []byte(`?page=`)
var topic_5 []byte = []byte(`">&gt;</a></div>`)
var topic_6 []byte = []byte(`
var topic_5 []byte = []byte(`" />
<div id="nextFloat" class="next_button"><a class="next_link" href="/topic/`)
var topic_6 []byte = []byte(`?page=`)
var topic_7 []byte = []byte(`">&gt;</a></div>`)
var topic_8 []byte = []byte(`
<div class="rowblock">
<form action='/topic/edit/submit/`)
var topic_7 []byte = []byte(`' method="post">
var topic_9 []byte = []byte(`' method="post">
<div class="rowitem"`)
var topic_8 []byte = []byte(` style="background-color: #FFFFEA;"`)
var topic_9 []byte = []byte(` style="background-color: #eaeaea;"`)
var topic_10 []byte = []byte(`>
var topic_10 []byte = []byte(` style="background-color: #FFFFEA;"`)
var topic_11 []byte = []byte(` style="background-color: #eaeaea;"`)
var topic_12 []byte = []byte(`>
<a class='topic_name hide_on_edit'>`)
var topic_11 []byte = []byte(`</a>
var topic_13 []byte = []byte(`</a>
`)
var topic_12 []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;">&#x1F512;&#xFE0E</span>`)
var topic_13 []byte = []byte(`
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;">&#x1F512;&#xFE0E</span>`)
var topic_15 []byte = []byte(`
<a href='/topic/edit/`)
var topic_14 []byte = []byte(`' class="username hide_on_edit open_edit" style="font-weight: normal;margin-left: 6px;">Edit</a>
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_15 []byte = []byte(`' class="username" style="font-weight: normal;">Delete</a>
var topic_17 []byte = []byte(`' class="username" style="font-weight: normal;">Delete</a>
`)
var topic_16 []byte = []byte(`<a href='/topic/unstick/submit/`)
var topic_17 []byte = []byte(`' class="username" style="font-weight: normal;">Unpin</a>`)
var topic_18 []byte = []byte(`<a href='/topic/stick/submit/`)
var topic_19 []byte = []byte(`' class="username" style="font-weight: normal;">Pin</a>`)
var topic_20 []byte = []byte(`
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_21 []byte = []byte(`' type="text" />
var topic_23 []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_22 []byte = []byte(`
var topic_24 []byte = []byte(`
<a href="/report/submit/`)
var topic_23 []byte = []byte(`?session=`)
var topic_24 []byte = []byte(`&type=topic" class="username report_item" style="font-weight: normal;">Report</a>
var topic_25 []byte = []byte(`?session=`)
var topic_26 []byte = []byte(`&type=topic" class="username report_item" style="font-weight: normal;">Report</a>
</div>
</form>
</div>
<div class="rowblock post_container">
<div class="rowitem passive editable_parent post_item" style="border-bottom: none;`)
var topic_25 []byte = []byte(`background-image: url(`)
var topic_26 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px `)
var topic_27 []byte = []byte(`-1`)
var topic_28 []byte = []byte(`0px;background-repeat: no-repeat, repeat-y;background-size: 128px;padding-left: 136px;`)
var topic_29 []byte = []byte(`">
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(`">
<p class="hide_on_edit topic_content user_content" style="margin: 0;padding: 0;">`)
var topic_30 []byte = []byte(`</p>
var topic_32 []byte = []byte(`</p>
<textarea name="topic_content" class="show_on_edit topic_content_input">`)
var topic_31 []byte = []byte(`</textarea><br /><br />
var topic_33 []byte = []byte(`</textarea><br /><br />
<a href="/user/`)
var topic_32 []byte = []byte(`" class="username real_username">`)
var topic_33 []byte = []byte(`</a>
var topic_34 []byte = []byte(`" class="username real_username">`)
var topic_35 []byte = []byte(`</a>
<a class="username hide_on_micro" `)
var topic_34 []byte = []byte(`style="float: right;">`)
var topic_35 []byte = []byte(`style="color: #505050;float: right;">Level `)
var topic_36 []byte = []byte(`</a>
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>
</div>
</div><br />
<div class="rowblock post_container" style="overflow: hidden;">`)
var topic_37 []byte = []byte(`
var topic_39 []byte = []byte(`
<div class="rowitem rowhead passive deletable_block editable_parent post_item" style="`)
var topic_38 []byte = []byte(`background-image: url(`)
var topic_39 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px `)
var topic_40 []byte = []byte(`-1`)
var topic_41 []byte = []byte(`0px;background-repeat: no-repeat, repeat-y;background-size: 128px;padding-left: 136px;`)
var topic_42 []byte = []byte(`">
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(`">
<p class="editable_block user_content" style="margin: 0;padding: 0;">`)
var topic_43 []byte = []byte(`</p><br /><br />
var topic_45 []byte = []byte(`</p><br /><br />
<a href="/user/`)
var topic_44 []byte = []byte(`" class="username real_username">`)
var topic_45 []byte = []byte(`</a>
var topic_46 []byte = []byte(`" class="username real_username">`)
var topic_47 []byte = []byte(`</a>
`)
var topic_46 []byte = []byte(`<a href="/reply/edit/submit/`)
var topic_47 []byte = []byte(`" class="mod_button"><button class="username edit_item">Edit</button></a> `)
var topic_48 []byte = []byte(`<a href="/reply/delete/submit/`)
var topic_49 []byte = []byte(`" class="mod_button"><button class="username delete_item">Delete</button></a> `)
var topic_50 []byte = []byte(`
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(`
<a href="/report/submit/`)
var topic_51 []byte = []byte(`?session=`)
var topic_52 []byte = []byte(`&type=reply" class="mod_button"><button class="username report_item">Report</button></a>
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_53 []byte = []byte(`style="float: right;">`)
var topic_54 []byte = []byte(`style="color: #505050;float: right;">Level `)
var topic_55 []byte = []byte(`</a>
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>
</div>
`)
var topic_56 []byte = []byte(`</div>
var topic_58 []byte = []byte(`</div>
`)
var topic_57 []byte = []byte(`
var topic_59 []byte = []byte(`
<div class="rowblock">
<form action="/reply/create/" method="post">
<input name="tid" value='`)
var topic_58 []byte = []byte(`' type="hidden" />
var topic_60 []byte = []byte(`' type="hidden" />
<div class="formrow">
<div class="formitem"><textarea name="reply-content" placeholder="Insert reply here"></textarea></div>
</div>
@ -163,48 +166,51 @@ var footer_0 []byte = []byte(` <!--<link rel="stylesheet" href="https://use.fo
</div><div style="clear: both;"></div></div></div>
</body>
</html>`)
var topic_alt_0 []byte = []byte(`<div class="prev_button"><a href="/topic/`)
var topic_alt_0 []byte = []byte(`<div id="prevFloat" class="prev_button"><a class="prev_link" href="/topic/`)
var topic_alt_1 []byte = []byte(`?page=`)
var topic_alt_2 []byte = []byte(`">&lt;</a></div>`)
var topic_alt_3 []byte = []byte(`<div class="next_button"><a href="/topic/`)
var topic_alt_3 []byte = []byte(`<link rel="prerender" href="/topic/`)
var topic_alt_4 []byte = []byte(`?page=`)
var topic_alt_5 []byte = []byte(`">&gt;</a></div>`)
var topic_alt_6 []byte = []byte(`
var topic_alt_5 []byte = []byte(`" />
<div id="nextFloat" class="next_button"><a class="next_link" href="/topic/`)
var topic_alt_6 []byte = []byte(`?page=`)
var topic_alt_7 []byte = []byte(`">&gt;</a></div>`)
var topic_alt_8 []byte = []byte(`
<div class="rowblock">
<form action='/topic/edit/submit/`)
var topic_alt_7 []byte = []byte(`' method="post">
var topic_alt_9 []byte = []byte(`' method="post">
<div class="rowitem rowhead`)
var topic_alt_8 []byte = []byte(` topic_sticky_head`)
var topic_alt_9 []byte = []byte(` topic_closed_head`)
var topic_alt_10 []byte = []byte(`">
var topic_alt_10 []byte = []byte(` topic_sticky_head`)
var topic_alt_11 []byte = []byte(` topic_closed_head`)
var topic_alt_12 []byte = []byte(`">
<a class='topic_name hide_on_edit'>`)
var topic_alt_11 []byte = []byte(`</a>
var topic_alt_13 []byte = []byte(`</a>
`)
var topic_alt_12 []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;">&#x1F512;&#xFE0E</span>`)
var topic_alt_13 []byte = []byte(`
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;">&#x1F512;&#xFE0E</span>`)
var topic_alt_15 []byte = []byte(`
<a href='/topic/edit/`)
var topic_alt_14 []byte = []byte(`' class="username hide_on_edit open_edit topic_button" style="font-weight: normal;margin-left: 6px;">Edit</a>
var topic_alt_16 []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_15 []byte = []byte(`' class="username topic_button" style="font-weight: normal;">Delete</a>
var topic_alt_17 []byte = []byte(`' class="username topic_button" style="font-weight: normal;">Delete</a>
`)
var topic_alt_16 []byte = []byte(`<a href='/topic/unstick/submit/`)
var topic_alt_17 []byte = []byte(`' class="username topic_button" style="font-weight: normal;">Unpin</a>`)
var topic_alt_18 []byte = []byte(`<a href='/topic/stick/submit/`)
var topic_alt_19 []byte = []byte(`' class="username topic_button" style="font-weight: normal;">Pin</a>`)
var topic_alt_20 []byte = []byte(`
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(`
<input class='show_on_edit topic_name_input' name="topic_name" value='`)
var topic_alt_21 []byte = []byte(`' type="text" />
var topic_alt_23 []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_22 []byte = []byte(`
var topic_alt_24 []byte = []byte(`
<a href="/report/submit/`)
var topic_alt_23 []byte = []byte(`?session=`)
var topic_alt_24 []byte = []byte(`&type=topic" class="username report_item topic_button" style="font-weight: normal;">Report</a>
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>
</div>
</form>
</div>
@ -213,75 +219,75 @@ var topic_alt_24 []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_25 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div>
var topic_alt_27 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div>
<a href="/user/`)
var topic_alt_26 []byte = []byte(`" class="the_name">`)
var topic_alt_27 []byte = []byte(`</a>
var topic_alt_28 []byte = []byte(`" class="the_name">`)
var topic_alt_29 []byte = []byte(`</a>
`)
var topic_alt_28 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`)
var topic_alt_29 []byte = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_30 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
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(`
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(`
</div>
<div class="content_container">
<div class="hide_on_edit topic_content user_content">`)
var topic_alt_33 []byte = []byte(`</div>
var topic_alt_35 []byte = []byte(`</div>
<textarea name="topic_content" class="show_on_edit topic_content_input">`)
var topic_alt_34 []byte = []byte(`</textarea>
var topic_alt_36 []byte = []byte(`</textarea>
<div class="button_container">
`)
var topic_alt_35 []byte = []byte(`<a href="#" class="action_button action_button_right ip_item">`)
var topic_alt_36 []byte = []byte(`</a>`)
var topic_alt_37 []byte = []byte(`
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(`
</div>
</div><div style="clear:both;"></div>
</div>
`)
var topic_alt_38 []byte = []byte(`
var topic_alt_40 []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_39 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div>
var topic_alt_41 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div>
<a href="/user/`)
var topic_alt_40 []byte = []byte(`" class="the_name">`)
var topic_alt_41 []byte = []byte(`</a>
var topic_alt_42 []byte = []byte(`" class="the_name">`)
var topic_alt_43 []byte = []byte(`</a>
`)
var topic_alt_42 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`)
var topic_alt_43 []byte = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_44 []byte = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
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(`
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(`
</div>
<div class="content_container">
<div class="editable_block user_content">`)
var topic_alt_47 []byte = []byte(`</div>
var topic_alt_49 []byte = []byte(`</div>
<div class="button_container">
`)
var topic_alt_48 []byte = []byte(`<a href="/reply/edit/submit/`)
var topic_alt_49 []byte = []byte(`" class="action_button edit_item">Edit</a>`)
var topic_alt_50 []byte = []byte(`<a href="/reply/delete/submit/`)
var topic_alt_51 []byte = []byte(`" class="action_button delete_item">Delete</a>`)
var topic_alt_52 []byte = []byte(`
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(`
<a href="/report/submit/`)
var topic_alt_53 []byte = []byte(`?session=`)
var topic_alt_54 []byte = []byte(`&type=reply" class="action_button report_item">Report</a>
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_55 []byte = []byte(`<a href="#" class="action_button action_button_right ip_item">`)
var topic_alt_56 []byte = []byte(`</a>`)
var topic_alt_57 []byte = []byte(`
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(`
</div>
</div>
<div style="clear:both;"></div>
</div>
`)
var topic_alt_58 []byte = []byte(`</div>
var topic_alt_60 []byte = []byte(`</div>
`)
var topic_alt_59 []byte = []byte(`
var topic_alt_61 []byte = []byte(`
<div class="rowblock" style="border-top: none;">
<form action="/reply/create/" method="post">
<input name="tid" value='`)
var topic_alt_60 []byte = []byte(`' type="hidden" />
var topic_alt_62 []byte = []byte(`' type="hidden" />
<div class="formrow">
<div class="formitem"><textarea name="reply-content" placeholder="Insert reply here"></textarea></div>
</div>
@ -399,7 +405,7 @@ var topics_6 []byte = []byte(`">
<a href="/topic/`)
var topics_7 []byte = []byte(`">`)
var topics_8 []byte = []byte(`</a> `)
var topics_9 []byte = []byte(`<span class="username topic_status_e topic_status_closed" style="float: right;" title="Status: Closed">&#x1F512;&#xFE0E</span>`)
var topics_9 []byte = []byte(`<span class="username topic_status_e topic_status_closed" style="float: right;position:relative;top:-5px;" title="Status: Closed">&#x1F512;&#xFE0E</span>`)
var topics_10 []byte = []byte(`
</div>
`)
@ -407,27 +413,36 @@ var topics_11 []byte = []byte(`<div class="rowitem passive">There aren't any top
var topics_12 []byte = []byte(`
</div>
`)
var forum_0 []byte = []byte(`
var forum_0 []byte = []byte(`<div id="prevFloat" class="prev_button"><a class="prev_link" href="/forum/`)
var forum_1 []byte = []byte(`?page=`)
var forum_2 []byte = []byte(`">&lt;</a></div>`)
var forum_3 []byte = []byte(`<link rel="prerender" href="/forum/`)
var forum_4 []byte = []byte(`?page=`)
var forum_5 []byte = []byte(`" />
<div id="nextFloat" class="next_button"><a class="next_link" href="/forum/`)
var forum_6 []byte = []byte(`?page=`)
var forum_7 []byte = []byte(`">&gt;</a></div>`)
var forum_8 []byte = []byte(`
<div class="rowblock">
<div class="rowitem rowhead"><a>`)
var forum_1 []byte = []byte(`</a></div>
var forum_9 []byte = []byte(`</a></div>
</div>
<div class="rowblock">
`)
var forum_2 []byte = []byte(`<div class="rowitem passive" style="`)
var forum_3 []byte = []byte(`background-image: url(`)
var forum_4 []byte = []byte(`);background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;`)
var forum_5 []byte = []byte(`background-color: #FFFFCC;`)
var forum_6 []byte = []byte(`background-color: #eaeaea;`)
var forum_7 []byte = []byte(`">
var forum_10 []byte = []byte(`<div class="rowitem passive" style="`)
var forum_11 []byte = []byte(`background-image: url(`)
var forum_12 []byte = []byte(`);background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;`)
var forum_13 []byte = []byte(`background-color: #FFFFCC;`)
var forum_14 []byte = []byte(`background-color: #eaeaea;`)
var forum_15 []byte = []byte(`">
<a href="/topic/`)
var forum_8 []byte = []byte(`">`)
var forum_9 []byte = []byte(`</a> `)
var forum_10 []byte = []byte(`<span class="username topic_status_e topic_status_closed" title="Status: Closed" style="float: right;">&#x1F512;&#xFE0E</span>`)
var forum_11 []byte = []byte(`
var forum_16 []byte = []byte(`">`)
var forum_17 []byte = []byte(`</a> `)
var forum_18 []byte = []byte(`<span class="username topic_status_e topic_status_closed" title="Status: Closed" style="float: right;position:relative;top:-5px;">&#x1F512;&#xFE0E</span>`)
var forum_19 []byte = []byte(`
</div>
`)
var forum_12 []byte = []byte(`<div class="rowitem passive">There aren't any topics in this forum yet.</div>`)
var forum_13 []byte = []byte(`
var forum_20 []byte = []byte(`<div class="rowitem passive">There aren't any topics in this forum yet.</div>`)
var forum_21 []byte = []byte(`
</div>
`)

View File

@ -54,124 +54,128 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_4)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1)))
w.Write(topic_5)
}
w.Write(topic_6)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_6)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1)))
w.Write(topic_7)
if tmpl_topic_vars.Topic.Sticky {
}
w.Write(topic_8)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_9)
if tmpl_topic_vars.Topic.Sticky {
w.Write(topic_10)
} else {
if tmpl_topic_vars.Topic.Is_Closed {
w.Write(topic_9)
}
}
w.Write(topic_10)
w.Write([]byte(tmpl_topic_vars.Topic.Title))
w.Write(topic_11)
if tmpl_topic_vars.Topic.Is_Closed {
}
}
w.Write(topic_12)
w.Write([]byte(tmpl_topic_vars.Topic.Title))
w.Write(topic_13)
if tmpl_topic_vars.Topic.Is_Closed {
w.Write(topic_14)
}
if tmpl_topic_vars.CurrentUser.Is_Mod {
w.Write(topic_13)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_14)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_15)
if tmpl_topic_vars.Topic.Sticky {
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)
} else {
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(tmpl_topic_vars.Topic.Title))
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_21)
}
w.Write(topic_22)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write([]byte(tmpl_topic_vars.Topic.Title))
w.Write(topic_23)
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
w.Write(topic_24)
if tmpl_topic_vars.Topic.Avatar != "" {
w.Write(topic_25)
w.Write([]byte(tmpl_topic_vars.Topic.Avatar))
w.Write(topic_26)
if tmpl_topic_vars.Topic.ContentLines <= 5 {
w.Write(topic_27)
}
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)
if tmpl_topic_vars.Topic.Avatar != "" {
w.Write(topic_27)
w.Write([]byte(tmpl_topic_vars.Topic.Avatar))
w.Write(topic_28)
if tmpl_topic_vars.Topic.ContentLines <= 5 {
w.Write(topic_29)
}
w.Write(topic_30)
w.Write([]byte(string(tmpl_topic_vars.Topic.Css)))
}
w.Write(topic_29)
w.Write([]byte(string(tmpl_topic_vars.Topic.Content.(template.HTML))))
w.Write(topic_30)
w.Write([]byte(string(tmpl_topic_vars.Topic.Content.(template.HTML))))
w.Write(topic_31)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.CreatedBy)))
w.Write([]byte(string(tmpl_topic_vars.Topic.Content.(template.HTML))))
w.Write(topic_32)
w.Write([]byte(tmpl_topic_vars.Topic.CreatedByName))
w.Write([]byte(string(tmpl_topic_vars.Topic.Content.(template.HTML))))
w.Write(topic_33)
if tmpl_topic_vars.Topic.Tag != "" {
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.CreatedBy)))
w.Write(topic_34)
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_35)
w.Write(topic_37)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level)))
}
w.Write(topic_36)
w.Write(topic_38)
if len(tmpl_topic_vars.ItemList) != 0 {
for _, item := range tmpl_topic_vars.ItemList {
w.Write(topic_37)
if item.Avatar != "" {
w.Write(topic_38)
w.Write([]byte(item.Avatar))
w.Write(topic_39)
if item.ContentLines <= 5 {
if item.Avatar != "" {
w.Write(topic_40)
}
w.Write([]byte(item.Avatar))
w.Write(topic_41)
if item.ContentLines <= 5 {
w.Write(topic_42)
}
w.Write(topic_43)
w.Write([]byte(string(item.Css)))
}
w.Write(topic_42)
w.Write([]byte(string(item.ContentHtml)))
w.Write(topic_43)
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
w.Write(topic_44)
w.Write([]byte(item.CreatedByName))
w.Write([]byte(string(item.ContentHtml)))
w.Write(topic_45)
if tmpl_topic_vars.CurrentUser.Perms.EditReply {
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
w.Write(topic_46)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write([]byte(item.CreatedByName))
w.Write(topic_47)
}
if tmpl_topic_vars.CurrentUser.Perms.DeleteReply {
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([]byte(tmpl_topic_vars.CurrentUser.Session))
}
w.Write(topic_52)
if item.Tag != "" {
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_53)
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
w.Write(topic_54)
if item.Tag != "" {
w.Write(topic_55)
w.Write([]byte(item.Tag))
} else {
w.Write(topic_54)
w.Write(topic_56)
w.Write([]byte(strconv.Itoa(item.Level)))
}
w.Write(topic_55)
}
}
w.Write(topic_56)
if tmpl_topic_vars.CurrentUser.Perms.CreateReply {
w.Write(topic_57)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
}
}
w.Write(topic_58)
if tmpl_topic_vars.CurrentUser.Perms.CreateReply {
w.Write(topic_59)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_60)
}
w.Write(footer_0)
}

View File

@ -54,122 +54,126 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_4)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page + 1)))
w.Write(topic_alt_5)
}
w.Write(topic_alt_6)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_6)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page + 1)))
w.Write(topic_alt_7)
if tmpl_topic_alt_vars.Topic.Sticky {
}
w.Write(topic_alt_8)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_9)
if tmpl_topic_alt_vars.Topic.Sticky {
w.Write(topic_alt_10)
} else {
if tmpl_topic_alt_vars.Topic.Is_Closed {
w.Write(topic_alt_9)
}
}
w.Write(topic_alt_10)
w.Write([]byte(tmpl_topic_alt_vars.Topic.Title))
w.Write(topic_alt_11)
if tmpl_topic_alt_vars.Topic.Is_Closed {
}
}
w.Write(topic_alt_12)
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)
}
if tmpl_topic_alt_vars.CurrentUser.Is_Mod {
w.Write(topic_alt_13)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_14)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_15)
if tmpl_topic_alt_vars.Topic.Sticky {
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)
} else {
if tmpl_topic_alt_vars.Topic.Sticky {
w.Write(topic_alt_18)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_19)
}
} else {
w.Write(topic_alt_20)
w.Write([]byte(tmpl_topic_alt_vars.Topic.Title))
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_21)
}
w.Write(topic_alt_22)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write([]byte(tmpl_topic_alt_vars.Topic.Title))
w.Write(topic_alt_23)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
}
w.Write(topic_alt_24)
w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar))
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_25)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.CreatedBy)))
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_26)
w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName))
w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar))
w.Write(topic_alt_27)
if tmpl_topic_alt_vars.Topic.Tag != "" {
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.CreatedBy)))
w.Write(topic_alt_28)
w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag))
w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName))
w.Write(topic_alt_29)
} else {
if tmpl_topic_alt_vars.Topic.Tag != "" {
w.Write(topic_alt_30)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level)))
w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag))
w.Write(topic_alt_31)
}
} else {
w.Write(topic_alt_32)
w.Write([]byte(string(tmpl_topic_alt_vars.Topic.Content.(template.HTML))))
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level)))
w.Write(topic_alt_33)
w.Write([]byte(string(tmpl_topic_alt_vars.Topic.Content.(template.HTML))))
w.Write(topic_alt_34)
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
w.Write(topic_alt_35)
w.Write([]byte(tmpl_topic_alt_vars.Topic.IpAddress))
w.Write(topic_alt_36)
}
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(topic_alt_37)
w.Write([]byte(tmpl_topic_alt_vars.Topic.IpAddress))
w.Write(topic_alt_38)
}
w.Write(topic_alt_39)
if len(tmpl_topic_alt_vars.ItemList) != 0 {
for _, item := range tmpl_topic_alt_vars.ItemList {
w.Write(topic_alt_38)
w.Write([]byte(item.Avatar))
w.Write(topic_alt_39)
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
w.Write(topic_alt_40)
w.Write([]byte(item.CreatedByName))
w.Write([]byte(item.Avatar))
w.Write(topic_alt_41)
if item.Tag != "" {
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
w.Write(topic_alt_42)
w.Write([]byte(item.Tag))
w.Write([]byte(item.CreatedByName))
w.Write(topic_alt_43)
} else {
if item.Tag != "" {
w.Write(topic_alt_44)
w.Write([]byte(strconv.Itoa(item.Level)))
w.Write([]byte(item.Tag))
w.Write(topic_alt_45)
}
} else {
w.Write(topic_alt_46)
w.Write([]byte(string(item.ContentHtml)))
w.Write([]byte(strconv.Itoa(item.Level)))
w.Write(topic_alt_47)
if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply {
w.Write(topic_alt_48)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_49)
}
if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply {
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(topic_alt_50)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_51)
}
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([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
}
w.Write(topic_alt_54)
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_55)
w.Write([]byte(item.IpAddress))
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)
if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply {
}
w.Write(topic_alt_59)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
}
}
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)))
w.Write(topic_alt_62)
}
w.Write(footer_0)
}

View File

@ -1,10 +1,13 @@
{{template "header.html" . }}
{{if gt .Page 1}}<div id="prevFloat" class="prev_button"><a class="prev_link" href="/forum/{{.Forum.ID}}?page={{subtract .Page 1}}">&lt;</a></div>{{end}}
{{if ne .LastPage .Page}}<link rel="prerender" href="/forum/{{.Forum.ID}}?page={{add .Page 1}}" />
<div id="nextFloat" class="next_button"><a class="next_link" href="/forum/{{.Forum.ID}}?page={{add .Page 1}}">&gt;</a></div>{{end}}
<div class="rowblock">
<div class="rowitem rowhead"><a>{{.Title}}</a></div>
</div>
<div class="rowblock">
{{range .ItemList}}<div class="rowitem passive" style="{{ if .Avatar }}background-image: url({{ .Avatar }});background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;{{end}}{{ if .Sticky }}background-color: #FFFFCC;{{else if .Is_Closed}}background-color: #eaeaea;{{end}}">
<a href="/topic/{{.ID}}">{{.Title}}</a> {{if .Is_Closed}}<span class="username topic_status_e topic_status_closed" title="Status: Closed" style="float: right;">&#x1F512;&#xFE0E</span>{{end}}
{{range .ItemList}}<div class="rowitem passive" style="{{if .Avatar}}background-image: url({{.Avatar}});background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;{{end}}{{if .Sticky}}background-color: #FFFFCC;{{else if .Is_Closed}}background-color: #eaeaea;{{end}}">
<a href="/topic/{{.ID}}">{{.Title}}</a> {{if .Is_Closed}}<span class="username topic_status_e topic_status_closed" title="Status: Closed" style="float: right;position:relative;top:-5px;">&#x1F512;&#xFE0E</span>{{end}}
</div>
{{else}}<div class="rowitem passive">There aren't any topics in this forum yet.</div>{{end}}
</div>

View File

@ -5,12 +5,15 @@
</div>
<div class="colblock_right">
{{range .ItemList}}
<div class="rowitem editable_parent" style="font-weight: normal;">
<a class="editable_block" style="font-size: 20px;position:relative;top: -2px;text-transform: none;">{{.Name}}</a>
{{if ne .ID 0}}<span style="float: right;">
<div class="rowitem editable_parent" style="font-weight: normal;{{if eq .ID 1}}border-bottom-style:solid;{{end}}">
<a class="editable_block" style="font-size: 20px;position:relative;top: -2px;text-transform: none;{{if not .Active}}color:#707070;{{end}}">{{.Name}}</a>
<span style="float: right;">
{{if not .Active}}<span class="username" style="color: black;">Hidden</span>{{end}}
{{if gt .ID 1}}
<a href="/panel/forums/edit/submit/{{.ID}}" class="username edit_field">Edit</a>
<a href="/panel/forums/delete/{{.ID}}?session={{$.CurrentUser.Session}}" class="username">Delete</a>
</span>{{end}}
{{end}}
</span>
</div>
{{end}}
</div><br />
@ -23,6 +26,13 @@
<div class="formitem"><a>Forum Name</a></div>
<div class="formitem"><input name="forum-name" type="text" /></div>
</div>
<div class="formrow">
<div class="formitem"><a>Hidden?</a></div>
<div class="formitem"><select name="forum-active">
<option value="1">Yes</option>
<option value="0">No</option>
</select></div>
</div>
<div class="formrow">
<div class="formitem"><button name="panel-button" class="formbutton">Add Forum</button></div>
</div>

View File

@ -1,10 +1,10 @@
<div class="colblock_left">
<div class="rowitem rowhead"><a href="/panel/">Control Panel</a></div>
<div class="rowitem rowhead" style="border-bottom-width:2px;border-bottom-style:solid;"><a href="/panel/">Control Panel</a></div>
<div class="rowitem passive"><a href="/panel/users/">Users</a></div>
<div class="rowitem passive"><a href="/panel/groups/">Groups</a></div>
{{if .CurrentUser.Perms.ManageForums}}<div class="rowitem passive"><a href="/panel/forums/">Forums</a></div>{{end}}
{{if .CurrentUser.Perms.EditSettings}}<div class="rowitem passive"><a href="/panel/settings/">Settings</a></div>{{end}}
{{if .CurrentUser.Perms.ManageThemes}}<div class="rowitem passive"><a href="/panel/themes/">Themes</a></div>{{end}}
{{if .CurrentUser.Perms.ManagePlugins}}<div class="rowitem passive"><a href="/panel/plugins/">Plugins</a></div>{{end}}
<div class="rowitem passive"><a href="/forum/-1">Reported Content</a></div>
<div class="rowitem passive"><a href="/forum/1">Reported Content</a></div>
</div>

View File

@ -16,7 +16,7 @@
<div class="rowitem rowhead"><a>Comments</a></div>
</div>
<div class="colblock_right" style="overflow: hidden;border-top: none;">{{range .ItemList}}
<div class="rowitem passive deletable_block editable_parent simple" 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}}">
<div class="rowitem passive deletable_block editable_parent simple" 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}}">
<span class="editable_block user_content simple">{{.ContentHtml}}</span>
<br /><br />
<a href="/user/{{.CreatedBy}}" class="username">{{.CreatedByName}}</a>

View File

@ -1,11 +1,12 @@
{{template "header.html" . }}
{{if gt .Page 1}}<div class="prev_button"><a href="/topic/{{.Topic.ID}}?page={{subtract .Page 1}}">&lt;</a></div>{{end}}
{{if ne .LastPage .Page}}<div class="next_button"><a href="/topic/{{.Topic.ID}}?page={{add .Page 1}}">&gt;</a></div>{{end}}
{{if gt .Page 1}}<div id="prevFloat" class="prev_button"><a class="prev_link" href="/topic/{{.Topic.ID}}?page={{subtract .Page 1}}">&lt;</a></div>{{end}}
{{if ne .LastPage .Page}}<link rel="prerender" href="/topic/{{.Topic.ID}}?page={{add .Page 1}}" />
<div id="nextFloat" class="next_button"><a class="next_link" href="/topic/{{.Topic.ID}}?page={{add .Page 1}}">&gt;</a></div>{{end}}
<div class="rowblock">
<form action='/topic/edit/submit/{{.Topic.ID}}' method="post">
<div class="rowitem"{{if .Topic.Sticky}} style="background-color: #FFFFEA;"{{else if .Topic.Is_Closed}} style="background-color: #eaeaea;"{{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;">&#x1F512;&#xFE0E</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;">&#x1F512;&#xFE0E</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>

View File

@ -1,11 +1,12 @@
{{template "header.html" . }}
{{if gt .Page 1}}<div class="prev_button"><a href="/topic/{{.Topic.ID}}?page={{subtract .Page 1}}">&lt;</a></div>{{end}}
{{if ne .LastPage .Page}}<div class="next_button"><a href="/topic/{{.Topic.ID}}?page={{add .Page 1}}">&gt;</a></div>{{end}}
{{if gt .Page 1}}<div id="prevFloat" class="prev_button"><a class="prev_link" href="/topic/{{.Topic.ID}}?page={{subtract .Page 1}}">&lt;</a></div>{{end}}
{{if ne .LastPage .Page}}<link rel="prerender" href="/topic/{{.Topic.ID}}?page={{add .Page 1}}" />
<div id="nextFloat" class="next_button"><a class="next_link" href="/topic/{{.Topic.ID}}?page={{add .Page 1}}">&gt;</a></div>{{end}}
<div class="rowblock">
<form action='/topic/edit/submit/{{.Topic.ID}}' method="post">
<div class="rowitem 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;">&#x1F512;&#xFE0E</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;">&#x1F512;&#xFE0E</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>
@ -35,7 +36,7 @@
<textarea name="topic_content" class="show_on_edit topic_content_input">{{.Topic.Content}}</textarea>
<div class="button_container">
{{/* Element Queries might help with having to use JS. Unfortunately, the W3C is taking a while with it */}}
{{if $.CurrentUser.Perms.ViewIPs}}<a href="#" class="action_button action_button_right ip_item">{{.Topic.IpAddress}}</a>{{end}}
{{if $.CurrentUser.Perms.ViewIPs}}<a href="#" title="IP Address" class="action_button action_button_right ip_item">{{.Topic.IpAddress}}</a>{{end}}
</div>
</div><div style="clear:both;"></div>
</div>
@ -52,7 +53,7 @@
{{if $.CurrentUser.Perms.EditReply}}<a href="/reply/edit/submit/{{.ID}}" class="action_button edit_item">Edit</a>{{end}}
{{if $.CurrentUser.Perms.DeleteReply}}<a href="/reply/delete/submit/{{.ID}}" class="action_button delete_item">Delete</a>{{end}}
<a href="/report/submit/{{.ID}}?session={{$.CurrentUser.Session}}&type=reply" class="action_button report_item">Report</a>
{{if $.CurrentUser.Perms.ViewIPs}}<a href="#" class="action_button action_button_right ip_item">{{.IpAddress}}</a>{{end}}
{{if $.CurrentUser.Perms.ViewIPs}}<a href="#" title="IP Address" class="action_button action_button_right ip_item">{{.IpAddress}}</a>{{end}}
</div>
</div>
<div style="clear:both;"></div>

View File

@ -4,7 +4,7 @@
</div>
<div class="rowblock">
{{range .ItemList}}<div class="rowitem passive" style="{{if .Avatar}}background-image: url({{.Avatar}});background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;{{end}}{{if .Sticky}}background-color: #FFFFCC;{{else if .Is_Closed}}background-color: #eaeaea;{{end}}">
<a href="/topic/{{.ID}}">{{.Title}}</a> {{if .Is_Closed}}<span class="username topic_status_e topic_status_closed" style="float: right;" title="Status: Closed">&#x1F512;&#xFE0E</span>{{end}}
<a href="/topic/{{.ID}}">{{.Title}}</a> {{if .Is_Closed}}<span class="username topic_status_e topic_status_closed" style="float: right;position:relative;top:-5px;" title="Status: Closed">&#x1F512;&#xFE0E</span>{{end}}
</div>
{{else}}<div class="rowitem passive">There aren't any topics yet.</div>{{end}}
</div>

View File

@ -285,14 +285,12 @@ hr { color: silver; border: 1px solid silver; }
}
/* Mostly for textareas */
.formitem:only-child
{
width: 97%;
}
.formitem:only-child { width: 100%; }
.formitem textarea
{
width: 100%;
height: 100px;
outline-color: #8e8e8e;
}
.tbody
@ -590,6 +588,7 @@ blockquote p
padding: 0px;
padding-left: 5px;
padding-right: 5px;
z-index: 100;
}
.prev_button a, .next_button a {
@ -889,8 +888,6 @@ blockquote p
from { transform: translate(0,-50px) scale(0.75); }
to {}
}
/*.top img { min-height: 50px !important; }
.top h1 { display: none; }*/
.right_most { margin-right: 15%; }
#back

View File

@ -283,14 +283,12 @@ hr { color: silver; border: 1px solid silver; }
}
/* Mostly for textareas */
.formitem:only-child
{
width: 97%;
}
.formitem:only-child { width: 100%; }
.formitem textarea
{
width: 100%;
height: 100px;
outline-color: #8e8e8e;
}
.tbody
@ -634,6 +632,7 @@ blockquote p
padding: 0px;
padding-left: 5px;
padding-right: 5px;
z-index: 100;
}
.prev_button a, .next_button a {

View File

@ -7,14 +7,12 @@
body
{
font-family: arial;
padding-bottom: 8px;
}
/* Patch for Edge */
@supports (-ms-ime-align:auto) {
.user_content
{
font-family: Segoe UI Emoji, arial;
}
.user_content { font-family: Segoe UI Emoji, arial; }
}
/*.move_left{float: left;position: relative;left: 50%;}
@ -205,14 +203,12 @@ li a
border: none;
}
/* Mostly for textareas */
.formitem:only-child
{
width: 97%;
}
.formitem:only-child { width: 100%; }
.formitem textarea
{
width: 100%;
height: 100px;
outline-color: #8e8e8e;
}
.formitem:has-child()
{
@ -429,6 +425,7 @@ button.username
padding: 0px;
padding-left: 5px;
padding-right: 5px;
z-index: 100;
}
.prev_button a, .next_button a {
line-height: 28px;
@ -478,6 +475,7 @@ button.username
.menu_right { padding-right: 5px; }
.menu_create_topic { display: none;}
.hide_on_mobile { display: none; }
.prev_button, .next_button { top: auto;bottom: 5px; }
}
@media (max-width: 470px) {

View File

@ -7,14 +7,12 @@
body
{
font-family: arial;
padding-bottom: 8px;
}
/* Patch for Edge */
@supports (-ms-ime-align:auto) {
.user_content
{
font-family: Segoe UI Emoji, arial;
}
.user_content { font-family: Segoe UI Emoji, arial; }
}
/*.move_left{float: left;position: relative;left: 50%;}
@ -71,10 +69,7 @@ li a
padding: 0px;
padding-top: 0px;
}
.rowblock:empty
{
display: none;
}
.rowblock:empty { display: none; }
.colblock_left
{
@ -94,14 +89,8 @@ li a
overflow: hidden;
word-wrap: break-word;
}
.colblock_left:empty
{
display: none;
}
.colblock_right:empty
{
display: none;
}
.colblock_left:empty { display: none; }
.colblock_right:empty { display: none; }
.rowitem
{
@ -127,10 +116,7 @@ li a
text-decoration: none;
color: black;
}
.rowitem a:hover
{
color: silver;
}
.rowitem a:hover { color: silver; }
.col_left
{
@ -161,10 +147,7 @@ li a
text-decoration: none;
color: black;
}
.colitem a:hover
{
color: silver;
}
.colitem a:hover { color: silver; }
.formrow
{
@ -214,14 +197,12 @@ li a
}
/* Mostly for textareas */
.formitem:only-child
{
width: 97%;
}
.formitem:only-child { width: 100%; }
.formitem textarea
{
width: 100%;
height: 100px;
outline-color: #8e8e8e;
}
.formitem:has-child()
{
@ -287,11 +268,7 @@ button.username
font-size: 10px;
}
.show_on_edit
{
display: none;
}
.show_on_edit { display: none; }
.alert
{
display: block;
@ -326,6 +303,7 @@ button.username
padding: 0px;
padding-left: 5px;
padding-right: 5px;
z-index: 100;
}
.prev_button a, .next_button a {
@ -378,6 +356,7 @@ button.username
.menu_right { padding-right: 5px; }
.menu_create_topic { display: none;}
.hide_on_mobile { display: none; }
.prev_button, .next_button { top: auto;bottom: 5px; }
}
@media (max-width: 470px) {

View File

@ -1,2 +1,4 @@
echo "Updating the MySQL Driver"
go get -u github.com/go-sql-driver/mysql
echo "Updating bcrypt"
go get -u golang.org/x/crypto/bcrypt

View File

@ -1,13 +1,17 @@
@echo off
echo Updating the MySQL Driver
go get -u github.com/go-sql-driver/mysql
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Updating bcrypt
go get -u golang.org/x/crypto/bcrypt
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo The dependencies were successfully updated
pause

View File

@ -186,3 +186,10 @@ func getLevels(maxLevel int) []float64 {
}
return out
}
func fill_forum_id_gap(biggerID int, smallerID int) {
dummy := Forum{0,"",false,0,"",0,"",0,""}
for i := smallerID; i > biggerID;i++ {
forums = append(forums, dummy)
}
}