Added the query generator. It's a work in progress and in constant flux.

Added forum descriptions.
Began work on the Advanced Forum Editor. Not to be confused with the Quick Forum Editor. You can access it by going to /panel/forums/edit/{forumid} We'll fix it so the Forum Manager links to it in the next commit.
Fixed the Linux shell scripts.
Fixed an issue with relative timess being off by an hour due to timezones.
Added reply count and author names to the topic list and forum pages.
Improved the look of the forum list, forum page, and topic list.
Added an overlay effect for when the alert list is open on mobile.
You can now close the alert list by clicking on the bell.
Removed the "Report:" prefix from report posts.
Fixed a bug in the template system where "and" and "or" wouldn't work on non-boolean values.
Improved the debug logging in the template system.
Fixed a bug in the forum creator where the "Hidden?" value was inverted.
Fixed a visual bug in the profile where the Ban button rendered in a glitchy way.
Added support for hidden fields to the JS Framework for inline editing rows.
Fixed a bug with the like counter rendering on-top of the alert list.
Atom's stripping trailing tabs for some reason, so don't be confused if there are a bunch of weird changes.
This commit is contained in:
Azareal 2017-06-05 12:57:27 +01:00
parent 9b1489b90f
commit e099dfd40e
48 changed files with 1879 additions and 1232 deletions

View File

@ -1,4 +1,8 @@
echo "Building Gosora" echo "Building Gosora"
go generate
go build -o Gosora go build -o Gosora
echo "Building the installer" echo "Building the installer"
go build ./install cd ./install
go build -o Install
mv ./Install ..
cd ..

View File

@ -1,4 +1,8 @@
echo "Building Gosora" echo "Building Gosora"
go generate
go build -o Gosora -tags no_ws go build -o Gosora -tags no_ws
echo "Building the installer" echo "Building the installer"
go build ./install cd ./install
go build -o Install
mv ./Install ..
cd ..

View File

@ -26,5 +26,12 @@ if %errorlevel% neq 0 (
pause pause
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Building the query generator
go build ./query_gen
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Gosora was successfully built echo Gosora was successfully built
pause pause

View File

@ -26,5 +26,12 @@ if %errorlevel% neq 0 (
pause pause
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Building the query generator
go build ./query_gen
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Gosora was successfully built echo Gosora was successfully built
pause pause

View File

@ -46,6 +46,7 @@ CREATE TABLE `emails`(
CREATE TABLE `forums`( CREATE TABLE `forums`(
`fid` int not null AUTO_INCREMENT, `fid` int not null AUTO_INCREMENT,
`name` varchar(100) not null, `name` varchar(100) not null,
`desc` varchar(200) not null,
`active` tinyint DEFAULT 1 not null, `active` tinyint DEFAULT 1 not null,
`topicCount` int DEFAULT 0 not null, `topicCount` int DEFAULT 0 not null,
`preset` varchar(100) DEFAULT '' not null, `preset` varchar(100) DEFAULT '' not null,
@ -71,6 +72,7 @@ CREATE TABLE `topics`(
`parsed_content` text not null, `parsed_content` text not null,
`createdAt` datetime not null, `createdAt` datetime not null,
`lastReplyAt` datetime not null, `lastReplyAt` datetime not null,
/*`lastReplyBy` int not null,*/
`createdBy` int not null, `createdBy` int not null,
`is_closed` tinyint DEFAULT 0 not null, `is_closed` tinyint DEFAULT 0 not null,
`sticky` tinyint DEFAULT 0 not null, `sticky` tinyint DEFAULT 0 not null,
@ -79,6 +81,7 @@ CREATE TABLE `topics`(
`postCount` int DEFAULT 1 not null, `postCount` int DEFAULT 1 not null,
`likeCount` int DEFAULT 0 not null, `likeCount` int DEFAULT 0 not null,
`words` int DEFAULT 0 not null, `words` int DEFAULT 0 not null,
`css_class` varchar(100) DEFAULT '' not null,
`data` varchar(200) DEFAULT '' not null, `data` varchar(200) DEFAULT '' not null,
primary key(`tid`) primary key(`tid`)
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci; ) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;

View File

@ -10,6 +10,7 @@ type ForumAdmin struct
{ {
ID int ID int
Name string Name string
Desc string
Active bool Active bool
Preset string Preset string
TopicCount int TopicCount int
@ -20,6 +21,7 @@ type Forum struct
{ {
ID int ID int
Name string Name string
Desc string
Active bool Active bool
Preset string Preset string
TopicCount int TopicCount int
@ -39,7 +41,7 @@ type ForumSimple struct
} }
var forum_update_mutex sync.Mutex var forum_update_mutex sync.Mutex
func create_forum(forum_name string, active bool, preset string) (int, error) { func create_forum(forum_name string, forum_desc string, active bool, preset string) (int, error) {
var fid int var fid int
err := forum_entry_exists_stmt.QueryRow().Scan(&fid) err := forum_entry_exists_stmt.QueryRow().Scan(&fid)
if err != nil && err != sql.ErrNoRows { if err != nil && err != sql.ErrNoRows {
@ -47,18 +49,19 @@ func create_forum(forum_name string, active bool, preset string) (int, error) {
} }
if err != sql.ErrNoRows { if err != sql.ErrNoRows {
forum_update_mutex.Lock() forum_update_mutex.Lock()
_, err = update_forum_stmt.Exec(forum_name, active, preset, fid) _, err = update_forum_stmt.Exec(forum_name, forum_desc, active, preset, fid)
if err != nil { if err != nil {
return fid, err return fid, err
} }
forums[fid].Name = forum_name forums[fid].Name = forum_name
forums[fid].Desc = forum_desc
forums[fid].Active = active forums[fid].Active = active
forums[fid].Preset = preset forums[fid].Preset = preset
forum_update_mutex.Unlock() forum_update_mutex.Unlock()
return fid, nil return fid, nil
} }
res, err := create_forum_stmt.Exec(forum_name, active, preset) res, err := create_forum_stmt.Exec(forum_name, forum_desc, active, preset)
if err != nil { if err != nil {
return 0, err return 0, err
} }
@ -69,7 +72,7 @@ func create_forum(forum_name string, active bool, preset string) (int, error) {
} }
fid = int(fid64) fid = int(fid64)
forums = append(forums, Forum{fid,forum_name,active,preset,0,"",0,"",0,""}) forums = append(forums, Forum{fid,forum_name,forum_desc,active,preset,0,"",0,"",0,""})
return fid, nil return fid, nil
} }
@ -90,14 +93,14 @@ func get_forum(fid int) (forum *Forum, res bool) {
} }
func get_forum_copy(fid int) (forum Forum, res bool) { func get_forum_copy(fid int) (forum Forum, res bool) {
if !((fid <= forumCapCount) && (fid >= 0) && forums[fid].Name!="") { if !((fid <= forumCapCount) && (fid >= 0) && forums[fid].Name != "") {
return forum, false return forum, false
} }
return forums[fid], true return forums[fid], true
} }
func forum_exists(fid int) bool { func forum_exists(fid int) bool {
return (fid <= forumCapCount) && (fid >= 0) && forums[fid].Name!="" return (fid <= forumCapCount) && (fid >= 0) && forums[fid].Name != ""
} }
func build_forum_url(fid int) string { func build_forum_url(fid int) string {

63
gen_mysql.go Normal file
View File

@ -0,0 +1,63 @@
/* This file was generated by Gosora's Query Generator */
package main
import "log"
import "database/sql"
var get_user_stmt *sql.Stmt
var get_full_user_stmt *sql.Stmt
var get_topic_stmt *sql.Stmt
var get_reply_stmt *sql.Stmt
var login_stmt *sql.Stmt
var get_password_stmt *sql.Stmt
var username_exists_stmt *sql.Stmt
func gen_mysql() (err error) {
if debug {
log.Print("Building the generated statements")
}
log.Print("Preparing get_user statement.")
get_user_stmt, err = db.Prepare("SELECT `name`,`group`,`is_super_admin`,`avatar`,`message`,`url_prefix`,`url_name`,`level` FROM users WHERE `uid`= ?")
if err != nil {
return err
}
log.Print("Preparing get_full_user statement.")
get_full_user_stmt, err = db.Prepare("SELECT `name`,`group`,`is_super_admin`,`session`,`email`,`avatar`,`message`,`url_prefix`,`url_name`,`level`,`score`,`last_ip` FROM users WHERE `uid`= ?")
if err != nil {
return err
}
log.Print("Preparing get_topic statement.")
get_topic_stmt, err = db.Prepare("SELECT `title`,`content`,`createdBy`,`createdAt`,`is_closed`,`sticky`,`parentID`,`ipaddress`,`postCount`,`likeCount` FROM topics WHERE `tid`= ?")
if err != nil {
return err
}
log.Print("Preparing get_reply statement.")
get_reply_stmt, err = db.Prepare("SELECT `content`,`createdBy`,`createdAt`,`lastEdit`,`lastEditBy`,`ipaddress`,`likeCount` FROM replies WHERE `rid`= ?")
if err != nil {
return err
}
log.Print("Preparing login statement.")
login_stmt, err = db.Prepare("SELECT `uid`,`name`,`password`,`salt` FROM users WHERE `name`= ?")
if err != nil {
return err
}
log.Print("Preparing get_password statement.")
get_password_stmt, err = db.Prepare("SELECT `password`,`salt` FROM users WHERE `uid`= ?")
if err != nil {
return err
}
log.Print("Preparing username_exists statement.")
username_exists_stmt, err = db.Prepare("SELECT `name` FROM users WHERE `name`= ?")
if err != nil {
return err
}
return nil
}

View File

@ -1,6 +1,5 @@
// Code generated by. DO NOT EDIT. // Code generated by. DO NOT EDIT.
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ /* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
// The router generator might be discontinued in favour of syncmaps in Go 1.9, it will be temporarily used for a couple of months as a lockless alternative to maps
package main package main
//import "fmt" //import "fmt"
@ -102,6 +101,9 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
case "/panel/forums/edit/submit/": case "/panel/forums/edit/submit/":
route_panel_forums_edit_submit(w,req,extra_data) route_panel_forums_edit_submit(w,req,extra_data)
return return
case "/panel/forums/edit/perms/submit/":
route_panel_forums_edit_perms_submit(w,req,extra_data)
return
case "/panel/settings/": case "/panel/settings/":
route_panel_settings(w,req) route_panel_settings(w,req)
return return

17
main.go
View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"log" "log"
"mime" "mime"
"time"
"strings" "strings"
"path/filepath" "path/filepath"
"io" "io"
@ -32,6 +33,8 @@ const saltLength int = 32
const sessionLength int = 80 const sessionLength int = 80
var enable_websockets bool = false // Don't change this, the value is overwritten by an initialiser var enable_websockets bool = false // Don't change this, the value is overwritten by an initialiser
var startTime time.Time
var timeLocation *time.Location
var templates = template.New("") var templates = template.New("")
var no_css_tmpl = template.CSS("") var no_css_tmpl = template.CSS("")
var staff_css_tmpl = template.CSS(staff_css) var staff_css_tmpl = template.CSS(staff_css)
@ -40,8 +43,7 @@ var external_sites map[string]string = make(map[string]string)
var groups []Group var groups []Group
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 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 forum_perms map[int]map[int]ForumPerms // [gid][fid]Perms var forum_perms map[int]map[int]ForumPerms // [gid][fid]Perms
var groupCapCount int var groupCapCount, forumCapCount int
var forumCapCount int
var static_files map[string]SFile = make(map[string]SFile) var static_files map[string]SFile = make(map[string]SFile)
var template_topic_handle func(TopicPage,io.Writer) = nil var template_topic_handle func(TopicPage,io.Writer) = nil
@ -59,7 +61,7 @@ func compile_templates() {
log.Print("Compiling the templates") log.Print("Compiling the templates")
topic := TopicUser{1,"Blah","Hey there!",0,false,false,"Date","Date",0,"","127.0.0.1",0,1,"",default_group,"",no_css_tmpl,0,"","","","",58,false} topic := TopicUser{1,"Blah","Hey there!",0,false,false,"Date","Date",0,"","127.0.0.1",0,1,"classname","",default_group,"",no_css_tmpl,0,"","","","",58,false}
var replyList []Reply var replyList []Reply
replyList = append(replyList, Reply{0,0,"","Yo!",0,"",default_group,"",0,0,"",no_css_tmpl,0,"","","","",0,"127.0.0.1",false,1,"",""}) replyList = append(replyList, Reply{0,0,"","Yo!",0,"",default_group,"",0,0,"",no_css_tmpl,0,"","","","",0,"127.0.0.1",false,1,"",""})
@ -83,13 +85,13 @@ func compile_templates() {
forums_tmpl := c.compile_template("forums.html","templates/","ForumsPage", forums_page, varList) forums_tmpl := c.compile_template("forums.html","templates/","ForumsPage", forums_page, varList)
var topicsList []TopicsRow var topicsList []TopicsRow
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"}) topicsList = append(topicsList,TopicsRow{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"classname","Admin","","",0,"","","","",58,"General"})
topics_page := TopicsPage{"Topic List",user,noticeList,topicsList,""} topics_page := TopicsPage{"Topic List",user,noticeList,topicsList,""}
topics_tmpl := c.compile_template("topics.html","templates/","TopicsPage", topics_page, varList) topics_tmpl := c.compile_template("topics.html","templates/","TopicsPage", topics_page, varList)
var topicList []TopicUser var topicList []TopicUser
topicList = append(topicList,TopicUser{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"Admin",default_group,"","",0,"","","","",58,false}) topicList = append(topicList,TopicUser{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"classname","Admin",default_group,"","",0,"","","","",58,false})
forum_item := Forum{1,"General Forum",true,"all",0,"",0,"",0,""} forum_item := Forum{1,"General Forum","Where the general stuff happens",true,"all",0,"",0,"",0,""}
forum_page := ForumPage{"General Forum",user,noticeList,topicList,forum_item,1,1,nil} 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) forum_tmpl := c.compile_template("forum.html","templates/","ForumPage", forum_page, varList)
@ -167,6 +169,8 @@ func main(){
log.Print("Running Gosora v" + version.String()) log.Print("Running Gosora v" + version.String())
fmt.Println("") fmt.Println("")
startTime = time.Now()
timeLocation = startTime.Location()
init_themes() init_themes()
err := init_database() err := init_database()
@ -255,6 +259,7 @@ func main(){
///router.HandleFunc("/panel/forums/delete/submit/", route_panel_forums_delete_submit) ///router.HandleFunc("/panel/forums/delete/submit/", route_panel_forums_delete_submit)
///router.HandleFunc("/panel/forums/edit/", route_panel_forums_edit) ///router.HandleFunc("/panel/forums/edit/", route_panel_forums_edit)
///router.HandleFunc("/panel/forums/edit/submit/", route_panel_forums_edit_submit) ///router.HandleFunc("/panel/forums/edit/submit/", route_panel_forums_edit_submit)
///router.HandleFunc("/panel/forums/edit/perms/submit/", route_panel_forums_edit_perms_submit)
///router.HandleFunc("/panel/settings/", route_panel_settings) ///router.HandleFunc("/panel/settings/", route_panel_settings)
///router.HandleFunc("/panel/settings/edit/", route_panel_setting) ///router.HandleFunc("/panel/settings/edit/", route_panel_setting)
///router.HandleFunc("/panel/settings/edit/submit/", route_panel_setting_edit) ///router.HandleFunc("/panel/settings/edit/submit/", route_panel_setting_edit)

View File

@ -12,15 +12,11 @@ var db *sql.DB
var db_version string var db_version string
var db_collation string = "utf8mb4_general_ci" var db_collation string = "utf8mb4_general_ci"
var get_user_stmt *sql.Stmt
var get_full_user_stmt *sql.Stmt
var get_topic_list_stmt *sql.Stmt var get_topic_list_stmt *sql.Stmt
var get_topic_user_stmt *sql.Stmt var get_topic_user_stmt *sql.Stmt
var get_topic_stmt *sql.Stmt
var get_topic_by_reply_stmt *sql.Stmt var get_topic_by_reply_stmt *sql.Stmt
var get_topic_replies_stmt *sql.Stmt var get_topic_replies_stmt *sql.Stmt
var get_topic_replies_offset_stmt *sql.Stmt var get_topic_replies_offset_stmt *sql.Stmt
var get_reply_stmt *sql.Stmt
var get_forum_topics_stmt *sql.Stmt var get_forum_topics_stmt *sql.Stmt
var get_forum_topics_offset_stmt *sql.Stmt var get_forum_topics_offset_stmt *sql.Stmt
var create_topic_stmt *sql.Stmt var create_topic_stmt *sql.Stmt
@ -47,18 +43,15 @@ var stick_topic_stmt *sql.Stmt
var unstick_topic_stmt *sql.Stmt var unstick_topic_stmt *sql.Stmt
var get_activity_feed_by_watcher_stmt *sql.Stmt var get_activity_feed_by_watcher_stmt *sql.Stmt
var update_last_ip_stmt *sql.Stmt var update_last_ip_stmt *sql.Stmt
var login_stmt *sql.Stmt
var update_session_stmt *sql.Stmt var update_session_stmt *sql.Stmt
var logout_stmt *sql.Stmt var logout_stmt *sql.Stmt
var set_password_stmt *sql.Stmt var set_password_stmt *sql.Stmt
var get_password_stmt *sql.Stmt
var set_avatar_stmt *sql.Stmt var set_avatar_stmt *sql.Stmt
var set_username_stmt *sql.Stmt var set_username_stmt *sql.Stmt
var add_email_stmt *sql.Stmt var add_email_stmt *sql.Stmt
var update_email_stmt *sql.Stmt var update_email_stmt *sql.Stmt
var verify_email_stmt *sql.Stmt var verify_email_stmt *sql.Stmt
var register_stmt *sql.Stmt var register_stmt *sql.Stmt
var username_exists_stmt *sql.Stmt
var change_group_stmt *sql.Stmt var change_group_stmt *sql.Stmt
var activate_user_stmt *sql.Stmt var activate_user_stmt *sql.Stmt
var update_user_level_stmt *sql.Stmt var update_user_level_stmt *sql.Stmt
@ -82,6 +75,8 @@ var add_forum_perms_to_forum_admins_stmt *sql.Stmt
var add_forum_perms_to_forum_staff_stmt *sql.Stmt var add_forum_perms_to_forum_staff_stmt *sql.Stmt
var add_forum_perms_to_forum_members_stmt *sql.Stmt var add_forum_perms_to_forum_members_stmt *sql.Stmt
var add_forum_perms_to_group_stmt *sql.Stmt var add_forum_perms_to_group_stmt *sql.Stmt
//var forum_perm_exists_for_group_stmt *sql.Stmt
var update_forum_perms_for_group_stmt *sql.Stmt
var update_setting_stmt *sql.Stmt var update_setting_stmt *sql.Stmt
var add_plugin_stmt *sql.Stmt var add_plugin_stmt *sql.Stmt
var update_plugin_stmt *sql.Stmt var update_plugin_stmt *sql.Stmt
@ -118,20 +113,8 @@ func init_database() (err error) {
// Set the number of max open connections // Set the number of max open connections
db.SetMaxOpenConns(64) db.SetMaxOpenConns(64)
/*log.Print("Preparing get_session statement.") // Build the generated prepared statements, we are going to slowly move the queries over to the query generator rather than writing them all by hand, this'll make it easier for us to implement database adapters for other databases like PostgreSQL, MSSQL, SQlite, etc.
get_session_stmt, err = db.Prepare("select `uid`,`name`,`group`,`is_super_admin`,`session`,`email`,`avatar`,`message`,`url_prefix`,`url_name`,`level`,`score`,`last_ip` from `users` where `uid` = ? and `session` = ? AND `session` <> ''") err = gen_mysql()
if err != nil {
return err
}*/
log.Print("Preparing get_user statement.")
get_user_stmt, err = db.Prepare("select `name`,`group`,`is_super_admin`,`avatar`,`message`,`url_prefix`,`url_name`,`level` from `users` where `uid` = ?")
if err != nil {
return err
}
log.Print("Preparing get_full_user statement.")
get_full_user_stmt, err = db.Prepare("select `name`,`group`,`is_super_admin`,`session`,`email`,`avatar`,`message`,`url_prefix`,`url_name`,`level`,`score`,`last_ip` from `users` where `uid` = ?")
if err != nil { if err != nil {
return err return err
} }
@ -148,12 +131,6 @@ func init_database() (err error) {
return err return err
} }
log.Print("Preparing get_topic statement.")
get_topic_stmt, err = db.Prepare("select title, content, createdBy, createdAt, is_closed, sticky, parentID, ipaddress, postCount, likeCount from topics where tid = ?")
if err != nil {
return err
}
log.Print("Preparing get_topic_by_reply statement.") log.Print("Preparing get_topic_by_reply statement.")
get_topic_by_reply_stmt, err = db.Prepare("select topics.tid, topics.title, topics.content, topics.createdBy, topics.createdAt, topics.is_closed, topics.sticky, topics.parentID, topics.ipaddress, topics.postCount, topics.likeCount from replies left join topics on replies.tid = topics.tid where rid = ?") get_topic_by_reply_stmt, err = db.Prepare("select topics.tid, topics.title, topics.content, topics.createdBy, topics.createdAt, topics.is_closed, topics.sticky, topics.parentID, topics.ipaddress, topics.postCount, topics.likeCount from replies left join topics on replies.tid = topics.tid where rid = ?")
if err != nil { if err != nil {
@ -172,12 +149,6 @@ func init_database() (err error) {
return err return err
} }
log.Print("Preparing get_reply statement.")
get_reply_stmt, err = db.Prepare("select content, createdBy, createdAt, lastEdit, lastEditBy, ipaddress, likeCount from replies where rid = ?")
if err != nil {
return err
}
log.Print("Preparing get_forum_topics statement.") 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.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") get_forum_topics_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")
if err != nil { if err != nil {
@ -185,7 +156,7 @@ func init_database() (err error) {
} }
log.Print("Preparing get_forum_topics_offset statement.") 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, 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)) 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.postCount, 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 { if err != nil {
return err return err
} }
@ -197,7 +168,7 @@ func init_database() (err error) {
} }
log.Print("Preparing create_report statement.") log.Print("Preparing create_report statement.")
create_report_stmt, err = db.Prepare("INSERT INTO topics(title,content,parsed_content,createdAt,lastReplyAt,createdBy,data,parentID) VALUES(?,?,?,NOW(),NOW(),?,?,1)") create_report_stmt, err = db.Prepare("INSERT INTO topics(title,content,parsed_content,createdAt,lastReplyAt,createdBy,data,parentID,css_class) VALUES(?,?,?,NOW(),NOW(),?,?,1,'report')")
if err != nil { if err != nil {
return err return err
} }
@ -334,12 +305,6 @@ func init_database() (err error) {
return err return err
} }
log.Print("Preparing login statement.")
login_stmt, err = db.Prepare("SELECT `uid`,`name`,`password`,`salt` FROM `users` WHERE `name` = ?")
if err != nil {
return err
}
log.Print("Preparing update_session statement.") log.Print("Preparing update_session statement.")
update_session_stmt, err = db.Prepare("UPDATE users SET session = ? WHERE uid = ?") update_session_stmt, err = db.Prepare("UPDATE users SET session = ? WHERE uid = ?")
if err != nil { if err != nil {
@ -358,12 +323,6 @@ func init_database() (err error) {
return err return err
} }
log.Print("Preparing get_password statement.")
get_password_stmt, err = db.Prepare("SELECT `password`,`salt` FROM `users` WHERE `uid` = ?")
if err != nil {
return err
}
log.Print("Preparing set_avatar statement.") log.Print("Preparing set_avatar statement.")
set_avatar_stmt, err = db.Prepare("UPDATE users SET avatar = ? WHERE uid = ?") set_avatar_stmt, err = db.Prepare("UPDATE users SET avatar = ? WHERE uid = ?")
if err != nil { if err != nil {
@ -385,12 +344,6 @@ func init_database() (err error) {
return err return err
} }
log.Print("Preparing username_exists statement.")
username_exists_stmt, err = db.Prepare("SELECT `name` FROM `users` WHERE `name` = ?")
if err != nil {
return err
}
log.Print("Preparing change_group statement.") 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 { if err != nil {
@ -476,20 +429,20 @@ func init_database() (err error) {
} }
log.Print("Preparing create_forum statement.") log.Print("Preparing create_forum statement.")
create_forum_stmt, err = db.Prepare("INSERT INTO forums(name,active,preset) VALUES(?,?,?)") create_forum_stmt, err = db.Prepare("INSERT INTO forums(`name`,`desc`,`active`,`preset`) VALUES(?,?,?,?)")
if err != nil { if err != nil {
return err return err
} }
log.Print("Preparing delete_forum statement.") 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 = ?") delete_forum_stmt, err = db.Prepare("update forums set name= '', active = 0 where fid = ?")
if err != nil { if err != nil {
return err return err
} }
log.Print("Preparing update_forum statement.") log.Print("Preparing update_forum statement.")
update_forum_stmt, err = db.Prepare("update forums set name = ?, active = ?, preset = ? where fid = ?") update_forum_stmt, err = db.Prepare("update forums set `name` = ?, `desc` = ?, `active` = ?, `preset` = ? where fid = ?")
if err != nil { if err != nil {
return err return err
} }
@ -537,7 +490,7 @@ func init_database() (err error) {
} }
log.Print("Preparing add_forum_perms_to_group statement.") log.Print("Preparing add_forum_perms_to_group statement.")
add_forum_perms_to_group_stmt, err = db.Prepare("INSERT INTO forums_permissions(gid,fid,preset,permissions) VALUES(?,?,?,?)") add_forum_perms_to_group_stmt, err = db.Prepare("REPLACE INTO forums_permissions(gid,fid,preset,permissions) VALUES(?,?,?,?)")
if err != nil { if err != nil {
return err return err
} }
@ -660,10 +613,10 @@ func init_database() (err error) {
log.Print("Loading the forums.") log.Print("Loading the forums.")
log.Print("Adding the uncategorised forum") log.Print("Adding the uncategorised forum")
forums = append(forums, Forum{0,"Uncategorised",uncategorised_forum_visible,"all",0,"",0,"",0,""}) forums = append(forums, Forum{0,"Uncategorised","",uncategorised_forum_visible,"all",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, lastTopic, lastTopicID, lastReplyer, lastReplyerID, lastTopicTime FROM forums")
rows, err = db.Query("select fid, name, active, preset, topicCount, lastTopic, lastTopicID, lastReplyer, lastReplyerID, lastTopicTime from forums order by fid asc") rows, err = db.Query("select `fid`, `name`, `desc`, `active`, `preset`, `topicCount`, `lastTopic`, `lastTopicID`, `lastReplyer`, `lastReplyerID`, `lastTopicTime` from forums order by fid asc")
if err != nil { if err != nil {
return err return err
} }
@ -672,7 +625,7 @@ func init_database() (err error) {
i = 1 i = 1
for ;rows.Next();i++ { for ;rows.Next();i++ {
forum := Forum{ID:0,Name:"",Active:true,Preset:"all"} forum := Forum{ID:0,Name:"",Active:true,Preset:"all"}
err := rows.Scan(&forum.ID, &forum.Name, &forum.Active, &forum.Preset, &forum.TopicCount, &forum.LastTopic, &forum.LastTopicID, &forum.LastReplyer, &forum.LastReplyerID, &forum.LastTopicTime) err := rows.Scan(&forum.ID, &forum.Name, &forum.Desc, &forum.Active, &forum.Preset, &forum.TopicCount, &forum.LastTopic, &forum.LastTopicID, &forum.LastReplyer, &forum.LastReplyerID, &forum.LastTopicTime)
if err != nil { if err != nil {
return err return err
} }
@ -683,16 +636,6 @@ func init_database() (err error) {
fill_forum_id_gap(i, forum.ID) fill_forum_id_gap(i, forum.ID)
} }
/*if forum.LastTopicID != 0 {
forum.LastTopicTime, err = relative_time(forum.LastTopicTime)
if err != nil {
return err
}
} else {
forum.LastTopic = "None"
forum.LastTopicTime = ""
}*/
if forum.Name == "" { if forum.Name == "" {
if debug { if debug {
log.Print("Adding a placeholder forum") log.Print("Adding a placeholder forum")
@ -782,10 +725,7 @@ func init_database() (err error) {
} }
defer rows.Close() defer rows.Close()
var sname string var sname, scontent, stype, sconstraints string
var scontent string
var stype string
var sconstraints string
for rows.Next() { for rows.Next() {
err := rows.Scan(&sname, &scontent, &stype, &sconstraints) err := rows.Scan(&sname, &scontent, &stype, &sconstraints)
if err != nil { if err != nil {

View File

@ -120,6 +120,26 @@ type EditGroupPage struct
ExtData interface{} ExtData interface{}
} }
type GroupForumPermPreset struct
{
Group Group
Preset string
}
type EditForumPage struct
{
Title string
CurrentUser User
NoticeList []string
ID int
Name string
Desc string
Active bool
Preset string
Groups []GroupForumPermPreset
ExtData interface{}
}
type NameLangPair struct type NameLangPair struct
{ {
Name string Name string

View File

@ -206,7 +206,7 @@ func route_panel_forums(w http.ResponseWriter, r *http.Request){
var forumList []interface{} var forumList []interface{}
for _, forum := range forums { for _, forum := range forums {
if forum.Name != "" { if forum.Name != "" {
fadmin := ForumAdmin{forum.ID,forum.Name,forum.Active,forum.Preset,forum.TopicCount,preset_to_lang(forum.Preset)} fadmin := ForumAdmin{forum.ID,forum.Name,forum.Desc,forum.Active,forum.Preset,forum.TopicCount,preset_to_lang(forum.Preset)}
if fadmin.Preset == "" { if fadmin.Preset == "" {
fadmin.Preset = "custom" fadmin.Preset = "custom"
} }
@ -240,17 +240,13 @@ func route_panel_forums_create_submit(w http.ResponseWriter, r *http.Request){
return return
} }
var active bool
fname := r.PostFormValue("forum-name") fname := r.PostFormValue("forum-name")
fdesc := r.PostFormValue("forum-desc")
fpreset := strip_invalid_preset(r.PostFormValue("forum-preset")) fpreset := strip_invalid_preset(r.PostFormValue("forum-preset"))
factive := r.PostFormValue("forum-name") factive := r.PostFormValue("forum-name")
if factive == "on" || factive == "1" { active := (factive == "on" || factive == "1" )
active = true
} else {
active = false
}
fid, err := create_forum(fname,active,fpreset) fid, err := create_forum(fname,fdesc,active,fpreset)
if err != nil { if err != nil {
InternalError(err,w,r) InternalError(err,w,r)
return return
@ -344,8 +340,25 @@ func route_panel_forums_edit(w http.ResponseWriter, r *http.Request, sfid string
return return
} }
pi := Page{"Forum Editor",user,noticeList,tList,nil} var forum Forum = forums[fid]
templates.ExecuteTemplate(w,"panel-forum-edit.html",pi) if forum.Preset == "" {
forum.Preset = "custom"
}
var glist []Group = groups
var gplist []GroupForumPermPreset
for gid, group := range glist {
if gid == 0 {
continue
}
gplist = append(gplist,GroupForumPermPreset{group,forum_perms_to_group_forum_preset(group.Forums[fid])})
}
pi := EditForumPage{"Forum Editor",user,noticeList,forum.ID,forum.Name,forum.Desc,forum.Active,forum.Preset,gplist,nil}
err = templates.ExecuteTemplate(w,"panel-forum-edit.html",pi)
if err != nil {
InternalError(err,w,r)
}
} }
func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, sfid string) { func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, sfid string) {
@ -379,6 +392,7 @@ func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, sfid
} }
forum_name := r.PostFormValue("forum_name") forum_name := r.PostFormValue("forum_name")
forum_desc := r.PostFormValue("forum_desc")
forum_preset := strip_invalid_preset(r.PostFormValue("forum_preset")) forum_preset := strip_invalid_preset(r.PostFormValue("forum_preset"))
forum_active := r.PostFormValue("forum_active") forum_active := r.PostFormValue("forum_active")
if !forum_exists(fid) { if !forum_exists(fid) {
@ -386,11 +400,6 @@ func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, sfid
return return
} }
/*if forum_name == "" && forum_active == "" {
LocalErrorJSQ("You haven't changed anything!",w,r,user,is_js)
return
}*/
if forum_name == "" { if forum_name == "" {
forum_name = forums[fid].Name forum_name = forums[fid].Name
} }
@ -404,7 +413,7 @@ func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, sfid
active = false active = false
} }
_, err = update_forum_stmt.Exec(forum_name,active,forum_preset,fid) _, err = update_forum_stmt.Exec(forum_name,forum_desc,active,forum_preset,fid)
if err != nil { if err != nil {
InternalErrorJSQ(err,w,r,is_js) InternalErrorJSQ(err,w,r,is_js)
return return
@ -413,6 +422,9 @@ func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, sfid
if forums[fid].Name != forum_name { if forums[fid].Name != forum_name {
forums[fid].Name = forum_name forums[fid].Name = forum_name
} }
if forums[fid].Desc != forum_desc {
forums[fid].Desc = forum_desc
}
if forums[fid].Active != active { if forums[fid].Active != active {
forums[fid].Active = active forums[fid].Active = active
} }
@ -429,6 +441,70 @@ func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, sfid
} }
} }
func route_panel_forums_edit_perms_submit(w http.ResponseWriter, r *http.Request, sfid string){
user, ok := SimpleSessionCheck(w,r)
if !ok {
return
}
if !user.Is_Super_Mod || !user.Perms.ManageForums {
NoPermissions(w,r,user)
return
}
err := r.ParseForm()
if err != nil {
LocalError("Bad Form",w,r,user)
return
}
if r.FormValue("session") != user.Session {
SecurityError(w,r,user)
return
}
is_js := r.PostFormValue("js")
if is_js == "" {
is_js = "0"
}
fid, err := strconv.Atoi(sfid)
if err != nil {
LocalErrorJSQ("The provided Forum ID is not a valid number.",w,r,user,is_js)
return
}
gid, err := strconv.Atoi("gid")
if err != nil {
LocalErrorJSQ("Invalid Group ID",w,r,user,is_js)
return
}
perm_preset := strip_invalid_group_forum_preset(r.PostFormValue("perm_preset"))
fperms, changed := group_forum_preset_to_forum_perms(perm_preset)
if changed {
permupdate_mutex.Lock()
groups[gid].Forums[fid] = fperms
perms, err := json.Marshal(fperms)
if err != nil {
InternalErrorJSQ(err,w,r,is_js)
return
}
//_, err = update_forum_perms_for_group_stmt.Exec(perm_preset,perms,gid,fid)
_, err = add_forum_perms_to_group_stmt.Exec(gid,fid,perm_preset,perms)
if err != nil {
InternalErrorJSQ(err,w,r,is_js)
return
}
permupdate_mutex.Unlock()
}
if is_js == "0" {
http.Redirect(w,r,"/panel/forums/edit/" + strconv.Itoa(fid),http.StatusSeeOther)
} else {
w.Write(success_json_bytes)
}
}
func route_panel_settings(w http.ResponseWriter, r *http.Request){ func route_panel_settings(w http.ResponseWriter, r *http.Request){
user, noticeList, ok := SessionCheck(w,r) user, noticeList, ok := SessionCheck(w,r)
if !ok { if !ok {

View File

@ -6,6 +6,7 @@ import "sync"
import "strconv" import "strconv"
import "encoding/json" import "encoding/json"
var permupdate_mutex sync.Mutex
var BlankPerms Perms var BlankPerms Perms
var BlankForumPerms ForumPerms var BlankForumPerms ForumPerms
var GuestPerms Perms var GuestPerms Perms
@ -50,12 +51,6 @@ var GlobalPermList []string = []string{
"ViewIPs", "ViewIPs",
} }
/*type PermMeta struct
{
Name string
Type int // 0: global, 1: local
}*/
// Permission Structure: ActionComponent[Subcomponent]Flag // Permission Structure: ActionComponent[Subcomponent]Flag
type Perms struct type Perms struct
{ {
@ -73,7 +68,7 @@ type Perms struct
EditGroupGlobalPerms bool EditGroupGlobalPerms bool
EditGroupSuperMod bool EditGroupSuperMod bool
EditGroupAdmin bool EditGroupAdmin bool
ManageForums bool // This could be local, albeit limited for per-forum managers ManageForums bool // This could be local, albeit limited for per-forum managers?
EditSettings bool EditSettings bool
ManageThemes bool ManageThemes bool
ManagePlugins bool ManagePlugins bool
@ -259,7 +254,6 @@ func preset_to_permmap(preset string) (out map[string]ForumPerms) {
return out return out
} }
var permupdate_mutex sync.Mutex
func permmap_to_query(permmap map[string]ForumPerms, fid int) error { func permmap_to_query(permmap map[string]ForumPerms, fid int) error {
permupdate_mutex.Lock() permupdate_mutex.Lock()
defer permupdate_mutex.Unlock() defer permupdate_mutex.Unlock()
@ -374,6 +368,59 @@ func build_forum_permissions() error {
return nil return nil
} }
func forum_perms_to_group_forum_preset(fperms ForumPerms) string {
if !fperms.Overrides {
return "default"
}
if !fperms.ViewTopic {
return "no_access"
}
var can_post bool = (fperms.LikeItem && fperms.CreateTopic && fperms.CreateReply)
var can_moderate bool = (can_post && fperms.EditTopic && fperms.DeleteTopic && fperms.EditReply && fperms.DeleteReply && fperms.PinTopic && fperms.CloseTopic)
if can_moderate {
return "can_moderate"
}
if (fperms.EditTopic || fperms.DeleteTopic || fperms.EditReply || fperms.DeleteReply || fperms.PinTopic || fperms.CloseTopic) {
if !can_post {
return "custom"
}
return "quasi_mod"
}
if can_post {
return "can_post"
}
if fperms.ViewTopic && !fperms.LikeItem && !fperms.CreateTopic && !fperms.CreateReply {
return "read_only"
}
return "custom"
}
func group_forum_preset_to_forum_perms(preset string) (fperms ForumPerms, changed bool) {
switch(preset) {
case "read_only":
return ReadForumPerms, true
case "can_post":
return ReadWriteForumPerms, true
case "can_moderate":
return AllForumPerms, true
case "no_access":
return ForumPerms{Overrides: true}, true
case "default":
return BlankForumPerms, true
//case "custom": return fperms, false
}
return fperms, false
}
func strip_invalid_group_forum_preset(preset string) string {
switch(preset) {
case "read_only","can_post","can_moderate","no_access","default","custom":
return preset
}
return ""
}
func strip_invalid_preset(preset string) string { func strip_invalid_preset(preset string) string {
switch(preset) { switch(preset) {
case "all","announce","members","staff","admins","archive","custom": case "all","announce","members","staff","admins","archive","custom":
@ -396,18 +443,6 @@ func preset_to_lang(preset string) string {
return "" return ""
} }
/*func preset_to_emoji(preset string) string {
switch(preset) {
case "all": return ""//return "Everyone"
case "announce": return "📣"
case "members": return "👪"
case "staff": return "👮"
case "admins": return "👑"
case "archive": return "☠️"
}
return ""
}*/
func rebuild_group_permissions(gid int) error { func rebuild_group_permissions(gid int) error {
var permstr []byte var permstr []byte
log.Print("Reloading a group") log.Print("Reloading a group")

View File

@ -7,6 +7,7 @@ func init() {
// init_helloworld is separate from init() as we don't want the plugin to run if the plugin is disabled // init_helloworld is separate from init() as we don't want the plugin to run if the plugin is disabled
func init_helloworld() { func init_helloworld() {
plugins["helloworld"].AddHook("rrow_assign", helloworld_reply) plugins["helloworld"].AddHook("rrow_assign", helloworld_reply)
// TO-DO: Add a route injection example here
} }
func deactivate_helloworld() { func deactivate_helloworld() {

View File

@ -7,14 +7,10 @@ import "regexp"
var markdown_max_depth int = 25 // How deep the parser will go when parsing Markdown strings var markdown_max_depth int = 25 // How deep the parser will go when parsing Markdown strings
var markdown_unclosed_element []byte var markdown_unclosed_element []byte
var markdown_bold_tag_open []byte var markdown_bold_tag_open, markdown_bold_tag_close []byte
var markdown_bold_tag_close []byte var markdown_italic_tag_open, markdown_italic_tag_close []byte
var markdown_italic_tag_open []byte var markdown_underline_tag_open, markdown_underline_tag_close []byte
var markdown_italic_tag_close []byte var markdown_strike_tag_open, markdown_strike_tag_close []byte
var markdown_underline_tag_open []byte
var markdown_underline_tag_close []byte
var markdown_strike_tag_open []byte
var markdown_strike_tag_close []byte
var markdown_bold_italic *regexp.Regexp var markdown_bold_italic *regexp.Regexp
var markdown_bold *regexp.Regexp var markdown_bold *regexp.Regexp

View File

@ -17,12 +17,13 @@ function load_alerts(menu_alerts)
url:'/api/?action=get&module=alerts&format=json', url:'/api/?action=get&module=alerts&format=json',
success: function(data) { success: function(data) {
if("errmsg" in data) { if("errmsg" in data) {
console.log(data.errmsg); //console.log(data.errmsg);
menu_alerts.find(".alertList").html("<div class='alertItem'>"+data.errmsg+"</div>"); menu_alerts.find(".alertList").html("<div class='alertItem'>"+data.errmsg+"</div>");
return; return;
} }
var alist = ""; var alist = "";
var anyAvatar = false
for(var i in data.msgs) { for(var i in data.msgs) {
var msg = data.msgs[i]; var msg = data.msgs[i];
var mmsg = msg.msg; var mmsg = msg.msg;
@ -30,8 +31,8 @@ function load_alerts(menu_alerts)
if("sub" in msg) { if("sub" in msg) {
for(var i = 0; i < msg.sub.length; i++) { for(var i = 0; i < msg.sub.length; i++) {
mmsg = mmsg.replace("\{"+i+"\}", msg.sub[i]); mmsg = mmsg.replace("\{"+i+"\}", msg.sub[i]);
console.log("Sub #" + i); //console.log("Sub #" + i);
console.log(msg.sub[i]); //console.log(msg.sub[i]);
} }
} }
@ -39,30 +40,28 @@ function load_alerts(menu_alerts)
else if(mmsg.length > 35) size_dial = " smaller"; //9px else if(mmsg.length > 35) size_dial = " smaller"; //9px
else size_dial = ""; // 10px else size_dial = ""; // 10px
if("avatar" in msg) { if("avatar" in msg)
{
alist += "<div class='alertItem withAvatar' style='background-image:url(\""+msg.avatar+"\");'><a class='text"+size_dial+"' href=\""+msg.path+"\">"+mmsg+"</a></div>"; alist += "<div class='alertItem withAvatar' style='background-image:url(\""+msg.avatar+"\");'><a class='text"+size_dial+"' href=\""+msg.path+"\">"+mmsg+"</a></div>";
console.log(msg.avatar); anyAvatar = true
} else {
alist += "<div class='alertItem'><a href=\""+msg.path+"\" class='text"+size_dial+"'>"+mmsg+"</a></div>";
} }
console.log(msg); else alist += "<div class='alertItem'><a href=\""+msg.path+"\" class='text"+size_dial+"'>"+mmsg+"</a></div>";
//console.log(msg);
//console.log(mmsg); //console.log(mmsg);
} }
if(alist == "") alist = "<div class='alertItem'>You don't have any alerts</div>"; if(alist == "") alist = "<div class='alertItem'>You don't have any alerts</div>";
menu_alerts.find(".alertList").html(alist); else {
if(data.msgs.length != 0) { //menu_alerts.removeClass("hasAvatars");
menu_alerts.find(".alert_counter").text(data.msgs.length); //if(anyAvatar) menu_alerts.addClass("hasAvatars");
} }
menu_alerts.find(".alertList").html(alist);
if(data.msgs.length != 0) menu_alerts.find(".alert_counter").text(data.msgs.length);
}, },
error: function(magic,theStatus,error) { error: function(magic,theStatus,error) {
try { try {
var data = JSON.parse(magic.responseText); var data = JSON.parse(magic.responseText);
if("errmsg" in data) if("errmsg" in data) errtxt = data.errmsg;
{
console.log(data.errmsg);
errtxt = data.errmsg;
}
else errtxt = "Unable to get the alerts"; else errtxt = "Unable to get the alerts";
} catch(e) { errtxt = "Unable to get the alerts"; } } catch(e) { errtxt = "Unable to get the alerts"; }
menu_alerts.find(".alertList").html("<div class='alertItem'>"+errtxt+"</div>"); menu_alerts.find(".alertList").html("<div class='alertItem'>"+errtxt+"</div>");
@ -110,22 +109,17 @@ $(document).ready(function(){
if(messages[i].startsWith("set ")) { if(messages[i].startsWith("set ")) {
//msgblocks = messages[i].split(' ',3); //msgblocks = messages[i].split(' ',3);
msgblocks = SplitN(messages[i]," ",3); msgblocks = SplitN(messages[i]," ",3);
if(msgblocks.length < 3) { if(msgblocks.length < 3) continue;
continue;
}
document.querySelector(msgblocks[1]).innerHTML = msgblocks[2]; document.querySelector(msgblocks[1]).innerHTML = msgblocks[2];
} else if(messages[i].startsWith("set-class ")) { } else if(messages[i].startsWith("set-class ")) {
msgblocks = SplitN(messages[i]," ",3); msgblocks = SplitN(messages[i]," ",3);
if(msgblocks.length < 3) { if(msgblocks.length < 3) continue;
continue;
}
document.querySelector(msgblocks[1]).className = msgblocks[2]; document.querySelector(msgblocks[1]).className = msgblocks[2];
} }
} }
} }
} else {
conn = false
} }
else conn = false;
$(".open_edit").click(function(event){ $(".open_edit").click(function(event){
//console.log("Clicked on edit"); //console.log("Clicked on edit");
@ -239,21 +233,18 @@ $(document).ready(function(){
//console.log("Field Name '" + field_name + "'") //console.log("Field Name '" + field_name + "'")
//console.log("Field Type",field_type) //console.log("Field Type",field_type)
//console.log("Field Value '" + field_value + "'") //console.log("Field Value '" + field_value + "'")
for (var i = 0; i < itLen; i++){ for (var i = 0; i < itLen; i++) {
//console.log("Field Possibility '" + it[i] + "'");
if(field_value == i || field_value == it[i]) { if(field_value == i || field_value == it[i]) {
sel = "selected "; sel = "selected ";
//console.log("Class List: ",this.classList)
this.classList.remove(field_name + '_' + it[i]); this.classList.remove(field_name + '_' + it[i]);
//console.log("Removing " + field_name + '_' + it[i]);
//console.log(this.classList)
this.innerHTML = ""; this.innerHTML = "";
} else sel = ""; } else sel = "";
out += "<option "+sel+"value='"+i+"'>"+it[i]+"</option>"; out += "<option "+sel+"value='"+i+"'>"+it[i]+"</option>";
} }
this.innerHTML = "<select data-field='"+field_name+"' name='"+field_name+"'>" + out + "</select>"; this.innerHTML = "<select data-field='"+field_name+"' name='"+field_name+"'>"+out+"</select>";
} }
else this.innerHTML = "<input name='"+field_name+"' value='" + this.textContent + "' type='text'/>"; else if(field_type=="hidden") {}
else this.innerHTML = "<input name='"+field_name+"' value='"+this.textContent+"' type='text'/>";
}); });
block_parent.find('.show_on_edit').eq(0).show(); block_parent.find('.show_on_edit').eq(0).show();
@ -269,15 +260,16 @@ $(document).ready(function(){
var block = block_parent.find('.editable_block').each(function(){ var block = block_parent.find('.editable_block').each(function(){
var field_name = this.getAttribute("data-field"); var field_name = this.getAttribute("data-field");
var field_type = this.getAttribute("data-type"); var field_type = this.getAttribute("data-type");
if(field_type == "list") { if(field_type=="list") {
var newContent = $(this).find('select :selected').text(); var newContent = $(this).find('select :selected').text();
this.classList.add(field_name + '_' + newContent); this.classList.add(field_name + '_' + newContent);
this.innerHTML = ""; this.innerHTML = "";
} else if(field_type=="hidden") {
var newContent = $(this).val();
} else { } else {
var newContent = $(this).find('input').eq(0).val(); var newContent = $(this).find('input').eq(0).val();
this.innerHTML = newContent; this.innerHTML = newContent;
} }
//console.log(".submit_edit");
//console.log("field_name",field_name); //console.log("field_name",field_name);
//console.log("field_type",field_type); //console.log("field_type",field_type);
//console.log("newContent",newContent); //console.log("newContent",newContent);
@ -296,7 +288,6 @@ $(document).ready(function(){
$(".ip_item").each(function(){ $(".ip_item").each(function(){
var ip = this.textContent; var ip = this.textContent;
//console.log("IP: " + ip);
if(ip.length > 10){ if(ip.length > 10){
this.innerHTML = "Show IP"; this.innerHTML = "Show IP";
this.onclick = function(event){ this.onclick = function(event){
@ -308,6 +299,15 @@ $(document).ready(function(){
$(this).click(function() { $(this).click(function() {
$(".selectedAlert").removeClass("selectedAlert"); $(".selectedAlert").removeClass("selectedAlert");
$("#back").removeClass("alertActive");
});
$(".alert_bell").click(function(){
var menu_alerts = $(this).parent();
if(menu_alerts.hasClass("selectedAlert")) {
event.stopPropagation();
menu_alerts.removeClass("selectedAlert");
$("#back").removeClass("alertActive");
}
}); });
$(".menu_alerts").ready(function(){ $(".menu_alerts").ready(function(){
@ -317,8 +317,9 @@ $(document).ready(function(){
$(".menu_alerts").click(function(event) { $(".menu_alerts").click(function(event) {
event.stopPropagation(); event.stopPropagation();
if($(this).hasClass("selectedAlert")) return; if($(this).hasClass("selectedAlert")) return;
this.className += " selectedAlert";
load_alerts($(this)); load_alerts($(this));
this.className += " selectedAlert";
document.getElementById("back").className += " alertActive"
}); });
this.onkeyup = function(event){ this.onkeyup = function(event){

9
query_gen/build.bat Normal file
View File

@ -0,0 +1,9 @@
@echo off
echo Building the query generator
go build
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo The query generator was successfully built
pause

173
query_gen/main.go Normal file
View File

@ -0,0 +1,173 @@
/* WIP Under Construction */
package main
import "fmt"
import "strings"
import "log"
import "os"
var db_registry []DB_Adapter
var blank_order []DB_Order
type DB_Where struct
{
Left string
Right string
Operator string
LeftType string
RightType string
}
type DB_Joiner struct
{
Left string
Right string
}
type DB_Order struct
{
Column string
Order string
}
type DB_Adapter interface {
get_name() string
simple_insert(string,string,string,[]string,[]bool) error
//simple_replace(string,string,[]string,[]string,[]bool) error
simple_update() error
simple_select(string,string,string,string,[]DB_Order/*,int,int*/) error
simple_left_join(string,string,string,string,[]DB_Joiner,string,[]DB_Order/*,int,int*/) error
write() error
// TO-DO: Add a simple query builder
}
func main() {
log.Println("Running the query generator")
for _, adapter := range db_registry {
log.Println("Building the queries for the " + adapter.get_name() + " adapter")
write_statements(adapter)
adapter.write()
}
}
func write_statements(adapter DB_Adapter) error {
// url_prefix and url_name will be removed from this query in a later commit
adapter.simple_select("get_user","users","name, group, is_super_admin, avatar, message, url_prefix, url_name, level","uid = ?",blank_order)
adapter.simple_select("get_full_user","users","name, group, is_super_admin, session, email, avatar, message, url_prefix, url_name, level, score, last_ip","uid = ?",blank_order)
adapter.simple_select("get_topic","topics","title, content, createdBy, createdAt, is_closed, sticky, parentID, ipaddress, postCount, likeCount","tid = ?",blank_order)
adapter.simple_select("get_reply","replies","content, createdBy, createdAt, lastEdit, lastEditBy, ipaddress, likeCount","rid = ?",blank_order)
adapter.simple_select("login","users","uid, name, password, salt","name = ?",blank_order)
adapter.simple_select("get_password","users","password,salt","uid = ?",blank_order)
adapter.simple_select("username_exists","users","name","name = ?",blank_order)
/*
get_topic_list_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 order by topics.sticky DESC, topics.lastReplyAt DESC, topics.createdBy DESC")
// A visual reference for me to glance at while I design this thing
*/
//func (adapter *Mysql_Adapter) simple_left_join(name string, table1 string, table2 string, columns string, joiners []DB_Joiner, where []DB_Where, orderby []DB_Order/*, offset int, maxCount int*/) error {
/*adapter.simple_left_join("get_topic_list","topics","users",
"topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, topics.parentID, users.name, users.avatar",
[]DB_Joiner{}
)*/
return nil
}
func write_file(name string, content string) (err error) {
f, err := os.Create(name)
if err != nil {
return err
}
_, err = f.WriteString(content)
if err != nil {
return err
}
f.Sync()
f.Close()
return
}
func _process_where(wherestr string) (where []DB_Where) {
if wherestr == "" {
return where
}
wherestr = strings.Replace(wherestr," and "," AND ",-1)
for _, segment := range strings.Split(wherestr," AND ") {
// TO-DO: Subparse the contents of a function and spit out a DB_Function struct
var outwhere DB_Where
var parseOffset int
outwhere.Left, parseOffset = _get_identifier(segment, parseOffset)
outwhere.Operator, parseOffset = _get_operator(segment, parseOffset + 1)
outwhere.Right, parseOffset = _get_identifier(segment, parseOffset + 1)
outwhere.LeftType = _get_identifier_type(outwhere.Left)
outwhere.RightType = _get_identifier_type(outwhere.Right)
where = append(where,outwhere)
}
return where
}
func _get_identifier_type(identifier string) string {
if ('a' <= identifier[0] && identifier[0] <= 'z') || ('A' <= identifier[0] && identifier[0] <= 'Z') {
if identifier[len(identifier) - 1] == ')' {
return "function"
}
return "column"
}
if identifier[0] == '\'' || identifier[0] == '"' {
return "string"
}
return "literal"
}
func _get_identifier(segment string, startOffset int) (out string, i int) {
fmt.Println("entering _get_identifier")
segment = strings.TrimSpace(segment)
segment += " " // Avoid overflow bugs with slicing
for i = startOffset; i < len(segment); i++ {
if segment[i] == '(' {
i = _skip_function_call(segment,i)
return strings.TrimSpace(segment[startOffset:i]), (i - 1)
}
if segment[i] == ' ' && i != startOffset {
fmt.Println("segment[startOffset:i]",segment[startOffset:i])
fmt.Println("startOffset",startOffset)
fmt.Println("segment[startOffset]",string(segment[startOffset]))
fmt.Println("i",i)
return strings.TrimSpace(segment[startOffset:i]), (i - 1)
}
}
return strings.TrimSpace(segment[startOffset:]), (i - 1)
}
func _get_operator(segment string, startOffset int) (out string, i int) {
segment = strings.TrimSpace(segment)
segment += " " // Avoid overflow bugs with slicing
for i = startOffset; i < len(segment); i++ {
if segment[i] == ' ' && i != startOffset {
return strings.TrimSpace(segment[startOffset:i]), (i - 1)
}
}
return strings.TrimSpace(segment[startOffset:]), (i - 1)
}
func _skip_function_call(segment string, i int) int {
var brace_count int = 1
for ; i < len(segment); i++ {
if segment[i] == '(' {
brace_count++
} else if segment[i] == ')' {
brace_count--
}
if brace_count == 0 {
return i
}
}
return i
}

219
query_gen/mysql.go Normal file
View File

@ -0,0 +1,219 @@
/* WIP Under Construction */
package main
import "fmt"
import "strings"
import "errors"
func init() {
db_registry = append(db_registry,&Mysql_Adapter{Name:"mysql"})
}
type Mysql_Adapter struct
{
Name string
Stmts string
Body string
}
func (adapter *Mysql_Adapter) get_name() string {
return adapter.Name
}
func (adapter *Mysql_Adapter) simple_insert(name string, table string, columns string, fields []string, quoteWhat []bool) error {
if name == "" {
return errors.New("You need a name for this statement")
}
if table == "" {
return errors.New("You need a name for this table")
}
if len(columns) == 0 {
return errors.New("No columns found for simple_insert")
}
if len(fields) == 0 {
return errors.New("No input data found for simple_insert")
}
// Slice up the user friendly strings into something easier to process
var colslice []string = strings.Split(strings.TrimSpace(columns),",")
var noquotes bool = (len(quoteWhat) == 0)
var querystr string = "INSERT INTO " + table + "("
// Escape the column names, just in case we've used a reserved keyword
// TO-DO: Subparse the columns to allow functions and AS keywords
for _, column := range colslice {
querystr += "`" + column + "`,"
}
// Remove the trailing comma
querystr = querystr[0:len(querystr) - 1]
querystr += ") VALUES ("
for fid, field := range fields {
if !noquotes && quoteWhat[fid] {
querystr += "'" + field + "',"
} else {
querystr += field + ","
}
}
querystr = querystr[0:len(querystr) - 1]
adapter.write_statement(name,querystr + ")")
return nil
}
func (adapter *Mysql_Adapter) simple_update() error {
return nil
}
func (adapter *Mysql_Adapter) simple_select(name string, table string, columns string, where string, orderby []DB_Order/*, offset int, maxCount int*/) error {
if name == "" {
return errors.New("You need a name for this statement")
}
if table == "" {
return errors.New("You need a name for this table")
}
if len(columns) == 0 {
return errors.New("No columns found for simple_select")
}
// Slice up the user friendly strings into something easier to process
var colslice []string = strings.Split(strings.TrimSpace(columns),",")
var querystr string = "SELECT "
// Escape the column names, just in case we've used a reserved keyword
for _, column := range colslice {
querystr += "`" + strings.TrimSpace(column) + "`,"
}
// Remove the trailing comma
querystr = querystr[0:len(querystr) - 1]
querystr += " FROM " + table
if len(where) != 0 {
querystr += " WHERE"
fmt.Println("where",where)
fmt.Println("_process_where(where)",_process_where(where))
for _, loc := range _process_where(where) {
var lquote, rquote string
if loc.LeftType == "column" {
lquote = "`"
}
if loc.RightType == "column" {
rquote = "`"
}
querystr += " " + lquote + loc.Left + lquote + loc.Operator + " " + rquote + loc.Right + rquote + " AND "
}
}
// Remove the trailing AND
querystr = querystr[0:len(querystr) - 4]
if len(orderby) != 0 {
querystr += " ORDER BY "
for _, column := range orderby {
querystr += column.Column + " " + column.Order + ","
}
}
querystr = querystr[0:len(querystr) - 1]
adapter.write_statement(name,querystr)
return nil
}
func (adapter *Mysql_Adapter) simple_left_join(name string, table1 string, table2 string, columns string, joiners []DB_Joiner, where string, orderby []DB_Order/*, offset int, maxCount int*/) error {
if name == "" {
return errors.New("You need a name for this statement")
}
if table1 == "" {
return errors.New("You need a name for the left table")
}
if table2 == "" {
return errors.New("You need a name for the right table")
}
if len(columns) == 0 {
return errors.New("No columns found for simple_left_join")
}
if len(joiners) == 0 {
return errors.New("No joiners found for simple_left_join")
}
// Slice up the user friendly strings into something easier to process
var colslice []string = strings.Split(strings.TrimSpace(columns),",")
var querystr string = "SELECT "
// Escape the column names, just in case we've used a reserved keyword
for _, column := range colslice {
querystr += "`" + strings.TrimSpace(column) + "`,"
}
// Remove the trailing comma
querystr = querystr[0:len(querystr) - 1]
querystr += " FROM " + table1 + " LEFT JOIN " + table2 + " ON "
for _, joiner := range joiners {
querystr += "`" + joiner.Left + "`=`" + joiner.Right + "` AND "
}
// Remove the trailing AND
querystr = querystr[0:len(querystr) - 4]
if len(where) != 0 {
querystr += " " + "WHERE"
for _, loc := range _process_where(where) {
var lquote, rquote string
if loc.LeftType == "column" {
lquote = "`"
}
if loc.RightType == "column" {
rquote = "`"
}
querystr += " " + lquote + loc.Left + lquote + loc.Operator + " " + rquote + loc.Right + rquote + " AND "
}
}
querystr = querystr[0:len(querystr) - 3]
if len(orderby) != 0 {
querystr += " ORDER BY "
for _, column := range orderby {
querystr += column.Column + " " + column.Order + ","
}
}
querystr = querystr[0:len(querystr) - 1]
adapter.write_statement(name,querystr)
return nil
}
func (adapter *Mysql_Adapter) write() error {
out := `/* This file was generated by Gosora's Query Generator */
package main
import "log"
import "database/sql"
` + adapter.Stmts + `
func gen_mysql() (err error) {
if debug {
log.Print("Building the generated statements")
}
` + adapter.Body + `
return nil
}
`
return write_file("./gen_mysql.go", out)
}
// Internal method, not exposed in the interface
func (adapter *Mysql_Adapter) write_statement(name string, querystr string ) {
adapter.Stmts += "var " + name + "_stmt *sql.Stmt\n"
adapter.Body += `
log.Print("Preparing ` + name + ` statement.")
` + name + `_stmt, err = db.Prepare("` + querystr + `")
if err != nil {
return err
}
`
}

10
query_gen/run.bat Normal file
View File

@ -0,0 +1,10 @@
@echo off
echo Building the query generator
go build
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo The query generator was successfully built
query_gen.exe
pause

View File

@ -1,4 +1,5 @@
package main package main
//import "fmt" //import "fmt"
import "strings" import "strings"
import "sync" import "sync"

View File

@ -1,5 +1,4 @@
/* WIP Under Construction */ /* WIP Under Construction */
// The router generator might be discontinued in favour of syncmaps in Go 1.9, it will be temporarily used for a couple of months as a lockless alternative to maps
package main package main
import "log" import "log"
@ -17,7 +16,7 @@ func main() {
routes() routes()
var out string var out string
var fdata string = "// Code generated by. DO NOT EDIT.\n/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */\n// The router generator might be discontinued in favour of syncmaps in Go 1.9, it will be temporarily used for a couple of months as a lockless alternative to maps\n" var fdata string = "// Code generated by. DO NOT EDIT.\n/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */\n"
for _, route := range route_list { for _, route := range route_list {
var end int var end int

View File

@ -49,6 +49,7 @@ func routes() {
Route{"route_panel_forums_delete_submit","/panel/forums/delete/submit/","",[]string{"extra_data"}}, Route{"route_panel_forums_delete_submit","/panel/forums/delete/submit/","",[]string{"extra_data"}},
Route{"route_panel_forums_edit","/panel/forums/edit/","",[]string{"extra_data"}}, Route{"route_panel_forums_edit","/panel/forums/edit/","",[]string{"extra_data"}},
Route{"route_panel_forums_edit_submit","/panel/forums/edit/submit/","",[]string{"extra_data"}}, Route{"route_panel_forums_edit_submit","/panel/forums/edit/submit/","",[]string{"extra_data"}},
Route{"route_panel_forums_edit_perms_submit","/panel/forums/edit/perms/submit/","",[]string{"extra_data"}},
Route{"route_panel_settings","/panel/settings/","",[]string{}}, Route{"route_panel_settings","/panel/settings/","",[]string{}},
Route{"route_panel_setting","/panel/settings/edit/","",[]string{"extra_data"}}, Route{"route_panel_setting","/panel/settings/edit/","",[]string{"extra_data"}},

View File

@ -56,11 +56,13 @@ func route_static(w http.ResponseWriter, r *http.Request){
//io.CopyN(w, bytes.NewReader(file.Data), static_files[r.URL.Path].Length) //io.CopyN(w, bytes.NewReader(file.Data), static_files[r.URL.Path].Length)
} }
// Deprecated: Test route for stopping the server during a performance analysis
/*func route_exit(w http.ResponseWriter, r *http.Request){ /*func route_exit(w http.ResponseWriter, r *http.Request){
db.Close() db.Close()
os.Exit(0) os.Exit(0)
} }
// Deprecated: Test route to see which is faster
func route_fstatic(w http.ResponseWriter, r *http.Request){ func route_fstatic(w http.ResponseWriter, r *http.Request){
http.ServeFile(w,r,r.URL.Path) http.ServeFile(w,r,r.URL.Path)
}*/ }*/
@ -109,7 +111,7 @@ func route_topics(w http.ResponseWriter, r *http.Request){
} }
var topicList []TopicsRow 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, 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 := db.Query("select topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, topics.lastReplyAt, topics.parentID, topics.postCount, 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() //rows, err := get_topic_list_stmt.Query()
if err != nil { if err != nil {
InternalError(err,w,r) InternalError(err,w,r)
@ -118,7 +120,7 @@ func route_topics(w http.ResponseWriter, r *http.Request){
topicItem := TopicsRow{ID: 0} topicItem := TopicsRow{ID: 0}
for rows.Next() { 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.LikeCount, &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.PostCount, &topicItem.LikeCount, &topicItem.CreatedByName, &topicItem.Avatar)
if err != nil { if err != nil {
InternalError(err,w,r) InternalError(err,w,r)
return return
@ -206,9 +208,9 @@ func route_forum(w http.ResponseWriter, r *http.Request, sfid string){
} }
var topicList []TopicUser var topicList []TopicUser
topicItem := TopicUser{ID: 0} var topicItem TopicUser = TopicUser{ID: 0}
for rows.Next() { 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.LikeCount, &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.PostCount, &topicItem.LikeCount, &topicItem.CreatedByName, &topicItem.Avatar)
if err != nil { if err != nil {
InternalError(err,w,r) InternalError(err,w,r)
return return
@ -262,7 +264,7 @@ func route_forums(w http.ResponseWriter, r *http.Request){
//fmt.Println(group.CanSee) //fmt.Println(group.CanSee)
for _, fid := range group.CanSee { for _, fid := range group.CanSee {
//fmt.Println(forums[fid]) //fmt.Println(forums[fid])
forum := forums[fid] var forum Forum = forums[fid]
if forum.Active && forum.Name != "" { if forum.Active && forum.Name != "" {
if forum.LastTopicID != 0 { if forum.LastTopicID != 0 {
forum.LastTopicTime, err = relative_time(forum.LastTopicTime) forum.LastTopicTime, err = relative_time(forum.LastTopicTime)
@ -1099,7 +1101,6 @@ func route_report_submit(w http.ResponseWriter, r *http.Request, sitem_id string
return return
} }
title = "Report: " + title
res, err := create_report_stmt.Exec(title,content,parse_message(content),user.ID,item_type + "_" + strconv.Itoa(item_id)) res, err := create_report_stmt.Exec(title,content,parse_message(content),user.ID,item_type + "_" + strconv.Itoa(item_id))
if err != nil { if err != nil {
InternalError(err,w,r) InternalError(err,w,r)
@ -1526,9 +1527,7 @@ func route_login_submit(w http.ResponseWriter, r *http.Request) {
} }
var uid int var uid int
var real_password string var real_password, salt, session string
var salt string
var session string
username := html.EscapeString(r.PostFormValue("username")) username := html.EscapeString(r.PostFormValue("username"))
password := r.PostFormValue("password") password := r.PostFormValue("password")
@ -1579,11 +1578,11 @@ func route_login_submit(w http.ResponseWriter, r *http.Request) {
return return
} }
cookie := http.Cookie{Name: "uid",Value: strconv.Itoa(uid),Path: "/",MaxAge: year} cookie := http.Cookie{Name:"uid",Value:strconv.Itoa(uid),Path:"/",MaxAge:year}
http.SetCookie(w,&cookie) http.SetCookie(w,&cookie)
cookie = http.Cookie{Name: "session",Value: session,Path: "/",MaxAge: year} cookie = http.Cookie{Name:"session",Value:session,Path:"/",MaxAge:year}
http.SetCookie(w,&cookie) http.SetCookie(w,&cookie)
http.Redirect(w,r, "/", http.StatusSeeOther) http.Redirect(w,r,"/",http.StatusSeeOther)
} }
func route_register(w http.ResponseWriter, r *http.Request) { func route_register(w http.ResponseWriter, r *http.Request) {

View File

@ -15,6 +15,15 @@ if %errorlevel% neq 0 (
echo Running the router generator echo Running the router generator
router_gen.exe router_gen.exe
echo Building the query generator
go build ./query_gen
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the query generator
query_gen.exe
echo Building the executable echo Building the executable
go build -o gosora.exe -tags no_ws go build -o gosora.exe -tags no_ws
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (

View File

@ -16,6 +16,15 @@ if %errorlevel% neq 0 (
echo Running the router generator echo Running the router generator
router_gen.exe router_gen.exe
echo Building the query generator
go build ./query_gen
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the query generator
query_gen.exe
echo Building the executable echo Building the executable
go build -o gosora.exe go build -o gosora.exe
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (

View File

@ -88,26 +88,32 @@ w.Write(forum_18)
} }
} }
w.Write(forum_19) w.Write(forum_19)
w.Write([]byte(strconv.Itoa(item.ID))) w.Write([]byte(strconv.Itoa(item.PostCount)))
w.Write(forum_20) w.Write(forum_20)
w.Write([]byte(item.Title))
w.Write(forum_21)
if item.Is_Closed {
w.Write(forum_22)
}
w.Write(forum_23)
w.Write([]byte(item.LastReplyAt)) w.Write([]byte(item.LastReplyAt))
w.Write(forum_21)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(forum_22)
w.Write([]byte(item.Title))
w.Write(forum_23)
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
w.Write(forum_24) w.Write(forum_24)
} w.Write([]byte(item.CreatedByName))
} else {
w.Write(forum_25) w.Write(forum_25)
if tmpl_forum_vars.CurrentUser.Perms.CreateTopic { if item.Is_Closed {
w.Write(forum_26) w.Write(forum_26)
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) }
w.Write(forum_27) w.Write(forum_27)
} }
} else {
w.Write(forum_28) w.Write(forum_28)
} if tmpl_forum_vars.CurrentUser.Perms.CreateTopic {
w.Write(forum_29) w.Write(forum_29)
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
w.Write(forum_30)
}
w.Write(forum_31)
}
w.Write(forum_32)
w.Write(footer_0) w.Write(footer_0)
} }

View File

@ -1,8 +1,8 @@
// Code generated by. DO NOT EDIT. // Code generated by. DO NOT EDIT.
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ /* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
package main package main
import "io"
import "strconv" import "strconv"
import "io"
func init() { func init() {
template_forums_handle = template_forums template_forums_handle = template_forums
@ -45,20 +45,48 @@ w.Write(forums_0)
if len(tmpl_forums_vars.ItemList) != 0 { if len(tmpl_forums_vars.ItemList) != 0 {
for _, item := range tmpl_forums_vars.ItemList { for _, item := range tmpl_forums_vars.ItemList {
w.Write(forums_1) w.Write(forums_1)
w.Write([]byte(strconv.Itoa(item.ID))) if item.Desc != "" || item.LastTopicTime != "" {
w.Write(forums_2) w.Write(forums_2)
w.Write([]byte(item.Name)) }
w.Write(forums_3) w.Write(forums_3)
w.Write([]byte(strconv.Itoa(item.LastTopicID))) if item.Desc != "" {
w.Write(forums_4) w.Write(forums_4)
w.Write([]byte(item.LastTopic)) w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(forums_5) w.Write(forums_5)
w.Write([]byte(item.LastTopicTime)) w.Write([]byte(item.Name))
w.Write(forums_6) w.Write(forums_6)
w.Write([]byte(item.Desc))
w.Write(forums_7)
} else {
if item.LastTopicTime != "" {
w.Write(forums_8)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(forums_9)
w.Write([]byte(item.Name))
w.Write(forums_10)
} else {
w.Write(forums_11)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(forums_12)
w.Write([]byte(item.Name))
w.Write(forums_13)
}
}
w.Write(forums_14)
w.Write([]byte(strconv.Itoa(item.LastTopicID)))
w.Write(forums_15)
w.Write([]byte(item.LastTopic))
w.Write(forums_16)
if item.LastTopicTime != "" {
w.Write(forums_17)
w.Write([]byte(item.LastTopicTime))
w.Write(forums_18)
}
w.Write(forums_19)
} }
} else { } else {
w.Write(forums_7) w.Write(forums_20)
} }
w.Write(forums_8) w.Write(forums_21)
w.Write(footer_0) w.Write(footer_0)
} }

View File

@ -40,7 +40,8 @@ var menu_6 []byte = []byte(`
<li class="menu_left menu_login"><a href="/accounts/login/">Login</a></li> <li class="menu_left menu_login"><a href="/accounts/login/">Login</a></li>
`) `)
var menu_7 []byte = []byte(` var menu_7 []byte = []byte(`
<li class="menu_right menu_alerts">🔔 <li class="menu_right menu_alerts">
<div class="alert_bell">🔔</div>
<div class="alert_counter"></div> <div class="alert_counter"></div>
<div class="alertList"></div> <div class="alertList"></div>
</li> </li>
@ -48,7 +49,8 @@ var menu_7 []byte = []byte(`
</div> </div>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div>`) </div>
`)
var header_3 []byte = []byte(` var header_3 []byte = []byte(`
<div id="back"><div id="main"> <div id="back"><div id="main">
`) `)
@ -389,18 +391,23 @@ var profile_5 []byte = []byte(`
<div class="rowitem passive"> <div class="rowitem passive">
<a class="profile_menu_item">Add Friend</a> <a class="profile_menu_item">Add Friend</a>
</div> </div>
<div class="rowitem passive"
`) `)
var profile_6 []byte = []byte(`<a href="/users/unban/`) var profile_6 []byte = []byte(`<div class="rowitem passive">
var profile_7 []byte = []byte(`?session=`) `)
var profile_8 []byte = []byte(`" class="username">Unban</a>`) var profile_7 []byte = []byte(`<a href="/users/unban/`)
var profile_9 []byte = []byte(`<a href="/users/ban/`) var profile_8 []byte = []byte(`?session=`)
var profile_10 []byte = []byte(`?session=`) var profile_9 []byte = []byte(`" class="profile_menu_item">Unban</a>
var profile_11 []byte = []byte(`" class="username">Ban</a>`) `)
var profile_12 []byte = []byte(` var profile_10 []byte = []byte(`<a href="/users/ban/`)
var profile_11 []byte = []byte(`?session=`)
var profile_12 []byte = []byte(`" class="profile_menu_item">Ban</a>`)
var profile_13 []byte = []byte(`
</div>`)
var profile_14 []byte = []byte(`
<div class="rowitem passive">
<a href="/report/submit/`) <a href="/report/submit/`)
var profile_13 []byte = []byte(`?session=`) var profile_15 []byte = []byte(`?session=`)
var profile_14 []byte = []byte(`&type=user" class="profile_menu_item report_item">Report</a> var profile_16 []byte = []byte(`&type=user" class="profile_menu_item report_item">Report</a>
</div> </div>
</div> </div>
@ -408,45 +415,45 @@ var profile_14 []byte = []byte(`&type=user" class="profile_menu_item report_item
<div class="rowitem rowhead"><a>Comments</a></div> <div class="rowitem rowhead"><a>Comments</a></div>
</div> </div>
<div id="profile_comments" class="colblock_right" style="overflow: hidden;border-top: none;width:calc(95% - 210px);">`) <div id="profile_comments" class="colblock_right" style="overflow: hidden;border-top: none;width:calc(95% - 210px);">`)
var profile_15 []byte = []byte(` var profile_17 []byte = []byte(`
<div class="rowitem passive deletable_block editable_parent simple" style="`) <div class="rowitem passive deletable_block editable_parent simple" style="`)
var profile_16 []byte = []byte(`background-image: url(`) var profile_18 []byte = []byte(`background-image: url(`)
var profile_17 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px `) var profile_19 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px `)
var profile_18 []byte = []byte(`-1`) var profile_20 []byte = []byte(`-1`)
var profile_19 []byte = []byte(`0px;background-repeat: no-repeat, repeat-y;background-size: 128px;padding-left: 136px;`) var profile_21 []byte = []byte(`0px;background-repeat: no-repeat, repeat-y;background-size: 128px;padding-left: 136px;`)
var profile_20 []byte = []byte(`"> var profile_22 []byte = []byte(`">
<span class="editable_block user_content simple">`) <span class="editable_block user_content simple">`)
var profile_21 []byte = []byte(`</span><br /><br /> var profile_23 []byte = []byte(`</span><br /><br />
<a href="/user/`) <a href="/user/`)
var profile_22 []byte = []byte(`" class="real_username username">`) var profile_24 []byte = []byte(`" class="real_username username">`)
var profile_23 []byte = []byte(`</a>&nbsp;&nbsp; var profile_25 []byte = []byte(`</a>&nbsp;&nbsp;
`) `)
var profile_24 []byte = []byte(`<a href="/profile/reply/edit/submit/`) var profile_26 []byte = []byte(`<a href="/profile/reply/edit/submit/`)
var profile_25 []byte = []byte(`" class="mod_button" title="Edit Item"><button class="username edit_item edit_label"></button></a> var profile_27 []byte = []byte(`" class="mod_button" title="Edit Item"><button class="username edit_item edit_label"></button></a>
<a href="/profile/reply/delete/submit/`) <a href="/profile/reply/delete/submit/`)
var profile_26 []byte = []byte(`" class="mod_button" title="Delete Item"><button class="username delete_item trash_label"></button></a>`) var profile_28 []byte = []byte(`" class="mod_button" title="Delete Item"><button class="username delete_item trash_label"></button></a>`)
var profile_27 []byte = []byte(` var profile_29 []byte = []byte(`
<a class="mod_button" href="/report/submit/`) <a class="mod_button" href="/report/submit/`)
var profile_28 []byte = []byte(`?session=`) var profile_30 []byte = []byte(`?session=`)
var profile_29 []byte = []byte(`&type=user-reply"><button class="username report_item flag_label"></button></a> var profile_31 []byte = []byte(`&type=user-reply"><button class="username report_item flag_label"></button></a>
`) `)
var profile_30 []byte = []byte(`<a class="username hide_on_mobile" style="float: right;">`) var profile_32 []byte = []byte(`<a class="username hide_on_mobile" style="float: right;">`)
var profile_31 []byte = []byte(`</a>`) var profile_33 []byte = []byte(`</a>`)
var profile_32 []byte = []byte(` var profile_34 []byte = []byte(`
</div> </div>
`) `)
var profile_33 []byte = []byte(`</div> var profile_35 []byte = []byte(`</div>
<div class="colblock_right" style="border-top: none;width: calc(95% - 210px);"> <div class="colblock_right" style="border-top: none;width: calc(95% - 210px);">
`) `)
var profile_34 []byte = []byte(` var profile_36 []byte = []byte(`
<form action="/profile/reply/create/" method="post"> <form action="/profile/reply/create/" method="post">
<input name="uid" value='`) <input name="uid" value='`)
var profile_35 []byte = []byte(`' type="hidden" /> var profile_37 []byte = []byte(`' type="hidden" />
<div class="formrow"> <div class="formrow">
<div class="formitem"><textarea name="reply-content" placeholder="Insert reply here"></textarea></div> <div class="formitem"><textarea name="reply-content" placeholder="Insert reply here"></textarea></div>
</div> </div>
@ -455,7 +462,7 @@ var profile_35 []byte = []byte(`' type="hidden" />
</div> </div>
</form> </form>
`) `)
var profile_36 []byte = []byte(` var profile_38 []byte = []byte(`
</div> </div>
`) `)
@ -465,48 +472,84 @@ var forums_0 []byte = []byte(`
</div> </div>
<div class="rowblock"> <div class="rowblock">
`) `)
var forums_1 []byte = []byte(`<div class="rowitem"> var forums_1 []byte = []byte(`<div class="rowitem `)
var forums_2 []byte = []byte(`datarow`)
var forums_3 []byte = []byte(`">
`)
var forums_4 []byte = []byte(`<span style="float: left;">
<a href="/forum/`) <a href="/forum/`)
var forums_2 []byte = []byte(`" class="panel_upshift">`) var forums_5 []byte = []byte(`" style="">`)
var forums_3 []byte = []byte(`</a> var forums_6 []byte = []byte(`</a>
<br /><span class="rowsmall">`)
var forums_7 []byte = []byte(`</span>
</span>`)
var forums_8 []byte = []byte(`<span style="float: left;padding-top: 8px;font-size: 18px;">
<a href="/forum/`)
var forums_9 []byte = []byte(`">`)
var forums_10 []byte = []byte(`</a>
</span>`)
var forums_11 []byte = []byte(`<span style="float: left;">
<a href="/forum/`)
var forums_12 []byte = []byte(`">`)
var forums_13 []byte = []byte(`</a>
</span>`)
var forums_14 []byte = []byte(`
<span style="float: right;">
<a href="/topic/`) <a href="/topic/`)
var forums_4 []byte = []byte(`" style="float: right;">`) var forums_15 []byte = []byte(`" style="float: right;font-size: 14px;">`)
var forums_5 []byte = []byte(` <small style="font-size: 12px;">`) var forums_16 []byte = []byte(`</a>
var forums_6 []byte = []byte(`</small></a> `)
var forums_17 []byte = []byte(`<br /><span class="rowsmall">`)
var forums_18 []byte = []byte(`</span>`)
var forums_19 []byte = []byte(`
</span>
<div style="clear: both;"></div>
</div> </div>
`) `)
var forums_7 []byte = []byte(`<div class="rowitem passive">You don't have access to any forums.</div>`) var forums_20 []byte = []byte(`<div class="rowitem passive">You don't have access to any forums.</div>`)
var forums_8 []byte = []byte(` var forums_21 []byte = []byte(`
</div> </div>
`) `)
var topics_0 []byte = []byte(` var topics_0 []byte = []byte(`
<div class="rowblock"> <div class="rowblock">
<div class="rowitem rowhead"><a>Topic List</a></div> <div class="rowitem rowhead"><a>Topic List</a></div>
</div> </div>
<div class="rowblock"> <div id="topic_list" class="rowblock topic_list">
`) `)
var topics_1 []byte = []byte(`<div class="rowitem passive" style="`) var topics_1 []byte = []byte(`<div class="rowitem passive datarow" style="`)
var topics_2 []byte = []byte(`background-image: url(`) var topics_2 []byte = []byte(`background-image: url(`)
var topics_3 []byte = []byte(`);background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;`) var topics_3 []byte = []byte(`);background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;`)
var topics_4 []byte = []byte(`background-color: #FFFFCC;`) var topics_4 []byte = []byte(`background-color: #FFFFCC;`)
var topics_5 []byte = []byte(`background-color: #eaeaea;`) var topics_5 []byte = []byte(`background-color: #eaeaea;`)
var topics_6 []byte = []byte(`"> var topics_6 []byte = []byte(`">
<a href="/topic/`) <span class="rowsmall" style="float: right;">
var topics_7 []byte = []byte(`">`) <span class="replyCount">`)
var topics_8 []byte = []byte(`</a> `) var topics_7 []byte = []byte(` replies</span><br />
var topics_9 []byte = []byte(`<a href="/forum/`) <span class="lastReplyAt">`)
var topics_10 []byte = []byte(`" style="font-size:12px;">`) var topics_8 []byte = []byte(`</span>
var topics_11 []byte = []byte(`</a> `) </span>
var topics_12 []byte = []byte(`<span class="username topic_status_e topic_status_closed" style="float: right;position:relative;top:-5px;margin-left:8px;" title="Status: Closed">&#x1F512;&#xFE0E</span>`) <span>
var topics_13 []byte = []byte(` <a class="rowtopic" href="/topic/`)
<a style="float: right;font-size:12px;">`) var topics_9 []byte = []byte(`">`)
var topics_14 []byte = []byte(`</a> var topics_10 []byte = []byte(`</a> `)
var topics_11 []byte = []byte(`<a class="rowsmall" href="/forum/`)
var topics_12 []byte = []byte(`">`)
var topics_13 []byte = []byte(`</a>`)
var topics_14 []byte = []byte(`
<br /><a class="rowsmall" href="/user/`)
var topics_15 []byte = []byte(`">Starter: `)
var topics_16 []byte = []byte(`</a>
`)
var topics_17 []byte = []byte(`<span class="rowsmall topic_status_e topic_status_closed" title="Status: Closed"> | &#x1F512;&#xFE0E`)
var topics_18 []byte = []byte(`</span>
</span>
</div> </div>
`) `)
var topics_15 []byte = []byte(`<div class="rowitem passive">There aren't any topics yet.`) var topics_19 []byte = []byte(`<div class="rowitem passive">There aren't any topics yet.`)
var topics_16 []byte = []byte(` <a href="/topics/create/">Start one?</a>`) var topics_20 []byte = []byte(` <a href="/topics/create/">Start one?</a>`)
var topics_17 []byte = []byte(`</div>`) var topics_21 []byte = []byte(`</div>`)
var topics_18 []byte = []byte(` var topics_22 []byte = []byte(`
</div> </div>
`) `)
var forum_0 []byte = []byte(`<div id="prevFloat" class="prev_button"><a class="prev_link" href="/forum/`) var forum_0 []byte = []byte(`<div id="prevFloat" class="prev_button"><a class="prev_link" href="/forum/`)
@ -529,27 +572,37 @@ var forum_11 []byte = []byte(`<a href="/topics/create/`)
var forum_12 []byte = []byte(`" class='username head_tag_upshift'>New Topic</a>`) var forum_12 []byte = []byte(`" class='username head_tag_upshift'>New Topic</a>`)
var forum_13 []byte = []byte(`</div> var forum_13 []byte = []byte(`</div>
</div> </div>
<div class="rowblock"> <div id="forum_topic_list" class="rowblock topic_list">
`) `)
var forum_14 []byte = []byte(`<div class="rowitem passive" style="`) var forum_14 []byte = []byte(`<div class="rowitem passive datarow" style="`)
var forum_15 []byte = []byte(`background-image: url(`) var forum_15 []byte = []byte(`background-image: url(`)
var forum_16 []byte = []byte(`);background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;`) var forum_16 []byte = []byte(`);background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;`)
var forum_17 []byte = []byte(`background-color: #FFFFCC;`) var forum_17 []byte = []byte(`background-color: #FFFFCC;`)
var forum_18 []byte = []byte(`background-color: #eaeaea;`) var forum_18 []byte = []byte(`background-color: #eaeaea;`)
var forum_19 []byte = []byte(`"> var forum_19 []byte = []byte(`">
<a href="/topic/`) <span class="rowsmall" style="float: right;">
var forum_20 []byte = []byte(`">`) <span class="replyCount">`)
var forum_21 []byte = []byte(`</a> `) var forum_20 []byte = []byte(` replies</span><br />
var forum_22 []byte = []byte(`<span class="username topic_status_e topic_status_closed" title="Status: Closed" style="float: right;position:relative;top:-5px;margin-left:8px;">&#x1F512;&#xFE0E</span>`) <span class="lastReplyAt">`)
var forum_23 []byte = []byte(` var forum_21 []byte = []byte(`</span>
<a style="float: right;font-size:12px;">`) </span>
var forum_24 []byte = []byte(`</a> <span>
<a class="rowtopic" href="/topic/`)
var forum_22 []byte = []byte(`">`)
var forum_23 []byte = []byte(`</a>
<br /><a class="rowsmall" href="/user/`)
var forum_24 []byte = []byte(`">Starter: `)
var forum_25 []byte = []byte(`</a>
`)
var forum_26 []byte = []byte(`<span class="rowsmall topic_status_e topic_status_closed" title="Status: Closed"> | &#x1F512;&#xFE0E`)
var forum_27 []byte = []byte(`</span>
</span>
</div> </div>
`) `)
var forum_25 []byte = []byte(`<div class="rowitem passive">There aren't any topics in this forum yet.`) var forum_28 []byte = []byte(`<div class="rowitem passive">There aren't any topics in this forum yet.`)
var forum_26 []byte = []byte(` <a href="/topics/create/`) var forum_29 []byte = []byte(` <a href="/topics/create/`)
var forum_27 []byte = []byte(`">Start one?</a>`) var forum_30 []byte = []byte(`">Start one?</a>`)
var forum_28 []byte = []byte(`</div>`) var forum_31 []byte = []byte(`</div>`)
var forum_29 []byte = []byte(` var forum_32 []byte = []byte(`
</div> </div>
`) `)

View File

@ -1,8 +1,8 @@
// Code generated by. DO NOT EDIT. // Code generated by. DO NOT EDIT.
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ /* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
package main package main
import "io"
import "strconv" import "strconv"
import "io"
func init() { func init() {
template_profile_handle = template_profile template_profile_handle = template_profile
@ -53,71 +53,73 @@ w.Write(profile_4)
} }
w.Write(profile_5) w.Write(profile_5)
if tmpl_profile_vars.CurrentUser.Is_Super_Mod && !tmpl_profile_vars.ProfileOwner.Is_Super_Mod { if tmpl_profile_vars.CurrentUser.Is_Super_Mod && !tmpl_profile_vars.ProfileOwner.Is_Super_Mod {
if tmpl_profile_vars.ProfileOwner.Is_Banned {
w.Write(profile_6) w.Write(profile_6)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) if tmpl_profile_vars.ProfileOwner.Is_Banned {
w.Write(profile_7) w.Write(profile_7)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_8) w.Write(profile_8)
} else { w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_9) w.Write(profile_9)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) } else {
w.Write(profile_10) w.Write(profile_10)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_11)
}
}
w.Write(profile_12)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_13) w.Write(profile_11)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_12)
}
w.Write(profile_13)
}
w.Write(profile_14) w.Write(profile_14)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_15)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_16)
if len(tmpl_profile_vars.ItemList) != 0 { if len(tmpl_profile_vars.ItemList) != 0 {
for _, item := range tmpl_profile_vars.ItemList { for _, item := range tmpl_profile_vars.ItemList {
w.Write(profile_15)
if item.Avatar != "" {
w.Write(profile_16)
w.Write([]byte(item.Avatar))
w.Write(profile_17) w.Write(profile_17)
if item.ContentLines <= 5 { if item.Avatar != "" {
w.Write(profile_18) w.Write(profile_18)
} w.Write([]byte(item.Avatar))
w.Write(profile_19) w.Write(profile_19)
if item.ContentLines <= 5 {
w.Write(profile_20)
}
w.Write(profile_21)
w.Write([]byte(string(item.Css))) w.Write([]byte(string(item.Css)))
} }
w.Write(profile_20)
w.Write([]byte(item.ContentHtml))
w.Write(profile_21)
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
w.Write(profile_22) w.Write(profile_22)
w.Write([]byte(item.CreatedByName)) w.Write([]byte(item.ContentHtml))
w.Write(profile_23) w.Write(profile_23)
if tmpl_profile_vars.CurrentUser.Is_Mod { w.Write([]byte(strconv.Itoa(item.CreatedBy)))
w.Write(profile_24) w.Write(profile_24)
w.Write([]byte(strconv.Itoa(item.ID))) w.Write([]byte(item.CreatedByName))
w.Write(profile_25) w.Write(profile_25)
w.Write([]byte(strconv.Itoa(item.ID))) if tmpl_profile_vars.CurrentUser.Is_Mod {
w.Write(profile_26) w.Write(profile_26)
} w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(profile_27) w.Write(profile_27)
w.Write([]byte(strconv.Itoa(item.ID))) w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(profile_28) w.Write(profile_28)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) }
w.Write(profile_29) w.Write(profile_29)
if item.Tag != "" { w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(profile_30) w.Write(profile_30)
w.Write([]byte(item.Tag)) w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_31) w.Write(profile_31)
} if item.Tag != "" {
w.Write(profile_32) w.Write(profile_32)
} w.Write([]byte(item.Tag))
}
w.Write(profile_33) w.Write(profile_33)
if !tmpl_profile_vars.CurrentUser.Is_Banned {
w.Write(profile_34)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_35)
} }
w.Write(profile_34)
}
}
w.Write(profile_35)
if !tmpl_profile_vars.CurrentUser.Is_Banned {
w.Write(profile_36) w.Write(profile_36)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_37)
}
w.Write(profile_38)
w.Write(footer_0) w.Write(footer_0)
} }

View File

@ -58,31 +58,38 @@ w.Write(topics_5)
} }
} }
w.Write(topics_6) w.Write(topics_6)
w.Write([]byte(strconv.Itoa(item.ID))) w.Write([]byte(strconv.Itoa(item.PostCount)))
w.Write(topics_7) w.Write(topics_7)
w.Write([]byte(item.Title))
w.Write(topics_8)
if item.ForumName != "" {
w.Write(topics_9)
w.Write([]byte(strconv.Itoa(item.ParentID)))
w.Write(topics_10)
w.Write([]byte(item.ForumName))
w.Write(topics_11)
}
if item.Is_Closed {
w.Write(topics_12)
}
w.Write(topics_13)
w.Write([]byte(item.LastReplyAt)) w.Write([]byte(item.LastReplyAt))
w.Write(topics_8)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topics_9)
w.Write([]byte(item.Title))
w.Write(topics_10)
if item.ForumName != "" {
w.Write(topics_11)
w.Write([]byte(strconv.Itoa(item.ParentID)))
w.Write(topics_12)
w.Write([]byte(item.ForumName))
w.Write(topics_13)
}
w.Write(topics_14) w.Write(topics_14)
} w.Write([]byte(strconv.Itoa(item.CreatedBy)))
} else {
w.Write(topics_15) w.Write(topics_15)
if tmpl_topics_vars.CurrentUser.Perms.CreateTopic { w.Write([]byte(item.CreatedByName))
w.Write(topics_16) w.Write(topics_16)
} if item.Is_Closed {
w.Write(topics_17) w.Write(topics_17)
} }
w.Write(topics_18) w.Write(topics_18)
}
} else {
w.Write(topics_19)
if tmpl_topics_vars.CurrentUser.Perms.CreateTopic {
w.Write(topics_20)
}
w.Write(topics_21)
}
w.Write(topics_22)
w.Write(footer_0) w.Write(footer_0)
} }

View File

@ -1,15 +1,17 @@
package main package main
import "log" import (
import "fmt" "log"
import "bytes" "fmt"
import "strings" "bytes"
import "strconv" "strings"
//import "regexp" "strconv"
import "reflect" //"regexp"
import "path/filepath" "reflect"
import "io/ioutil" "path/filepath"
import "text/template/parse" "io/ioutil"
"text/template/parse"
)
var ctemplates []string var ctemplates []string
var tmpl_ptr_map map[string]interface{} = make(map[string]interface{}) var tmpl_ptr_map map[string]interface{} = make(map[string]interface{})
@ -181,12 +183,14 @@ w.Write([]byte(`," + ",-1)
} }
func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Value, template_name string, node interface{}) (out string) { func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Value, template_name string, node interface{}) (out string) {
if super_debug {
fmt.Println("in compile_switch")
}
switch node := node.(type) { switch node := node.(type) {
case *parse.ActionNode: case *parse.ActionNode:
if super_debug { if super_debug {
fmt.Println("Action Node") fmt.Println("Action Node")
} }
if node.Pipe == nil { if node.Pipe == nil {
break break
} }
@ -196,18 +200,24 @@ func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Valu
return out return out
case *parse.IfNode: case *parse.IfNode:
if super_debug { if super_debug {
fmt.Println("If Node: ") fmt.Println("If Node:")
fmt.Println(node.Pipe) fmt.Println("node.Pipe",node.Pipe)
} }
var expr string var expr string
for _, cmd := range node.Pipe.Cmds { for _, cmd := range node.Pipe.Cmds {
if super_debug { if super_debug {
fmt.Println("If Node Bit: ") fmt.Println("If Node Bit:",cmd)
fmt.Println(cmd) fmt.Println("If Node Bit Type:",reflect.ValueOf(cmd).Type().Name())
fmt.Println(reflect.ValueOf(cmd).Type().Name())
} }
expr += c.compile_varswitch(varholder, holdreflect, template_name, cmd) expr += c.compile_varswitch(varholder, holdreflect, template_name, cmd)
if super_debug {
fmt.Println("If Node Expression Step:",c.compile_varswitch(varholder, holdreflect, template_name, cmd))
}
}
if super_debug {
fmt.Println("If Node Expression:",expr)
} }
c.previousNode = c.currentNode c.previousNode = c.currentNode
@ -215,12 +225,12 @@ func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Valu
c.nextNode = -1 c.nextNode = -1
if node.ElseList == nil { if node.ElseList == nil {
if super_debug { if super_debug {
fmt.Println("Branch 1") fmt.Println("Selected Branch 1")
} }
return "if " + expr + " {\n" + c.compile_switch(varholder, holdreflect, template_name, node.List) + "}\n" return "if " + expr + " {\n" + c.compile_switch(varholder, holdreflect, template_name, node.List) + "}\n"
} else { } else {
if super_debug { if super_debug {
fmt.Println("Branch 2") fmt.Println("Selected Branch 2")
} }
return "if " + expr + " {\n" + c.compile_switch(varholder, holdreflect, template_name, node.List) + "} else {\n" + c.compile_switch(varholder, holdreflect, template_name, node.ElseList) + "}\n" return "if " + expr + " {\n" + c.compile_switch(varholder, holdreflect, template_name, node.List) + "} else {\n" + c.compile_switch(varholder, holdreflect, template_name, node.ElseList) + "}\n"
} }
@ -241,15 +251,13 @@ func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Valu
var outVal reflect.Value var outVal reflect.Value
for _, cmd := range node.Pipe.Cmds { for _, cmd := range node.Pipe.Cmds {
if super_debug { if super_debug {
fmt.Println("Range Bit: ") fmt.Println("Range Bit:",cmd)
fmt.Println(cmd)
} }
out, outVal = c.compile_reflectswitch(varholder, holdreflect, template_name, cmd) out, outVal = c.compile_reflectswitch(varholder, holdreflect, template_name, cmd)
} }
if super_debug { if super_debug {
fmt.Println("Returned: ") fmt.Println("Returned:",out)
fmt.Println(out)
fmt.Println("Range Kind Switch!") fmt.Println("Range Kind Switch!")
} }
@ -280,9 +288,6 @@ func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Valu
} }
return out return out
case *parse.TemplateNode: case *parse.TemplateNode:
if super_debug {
fmt.Println("Template Node")
}
return c.compile_subtemplate(varholder, holdreflect, node) return c.compile_subtemplate(varholder, holdreflect, node)
case *parse.TextNode: case *parse.TextNode:
c.previousNode = c.currentNode c.previousNode = c.currentNode
@ -309,12 +314,14 @@ func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Valu
} }
func (c *CTemplateSet) compile_subswitch(varholder string, holdreflect reflect.Value, template_name string, node *parse.CommandNode) (out string) { func (c *CTemplateSet) compile_subswitch(varholder string, holdreflect reflect.Value, template_name string, node *parse.CommandNode) (out string) {
if super_debug {
fmt.Println("in compile_subswitch")
}
firstWord := node.Args[0] firstWord := node.Args[0]
switch n := firstWord.(type) { switch n := firstWord.(type) {
case *parse.FieldNode: case *parse.FieldNode:
if super_debug { if super_debug {
fmt.Println("Field Node: ") fmt.Println("Field Node:",n.Ident)
fmt.Println(n.Ident)
} }
/* Use reflect to determine if the field is for a method, otherwise assume it's a variable. Coming Soon. */ /* Use reflect to determine if the field is for a method, otherwise assume it's a variable. Coming Soon. */
@ -328,10 +335,8 @@ func (c *CTemplateSet) compile_subswitch(varholder string, holdreflect reflect.V
for _, id := range n.Ident { for _, id := range n.Ident {
if super_debug { if super_debug {
fmt.Println("Data Kind: ") fmt.Println("Data Kind:",cur.Kind().String())
fmt.Println(cur.Kind().String()) fmt.Println("Field Bit:",id)
fmt.Println("Field Bit: ")
fmt.Println(id)
} }
cur = cur.FieldByName(id) cur = cur.FieldByName(id)
@ -363,16 +368,14 @@ func (c *CTemplateSet) compile_subswitch(varholder string, holdreflect reflect.V
return out return out
case *parse.DotNode: case *parse.DotNode:
if super_debug { if super_debug {
fmt.Println("Dot Node") fmt.Println("Dot Node:",node.String())
fmt.Println(node.String())
} }
return c.compile_varsub(varholder, holdreflect) return c.compile_varsub(varholder, holdreflect)
case *parse.NilNode: case *parse.NilNode:
panic("Nil is not a command x.x") panic("Nil is not a command x.x")
case *parse.VariableNode: case *parse.VariableNode:
if super_debug { if super_debug {
fmt.Println("Variable Node") fmt.Println("Variable Node:",n.String())
fmt.Println(n.String())
fmt.Println(n.Ident) fmt.Println(n.Ident)
} }
varname, reflectVal := c.compile_if_varsub(n.String(), varholder, template_name, holdreflect) varname, reflectVal := c.compile_if_varsub(n.String(), varholder, template_name, holdreflect)
@ -381,32 +384,29 @@ func (c *CTemplateSet) compile_subswitch(varholder string, holdreflect reflect.V
return n.Quoted return n.Quoted
case *parse.IdentifierNode: case *parse.IdentifierNode:
if super_debug { if super_debug {
fmt.Println("Identifier Node: ") fmt.Println("Identifier Node:",node)
fmt.Println(node) fmt.Println("Identifier Node Args:",node.Args)
fmt.Println(node.Args)
} }
return c.compile_varsub(c.compile_identswitch(varholder, holdreflect, template_name, node)) return c.compile_varsub(c.compile_identswitch(varholder, holdreflect, template_name, node))
default: default:
fmt.Println("Unknown Kind: ") fmt.Println("Unknown Kind:",reflect.ValueOf(firstWord).Elem().Kind())
fmt.Println(reflect.ValueOf(firstWord).Elem().Kind()) fmt.Println("Unknown Type:",reflect.ValueOf(firstWord).Elem().Type().Name())
fmt.Println("Unknown Type: ")
fmt.Println(reflect.ValueOf(firstWord).Elem().Type().Name())
panic("I don't know what node this is") panic("I don't know what node this is")
} }
return "" return ""
} }
func (c *CTemplateSet) compile_varswitch(varholder string, holdreflect reflect.Value, template_name string, node *parse.CommandNode) (out string) { func (c *CTemplateSet) compile_varswitch(varholder string, holdreflect reflect.Value, template_name string, node *parse.CommandNode) (out string) {
if super_debug {
fmt.Println("in compile_varswitch")
}
firstWord := node.Args[0] firstWord := node.Args[0]
switch n := firstWord.(type) { switch n := firstWord.(type) {
case *parse.FieldNode: case *parse.FieldNode:
if super_debug { if super_debug {
fmt.Println("Field Node: ") fmt.Println("Field Node:",n.Ident)
fmt.Println(n.Ident)
for _, id := range n.Ident { for _, id := range n.Ident {
fmt.Println("Field Bit: ") fmt.Println("Field Bit:",id)
fmt.Println(id)
} }
} }
@ -414,25 +414,22 @@ func (c *CTemplateSet) compile_varswitch(varholder string, holdreflect reflect.V
return c.compile_boolsub(n.String(), varholder, template_name, holdreflect) return c.compile_boolsub(n.String(), varholder, template_name, holdreflect)
case *parse.ChainNode: case *parse.ChainNode:
if super_debug { if super_debug {
fmt.Println("Chain Node: ") fmt.Println("Chain Node:",n.Node)
fmt.Println(n.Node) fmt.Println("Chain Node Args:",node.Args)
fmt.Println(node.Args)
} }
break break
case *parse.IdentifierNode: case *parse.IdentifierNode:
if super_debug { if super_debug {
fmt.Println("Identifier Node: ") fmt.Println("Identifier Node:",node)
fmt.Println(node) fmt.Println("Identifier Node Args:",node.Args)
fmt.Println(node.Args)
} }
return c.compile_identswitch_n(varholder, holdreflect, template_name, node) return c.compile_identswitch_n(varholder, holdreflect, template_name, node)
case *parse.DotNode: case *parse.DotNode:
return varholder return varholder
case *parse.VariableNode: case *parse.VariableNode:
if super_debug { if super_debug {
fmt.Println("Variable Node") fmt.Println("Variable Node:",n.String())
fmt.Println(n.String()) fmt.Println("Variable Node Identifier:",n.Ident)
fmt.Println(n.Ident)
} }
out, _ = c.compile_if_varsub(n.String(), varholder, template_name, holdreflect) out, _ = c.compile_if_varsub(n.String(), varholder, template_name, holdreflect)
return out return out
@ -442,45 +439,124 @@ func (c *CTemplateSet) compile_varswitch(varholder string, holdreflect reflect.V
if super_debug { if super_debug {
fmt.Println("Pipe Node!") fmt.Println("Pipe Node!")
fmt.Println(n) fmt.Println(n)
fmt.Println("Args: ") fmt.Println("Args:",node.Args)
fmt.Println(node.Args)
} }
out += c.compile_identswitch_n(varholder, holdreflect, template_name, node) out += c.compile_identswitch_n(varholder, holdreflect, template_name, node)
if super_debug { if super_debug {
fmt.Println("Out: ") fmt.Println("Out:",out)
fmt.Println(out)
} }
return out return out
default: default:
fmt.Println("Unknown Kind: ") fmt.Println("Unknown Kind:",reflect.ValueOf(firstWord).Elem().Kind())
fmt.Println(reflect.ValueOf(firstWord).Elem().Kind()) fmt.Println("Unknown Type:",reflect.ValueOf(firstWord).Elem().Type().Name())
fmt.Println("Unknown Type: ")
fmt.Println(reflect.ValueOf(firstWord).Elem().Type().Name())
panic("I don't know what node this is! Grr...") panic("I don't know what node this is! Grr...")
} }
return "" return ""
} }
func (c *CTemplateSet) compile_identswitch_n(varholder string, holdreflect reflect.Value, template_name string, node *parse.CommandNode) (out string) { func (c *CTemplateSet) compile_identswitch_n(varholder string, holdreflect reflect.Value, template_name string, node *parse.CommandNode) (out string) {
if super_debug {
fmt.Println("in compile_identswitch_n")
}
out, _ = c.compile_identswitch(varholder, holdreflect, template_name, node) out, _ = c.compile_identswitch(varholder, holdreflect, template_name, node)
return out return out
} }
func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect.Value, template_name string, node *parse.CommandNode) (out string, val reflect.Value) { func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect.Value, template_name string, node *parse.CommandNode) (out string, val reflect.Value) {
ArgLoop:
for pos, id := range node.Args {
if super_debug { if super_debug {
fmt.Println(id) fmt.Println("in compile_identswitch")
} }
//var outbuf map[int]string
ArgLoop:
for pos := 0; pos < len(node.Args); pos++ {
id := node.Args[pos]
if super_debug {
fmt.Println("pos:",pos)
fmt.Println("ID:",id)
}
switch id.String() { switch id.String() {
case "not": case "not":
out += "!" out += "!"
case "or": case "or":
out += " || " if super_debug {
fmt.Println("Building or function")
}
if pos == 0 {
fmt.Println("pos:",pos)
panic("or is missing a left operand")
return out, val
}
if len(node.Args) <= pos {
fmt.Println("post pos:",pos)
fmt.Println("len(node.Args):",len(node.Args))
panic("or is missing a right operand")
return out, val
}
left := c.compile_boolsub(node.Args[pos - 1].String(), varholder, template_name, holdreflect)
_, funcExists := c.funcMap[node.Args[pos + 1].String()]
var right string
if !funcExists {
right = c.compile_boolsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
}
out += left + " || " + right
if super_debug {
fmt.Println("Left operand:",node.Args[pos - 1])
fmt.Println("Right operand:",node.Args[pos + 1])
}
if !funcExists {
pos++
}
if super_debug {
fmt.Println("pos:",pos)
fmt.Println("len(node.Args):",len(node.Args))
}
case "and": case "and":
out += " && " if super_debug {
fmt.Println("Building and function")
}
if pos == 0 {
fmt.Println("pos:",pos)
panic("and is missing a left operand")
return out, val
}
if len(node.Args) <= pos {
fmt.Println("post pos:",pos)
fmt.Println("len(node.Args):",len(node.Args))
panic("and is missing a right operand")
return out, val
}
left := c.compile_boolsub(node.Args[pos - 1].String(), varholder, template_name, holdreflect)
_, funcExists := c.funcMap[node.Args[pos + 1].String()]
var right string
if !funcExists {
right = c.compile_boolsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
}
out += left + " && " + right
if super_debug {
fmt.Println("Left operand:",node.Args[pos - 1])
fmt.Println("Right operand:",node.Args[pos + 1])
}
if !funcExists {
pos++
}
if super_debug {
fmt.Println("pos:",pos)
fmt.Println("len(node.Args):",len(node.Args))
}
case "le": case "le":
out += c.compile_if_varsub_n(node.Args[pos + 1].String(), varholder, template_name, holdreflect) + " <= " + c.compile_if_varsub_n(node.Args[pos + 2].String(), varholder, template_name, holdreflect) out += c.compile_if_varsub_n(node.Args[pos + 1].String(), varholder, template_name, holdreflect) + " <= " + c.compile_if_varsub_n(node.Args[pos + 2].String(), varholder, template_name, holdreflect)
if super_debug { if super_debug {
@ -607,23 +683,33 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
if super_debug { if super_debug {
fmt.Println("Variable!") fmt.Println("Variable!")
} }
if len(node.Args) > (pos + 1) {
next_node := node.Args[pos + 1].String()
if next_node == "or" || next_node == "and" {
continue
}
}
out += c.compile_if_varsub_n(id.String(), varholder, template_name, holdreflect) out += c.compile_if_varsub_n(id.String(), varholder, template_name, holdreflect)
} }
} }
//for _, outval := range outbuf {
// out += outval
//}
return out, val return out, val
} }
func (c *CTemplateSet) compile_reflectswitch(varholder string, holdreflect reflect.Value, template_name string, node *parse.CommandNode) (out string, outVal reflect.Value) { func (c *CTemplateSet) compile_reflectswitch(varholder string, holdreflect reflect.Value, template_name string, node *parse.CommandNode) (out string, outVal reflect.Value) {
if super_debug {
fmt.Println("in compile_reflectswitch")
}
firstWord := node.Args[0] firstWord := node.Args[0]
switch n := firstWord.(type) { switch n := firstWord.(type) {
case *parse.FieldNode: case *parse.FieldNode:
if super_debug { if super_debug {
fmt.Println("Field Node: ") fmt.Println("Field Node:",n.Ident)
fmt.Println(n.Ident)
for _, id := range n.Ident { for _, id := range n.Ident {
fmt.Println("Field Bit: ") fmt.Println("Field Bit:",id)
fmt.Println(id)
} }
} }
/* Use reflect to determine if the field is for a method, otherwise assume it's a variable. Coming Soon. */ /* Use reflect to determine if the field is for a method, otherwise assume it's a variable. Coming Soon. */
@ -646,11 +732,17 @@ func (c *CTemplateSet) compile_reflectswitch(varholder string, holdreflect refle
} }
func (c *CTemplateSet) compile_if_varsub_n(varname string, varholder string, template_name string, cur reflect.Value) (out string) { func (c *CTemplateSet) compile_if_varsub_n(varname string, varholder string, template_name string, cur reflect.Value) (out string) {
if super_debug {
fmt.Println("in compile_if_varsub_n")
}
out, _ = c.compile_if_varsub(varname, varholder, template_name, cur) out, _ = c.compile_if_varsub(varname, varholder, template_name, cur)
return out return out
} }
func (c *CTemplateSet) compile_if_varsub(varname string, varholder string, template_name string, cur reflect.Value) (out string, val reflect.Value) { func (c *CTemplateSet) compile_if_varsub(varname string, varholder string, template_name string, cur reflect.Value) (out string, val reflect.Value) {
if super_debug {
fmt.Println("in compile_if_varsub")
}
if varname[0] != '.' && varname[0] != '$' { if varname[0] != '.' && varname[0] != '$' {
return varname, cur return varname, cur
} }
@ -680,10 +772,8 @@ func (c *CTemplateSet) compile_if_varsub(varname string, varholder string, templ
bits[0] = strings.TrimPrefix(bits[0],"$") bits[0] = strings.TrimPrefix(bits[0],"$")
if super_debug { if super_debug {
fmt.Println("Cur Kind: ") fmt.Println("Cur Kind:",cur.Kind())
fmt.Println(cur.Kind()) fmt.Println("Cur Type:",cur.Type().Name())
fmt.Println("Cur Type: ")
fmt.Println(cur.Type().Name())
} }
for _, bit := range bits { for _, bit := range bits {
@ -705,20 +795,15 @@ func (c *CTemplateSet) compile_if_varsub(varname string, varholder string, templ
} }
if super_debug { if super_debug {
fmt.Println("Data Kind: ") fmt.Println("Data Kind:",cur.Kind())
fmt.Println(cur.Kind()) fmt.Println("Data Type:",cur.Type().Name())
fmt.Println("Data Type: ")
fmt.Println(cur.Type().Name())
} }
} }
if super_debug { if super_debug {
fmt.Println("Out Value: ") fmt.Println("Out Value:",out)
fmt.Println(out) fmt.Println("Out Kind:",cur.Kind())
fmt.Println("Out Kind: ") fmt.Println("Out Type:",cur.Type().Name())
fmt.Println(cur.Kind())
fmt.Println("Out Type: ")
fmt.Println(cur.Type().Name())
} }
for _, varItem := range c.varList { for _, varItem := range c.varList {
@ -728,12 +813,9 @@ func (c *CTemplateSet) compile_if_varsub(varname string, varholder string, templ
} }
if super_debug { if super_debug {
fmt.Println("Out Value: ") fmt.Println("Out Value:",out)
fmt.Println(out) fmt.Println("Out Kind:",cur.Kind())
fmt.Println("Out Kind: ") fmt.Println("Out Type:",cur.Type().Name())
fmt.Println(cur.Kind())
fmt.Println("Out Type: ")
fmt.Println(cur.Type().Name())
} }
_, ok := c.stats[out] _, ok := c.stats[out]
@ -747,6 +829,9 @@ func (c *CTemplateSet) compile_if_varsub(varname string, varholder string, templ
} }
func (c *CTemplateSet) compile_boolsub(varname string, varholder string, template_name string, val reflect.Value) string { func (c *CTemplateSet) compile_boolsub(varname string, varholder string, template_name string, val reflect.Value) string {
if super_debug {
fmt.Println("in compile_boolsub")
}
out, val := c.compile_if_varsub(varname, varholder, template_name, val) out, val := c.compile_if_varsub(varname, varholder, template_name, val)
switch val.Kind() { switch val.Kind() {
case reflect.Int: out += " > 0" case reflect.Int: out += " > 0"
@ -754,15 +839,18 @@ func (c *CTemplateSet) compile_boolsub(varname string, varholder string, templat
case reflect.String: out += " != \"\"" case reflect.String: out += " != \"\""
case reflect.Int64: out += " > 0" case reflect.Int64: out += " > 0"
default: default:
fmt.Println(varname) fmt.Println("Variable Name:",varname)
fmt.Println(varholder) fmt.Println("Variable Holder:",varholder)
fmt.Println(val.Kind()) fmt.Println("Variable Kind:",val.Kind())
panic("I don't know what this variable's type is o.o\n") panic("I don't know what this variable's type is o.o\n")
} }
return out return out
} }
func (c *CTemplateSet) compile_varsub(varname string, val reflect.Value) string { func (c *CTemplateSet) compile_varsub(varname string, val reflect.Value) string {
if super_debug {
fmt.Println("in compile_varsub")
}
for _, varItem := range c.varList { for _, varItem := range c.varList {
if strings.HasPrefix(varname, varItem.Destination) { if strings.HasPrefix(varname, varItem.Destination) {
varname = strings.Replace(varname, varItem.Destination, varItem.Name, 1) varname = strings.Replace(varname, varItem.Destination, varItem.Name, 1)
@ -794,18 +882,16 @@ func (c *CTemplateSet) compile_varsub(varname string, val reflect.Value) string
case reflect.Int64: case reflect.Int64:
return "w.Write([]byte(strconv.FormatInt(" + varname + ", 10)))" return "w.Write([]byte(strconv.FormatInt(" + varname + ", 10)))"
default: default:
fmt.Println("Unknown Variable Name: ") fmt.Println("Unknown Variable Name:",varname)
fmt.Println(varname) fmt.Println("Unknown Kind:",val.Kind())
fmt.Println("Unknown Kind: ") fmt.Println("Unknown Type:",val.Type().Name())
fmt.Println(val.Kind())
fmt.Println("Unknown Type: ")
fmt.Println(val.Type().Name())
panic("// I don't know what this variable's type is o.o\n") panic("// I don't know what this variable's type is o.o\n")
} }
} }
func (c *CTemplateSet) compile_subtemplate(pvarholder string, pholdreflect reflect.Value, node *parse.TemplateNode) (out string) { func (c *CTemplateSet) compile_subtemplate(pvarholder string, pholdreflect reflect.Value, node *parse.TemplateNode) (out string) {
if super_debug { if super_debug {
fmt.Println("in compile_subtemplate")
fmt.Println("Template Node: " + node.Name) fmt.Println("Template Node: " + node.Name)
} }
@ -859,7 +945,7 @@ func (c *CTemplateSet) compile_subtemplate(pvarholder string, pholdreflect refle
treeLength := len(subtree.Root.Nodes) treeLength := len(subtree.Root.Nodes)
for index, node := range subtree.Root.Nodes { for index, node := range subtree.Root.Nodes {
if super_debug { if super_debug {
fmt.Println("Node: " + node.String()) fmt.Println("Node:",node.String())
} }
c.previousNode = c.currentNode c.previousNode = c.currentNode

View File

@ -8,10 +8,17 @@
<div class="rowitem rowhead"><a>{{.Title}}</a> <div class="rowitem rowhead"><a>{{.Title}}</a>
{{if ne .CurrentUser.ID 0}}{{if not .CurrentUser.Perms.CreateTopic}}<span class='username head_tag_upshift' title='No Permissions'>&#x1F512;&#xFE0E</span>{{else}}<a href="/topics/create/{{.Forum.ID}}" class='username head_tag_upshift'>New Topic</a>{{end}}{{end}}</div> {{if ne .CurrentUser.ID 0}}{{if not .CurrentUser.Perms.CreateTopic}}<span class='username head_tag_upshift' title='No Permissions'>&#x1F512;&#xFE0E</span>{{else}}<a href="/topics/create/{{.Forum.ID}}" class='username head_tag_upshift'>New Topic</a>{{end}}{{end}}</div>
</div> </div>
<div class="rowblock"> <div id="forum_topic_list" class="rowblock topic_list">
{{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}}"> {{range .ItemList}}<div class="rowitem passive datarow" 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;margin-left:8px;">&#x1F512;&#xFE0E</span>{{end}} <span class="rowsmall" style="float: right;">
<a style="float: right;font-size:12px;">{{.LastReplyAt}}</a> <span class="replyCount">{{.PostCount}} replies</span><br />
<span class="lastReplyAt">{{.LastReplyAt}}</span>
</span>
<span>
<a class="rowtopic" href="/topic/{{.ID}}">{{.Title}}</a>
<br /><a class="rowsmall" href="/user/{{.CreatedBy}}">Starter: {{.CreatedByName}}</a>
{{if .Is_Closed}}<span class="rowsmall topic_status_e topic_status_closed" title="Status: Closed"> | &#x1F512;&#xFE0E{{end}}</span>
</span>
</div> </div>
{{else}}<div class="rowitem passive">There aren't any topics in this forum yet.{{if .CurrentUser.Perms.CreateTopic}} <a href="/topics/create/{{.Forum.ID}}">Start one?</a>{{end}}</div>{{end}} {{else}}<div class="rowitem passive">There aren't any topics in this forum yet.{{if .CurrentUser.Perms.CreateTopic}} <a href="/topics/create/{{.Forum.ID}}">Start one?</a>{{end}}</div>{{end}}
</div> </div>

View File

@ -3,9 +3,21 @@
<div class="rowitem rowhead"><a>Forums</a></div> <div class="rowitem rowhead"><a>Forums</a></div>
</div> </div>
<div class="rowblock"> <div class="rowblock">
{{range .ItemList}}<div class="rowitem"> {{range .ItemList}}<div class="rowitem {{if (.Desc) or (.LastTopicTime)}}datarow{{end}}">
<a href="/forum/{{.ID}}" class="panel_upshift">{{.Name}}</a> {{if .Desc}}<span style="float: left;">
<a href="/topic/{{.LastTopicID}}" style="float: right;">{{.LastTopic}} <small style="font-size: 12px;">{{.LastTopicTime}}</small></a> <a href="/forum/{{.ID}}" style="">{{.Name}}</a>
<br /><span class="rowsmall">{{.Desc}}</span>
</span>{{else if .LastTopicTime}}<span style="float: left;padding-top: 8px;font-size: 18px;">
<a href="/forum/{{.ID}}">{{.Name}}</a>
</span>{{else}}<span style="float: left;">
<a href="/forum/{{.ID}}">{{.Name}}</a>
</span>{{end}}
<span style="float: right;">
<a href="/topic/{{.LastTopicID}}" style="float: right;font-size: 14px;">{{.LastTopic}}</a>
{{if .LastTopicTime}}<br /><span class="rowsmall">{{.LastTopicTime}}</span>{{end}}
</span>
<div style="clear: both;"></div>
</div> </div>
{{else}}<div class="rowitem passive">You don't have access to any forums.</div>{{end}} {{else}}<div class="rowitem passive">You don't have access to any forums.</div>{{end}}
</div> </div>

View File

@ -15,7 +15,8 @@
<li class="menu_left menu_register"><a href="/accounts/create/">Register</a></li> <li class="menu_left menu_register"><a href="/accounts/create/">Register</a></li>
<li class="menu_left menu_login"><a href="/accounts/login/">Login</a></li> <li class="menu_left menu_login"><a href="/accounts/login/">Login</a></li>
{{end}} {{end}}
<li class="menu_right menu_alerts">🔔︎ <li class="menu_right menu_alerts">
<div class="alert_bell">🔔︎</div>
<div class="alert_counter"></div> <div class="alert_counter"></div>
<div class="alertList"></div> <div class="alertList"></div>
</li> </li>

View File

@ -0,0 +1,67 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<script>
var form_vars = {'perm_preset': ['can_moderate','can_post','read_only','no_access','default','custom']};
</script>
</div>
<div class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem rowhead"><a>{{.Name}} Forum</a></div>
</div>
<div id="panel_forum" class="colstack_item">
<form action="/panel/forums/edit/submit/{{.ID}}?session={{.CurrentUser.Session}}" method="post">
<div class="formrow">
<div class="formitem formlabel"><a>Name</a></div>
<div class="formitem"><input name="forum_name" type="text" value="{{.Name}}" placeholder="General Forum" /></div>
</div>
<div class="formrow">
<div class="formitem formlabel"><a>Description</a></div>
<div class="formitem"><input name="forum_desc" type="text" value="{{.Desc}}" placeholder="Where the general stuff happens" /></div>
</div>
<div class="formrow">
<div class="formitem formlabel"><a>Hidden?</a></div>
<div class="formitem"><select name="forum_active">
<option{{if not .Active}} selected{{end}} value="1">Yes</option>
<option{{if .Active}} selected{{end}} value="0">No</option>
</select></div>
</div>
<div class="formrow">
<div class="formitem formlabel"><a>Preset</a></div>
<div class="formitem">
<select name="forum_preset">
<option{{if eq .Preset "all"}} selected{{end}} value="all">Everyone</option>
<option{{if eq .Preset "announce"}} selected{{end}} value="announce">Announcements</option>
<option{{if eq .Preset "members"}} selected{{end}} value="members">Member Only</option>
<option{{if eq .Preset "staff"}} selected{{end}} value="staff">Staff Only</option>
<option{{if eq .Preset "admins"}} selected{{end}} value="admins">Admin Only</option>
<option{{if eq .Preset "archive"}} selected{{end}} value="archive">Archive</option>
<option{{if eq .Preset "custom"}} selected{{end}} value="custom">Custom</option>
</select>
</div>
</div>
<div class="formrow">
<div class="formitem"><button name="panel-button" class="formbutton">Update Forum</button></div>
</div>
</form>
</div>
<div class="colstack_item colstack_head">
<div class="rowitem rowhead"><a>Forum Permissions</a></div>
</div>
<div id="forum_quick_perms" class="colstack_item">
{{range .Groups}}
<div class="formrow">
<div class="formitem editable_parent">
<a>{{.Group.Name}}</a>
<input name="gid" value="{{.Group.ID}}" type="hidden" class="editable_block" data-field="gid" data-type="hidden" data-value="{{.Group.ID}}" />
<span class="edit_fields hide_on_edit rowsmall">Edit</span>
<div class="panel_floater">
<span data-field="perm_preset" data-type="list" data-value="{{.Preset}}" class="editable_block perm_preset perm_preset_{{.Preset}}"></span>
<a class="panel_right_button" href="/panel/forums/edit/perms/submit/{{$.ID}}"><button class='panel_tag submit_edit show_on_edit' type='submit'>Update</button></a>
</div>
</div>
</div>
{{end}}
</div>
</div>
{{template "footer.html" . }}

View File

@ -12,17 +12,22 @@
<div id="panel_forums" class="colstack_item"> <div id="panel_forums" class="colstack_item">
{{range .ItemList}} {{range .ItemList}}
<div class="rowitem editable_parent" style="{{if eq .ID 1}}border-bottom-style:solid;{{end}}"> <div class="rowitem editable_parent" style="{{if eq .ID 1}}border-bottom-style:solid;{{end}}">
<a data-field="forum_name" data-type="text" class="editable_block panel_upshift" style="{{if not .Active}}color:#707070;{{end}}">{{.Name}}</a>
<span class="panel_floater"> <span class="panel_floater">
<span data-field="forum_active" data-type="list" class="panel_tag editable_block forum_active {{if .Active}}forum_active_Show" data-value="1{{else}}forum_active_Hide" data-value="0{{end}}" title="Hidden"></span> <span data-field="forum_active" data-type="list" class="panel_tag editable_block forum_active {{if .Active}}forum_active_Show" data-value="1{{else}}forum_active_Hide" data-value="0{{end}}" title="Hidden"></span>
<span data-field="forum_preset" data-type="list" data-value="{{.Preset}}" class="panel_tag editable_block forum_preset forum_preset_{{.Preset}}" title="{{.PresetLang}}"></span> <span data-field="forum_preset" data-type="list" data-value="{{.Preset}}" class="panel_tag editable_block forum_preset forum_preset_{{.Preset}}" title="{{.PresetLang}}"></span>
<span class="panel_buttons"> <span class="panel_buttons">
{{if gt .ID 0}}<a class="panel_tag edit_fields hide_on_edit panel_right_button">Edit</a> {{if gt .ID 0}}<a class="panel_tag edit_fields hide_on_edit panel_right_button">Edit</a>
<a class="panel_right_button" href="/panel/forums/edit/submit/{{.ID}}"><button class='panel_tag submit_edit show_on_edit' type='submit'>Update</button></a>{{end}} <a class="panel_right_button" href="/panel/forums/edit/submit/{{.ID}}"><button class='panel_tag submit_edit show_on_edit' type='submit'>Update</button></a>{{end}}
{{if gt .ID 1}}<a href="/panel/forums/delete/{{.ID}}?session={{$.CurrentUser.Session}}" class="panel_tag panel_right_button">Delete</a>{{end}} {{if gt .ID 1}}<a href="/panel/forums/delete/{{.ID}}?session={{$.CurrentUser.Session}}" class="panel_tag panel_right_button hide_on_edit">Delete</a>{{end}}
<a href="/panel/forums/edit/{{.ID}}" class="panel_tag panel_right_button show_on_edit">Full Edit</a>
</span> </span>
</span> </span>
<span style="float: left;">
<a data-field="forum_name" data-type="text" class="editable_block forum_name" style="{{if not .Active}}color:#707070;{{end}}">{{.Name}}</a>
</span>
<br /><span data-field="forum_desc" data-type="text" class="editable_block forum_desc rowsmall">{{.Desc}}</span>
<div style="clear: both;"></div>
</div> </div>
{{end}} {{end}}
</div> </div>
@ -36,11 +41,15 @@
<div class="formitem formlabel"><a>Forum Name</a></div> <div class="formitem formlabel"><a>Forum Name</a></div>
<div class="formitem"><input name="forum-name" type="text" placeholder="Super Secret Forum" /></div> <div class="formitem"><input name="forum-name" type="text" placeholder="Super Secret Forum" /></div>
</div> </div>
<div class="formrow">
<div class="formitem formlabel"><a>Description</a></div>
<div class="formitem"><input name="forum-desc" type="text" placeholder="Where all the super secret stuff happens" /></div>
</div>
<div class="formrow"> <div class="formrow">
<div class="formitem formlabel"><a>Hidden?</a></div> <div class="formitem formlabel"><a>Hidden?</a></div>
<div class="formitem"><select name="forum-active"> <div class="formitem"><select name="forum-active">
<option value="1">Yes</option> <option value="0">Yes</option>
<option value="0">No</option> <option value="1">No</option>
</select></div> </select></div>
</div> </div>
<div class="formrow"> <div class="formrow">

View File

@ -18,7 +18,7 @@
<form action="/panel/groups/edit/submit/{{.ID}}?session={{.CurrentUser.Session}}" method="post"> <form action="/panel/groups/edit/submit/{{.ID}}?session={{.CurrentUser.Session}}" method="post">
<div class="formrow"> <div class="formrow">
<div class="formitem formlabel"><a>Name</a></div> <div class="formitem formlabel"><a>Name</a></div>
<div class="formitem"><input name="group-name" type="text" value="{{.Name}}" placeholder="General Forum" /></div> <div class="formitem"><input name="group-name" type="text" value="{{.Name}}" placeholder="Random Group" /></div>
</div> </div>
{{if .CurrentUser.Perms.EditGroup}} {{if .CurrentUser.Perms.EditGroup}}
<div class="formrow"> <div class="formrow">

View File

@ -10,10 +10,11 @@
<div class="rowitem passive"> <div class="rowitem passive">
<a class="profile_menu_item">Add Friend</a> <a class="profile_menu_item">Add Friend</a>
</div> </div>
<div class="rowitem passive" {{if (.CurrentUser.Is_Super_Mod) and not (.ProfileOwner.Is_Super_Mod) }}<div class="rowitem passive">
{{if (.CurrentUser.Is_Super_Mod) and not (.ProfileOwner.Is_Super_Mod) }} {{if .ProfileOwner.Is_Banned }}<a href="/users/unban/{{.ProfileOwner.ID}}?session={{.CurrentUser.Session}}" class="profile_menu_item">Unban</a>
{{if .ProfileOwner.Is_Banned }}<a href="/users/unban/{{.ProfileOwner.ID}}?session={{.CurrentUser.Session}}" class="username">Unban</a>{{else}}<a href="/users/ban/{{.ProfileOwner.ID}}?session={{.CurrentUser.Session}}" class="username">Ban</a>{{end}} {{else}}<a href="/users/ban/{{.ProfileOwner.ID}}?session={{.CurrentUser.Session}}" class="profile_menu_item">Ban</a>{{end}}
{{end}} </div>{{end}}
<div class="rowitem passive">
<a href="/report/submit/{{.ProfileOwner.ID}}?session={{.CurrentUser.Session}}&type=user" class="profile_menu_item report_item">Report</a> <a href="/report/submit/{{.ProfileOwner.ID}}?session={{.CurrentUser.Session}}&type=user" class="profile_menu_item report_item">Report</a>
</div> </div>
</div> </div>

View File

@ -2,11 +2,17 @@
<div class="rowblock"> <div class="rowblock">
<div class="rowitem rowhead"><a>Topic List</a></div> <div class="rowitem rowhead"><a>Topic List</a></div>
</div> </div>
<div class="rowblock"> <div id="topic_list" class="rowblock topic_list">
{{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}}"> {{range .ItemList}}<div class="rowitem passive datarow" 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 .ForumName}}<a href="/forum/{{.ParentID}}" style="font-size:12px;">{{.ForumName}}</a> {{end}} <span class="rowsmall" style="float: right;">
{{if .Is_Closed}}<span class="username topic_status_e topic_status_closed" style="float: right;position:relative;top:-5px;margin-left:8px;" title="Status: Closed">&#x1F512;&#xFE0E</span>{{end}} <span class="replyCount">{{.PostCount}} replies</span><br />
<a style="float: right;font-size:12px;">{{.LastReplyAt}}</a> <span class="lastReplyAt">{{.LastReplyAt}}</span>
</span>
<span>
<a class="rowtopic" href="/topic/{{.ID}}">{{.Title}}</a> {{if .ForumName}}<a class="rowsmall" href="/forum/{{.ParentID}}">{{.ForumName}}</a>{{end}}
<br /><a class="rowsmall" href="/user/{{.CreatedBy}}">Starter: {{.CreatedByName}}</a>
{{if .Is_Closed}}<span class="rowsmall topic_status_e topic_status_closed" title="Status: Closed"> | &#x1F512;&#xFE0E{{end}}</span>
</span>
</div> </div>
{{else}}<div class="rowitem passive">There aren't any topics yet.{{if .CurrentUser.Perms.CreateTopic}} <a href="/topics/create/">Start one?</a>{{end}}</div>{{end}} {{else}}<div class="rowitem passive">There aren't any topics yet.{{if .CurrentUser.Perms.CreateTopic}} <a href="/topics/create/">Start one?</a>{{end}}</div>{{end}}
</div> </div>

View File

@ -53,12 +53,7 @@ li {
} }
li:first-child { border-left: 1px solid #7a7a7a; } li:first-child { border-left: 1px solid #7a7a7a; }
li a { li a, li:hover a, li a:hover, li a:link, li a:visited {
color: white;
text-decoration: none;
}
li:hover a, li a:hover, li a:link, li a:visited {
color: white; color: white;
text-decoration: none; text-decoration: none;
} }
@ -97,9 +92,7 @@ li:hover {
opacity: 0.8; opacity: 0.8;
text-align: center; text-align: center;
} }
.menu_alerts .alert_counter:empty { .menu_alerts .alert_counter:empty { display: none; }
display: none;
}
.selectedAlert { .selectedAlert {
background: white; background: white;
@ -110,12 +103,8 @@ li:hover {
color: black; color: black;
font-weight: bold; font-weight: bold;
} }
.selectedAlert .alert_counter { .selectedAlert .alert_counter { display: none; }
display: none; .menu_alerts .alertList { display: none; }
}
.menu_alerts .alertList {
display: none;
}
.selectedAlert .alertList { .selectedAlert .alertList {
position: absolute; position: absolute;
top: 41px; top: 41px;
@ -152,9 +141,7 @@ li:hover {
width: 100%; width: 100%;
color: black; color: black;
} }
.alertItem .text.smaller { .alertItem .text.smaller { font-size: 9px; }
font-size: 9px;
}
#footer { #footer {
clear: left; clear: left;
@ -198,6 +185,14 @@ hr { color: silver; border: 1px solid silver; }
.rowitem:not(:last-child) { border-bottom: 1px dotted #ccc; } .rowitem:not(:last-child) { border-bottom: 1px dotted #ccc; }
.rowblock:first-of-type { margin-top: 8px; } .rowblock:first-of-type { margin-top: 8px; }
.datarow {
padding-top: 10px;
padding-bottom: 10px;
}
.rowsmall {
font-size:12px;
}
.rowhead, .colhead { .rowhead, .colhead {
background: #ce2424; background: #ce2424;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#f97779), to(#ce2424)); background: -webkit-gradient(linear, 0 0, 0 bottom, from(#f97779), to(#ce2424));
@ -265,8 +260,7 @@ hr { color: silver; border: 1px solid silver; }
word-wrap: break-word; word-wrap: break-word;
} }
.colstack_head { margin-bottom: 0px; } .colstack_head { margin-bottom: 0px; }
.colstack_left:empty { display: none; } .colstack_left:empty, .colstack_right:empty { display: none; }
.colstack_right:empty { display: none; }
.colstack_grid { .colstack_grid {
display: grid; display: grid;
@ -529,9 +523,7 @@ blockquote p {
padding-bottom: 0; padding-bottom: 0;
width: 100%; width: 100%;
} }
.user_content.nobuttons { .user_content.nobuttons { min-height: 168px; }
min-height: 168px;
}
.button_container { .button_container {
border-top: solid 1px #eaeaea; border-top: solid 1px #eaeaea;
@ -560,26 +552,14 @@ blockquote p {
border-left: solid 1px #eaeaea; border-left: solid 1px #eaeaea;
} }
.like_label:before { .like_label:before { content: "😀"; }
content: "😀"; .edit_label:before { content: "🖊️"; }
} .trash_label:before { content: "🗑️"; }
.edit_label:before { .flag_label:before { content: "🚩"; }
content: "🖊️";
}
.trash_label:before {
content: "🗑️";
}
.flag_label:before {
content: "🚩";
}
.mod_button { .mod_button { margin-right: 4px; }
margin-right: 4px;
}
.post_item:not(.simple) { .post_item:not(.simple) { background-color: #eaeaea; }
background-color: #eaeaea;
}
.post_item { .post_item {
background-color: #eaeaea; background-color: #eaeaea;
padding-top: 4px; padding-top: 4px;
@ -634,9 +614,7 @@ blockquote p {
box-shadow:0 1px 2px rgba(0,0,0,.1); box-shadow:0 1px 2px rgba(0,0,0,.1);
} }
.action_item .userinfo { .action_item .userinfo { display: none; }
display: none;
}
.action_item .content_container { .action_item .content_container {
min-height: auto; min-height: auto;
padding: 15px; padding: 15px;
@ -690,73 +668,40 @@ blockquote p {
font-size: 14px; font-size: 14px;
} }
.panel_floater { .panel_floater { float: right; }
float: right; #panel_groups > .rowitem > .panel_floater { float: none; }
} #panel_groups > .rowitem > .panel_floater > .panel_right_button { float: right; }
#panel_groups > .rowitem > .panel_floater { #panel_forums > .rowitem > .panel_floater { float: none; }
float: none; #panel_forums > .rowitem > .panel_floater > .panel_buttons { float: right; }
}
#panel_groups > .rowitem > .panel_floater > .panel_right_button {
float: right;
}
#panel_forums > .rowitem > .panel_floater {
float: none;
}
#panel_forums > .rowitem > .panel_floater > .panel_buttons {
float: right;
}
.panel_rank_tag, .forum_preset, .forum_active { .panel_rank_tag, .forum_preset, .forum_active {
float: none; float: none;
color: #202020 !important; color: #202020 !important;
font-size: 11px; font-size: 11px;
} }
.panel_rank_tag_admin:before { .panel_rank_tag_admin:before { content: "Admins"; }
content: "Admins"; .panel_rank_tag_mod:before { content: "Mods"; }
} .panel_rank_tag_banned:before { content: "Banned"; }
.panel_rank_tag_mod:before { .panel_rank_tag_guest:before { content: "Guests"; }
content: "Mods"; .panel_rank_tag_member:before { content: "Members"; }
}
.panel_rank_tag_banned:before {
content: "Banned";
}
.panel_rank_tag_guest:before {
content: "Guests";
}
.panel_rank_tag_member:before {
content: "Members";
}
.forum_preset_announce:after { .forum_preset_announce:after { content: "Announcements"; }
content: "Announcements"; .forum_preset_members:after { content: "Member Only"; }
} .forum_preset_staff:after { content: "Staff Only"; }
.forum_preset_members:after { .forum_preset_admins:after { content: "Admin Only"; }
content: "Member Only"; .forum_preset_archive:after { content: "Archive"; }
} .forum_preset_all:after { content: "Public"; }
.forum_preset_staff:after { .forum_preset_custom, .forum_preset_ { display: none !important; }
content: "Staff Only"; .forum_active_Hide:before { content: "Hidden"; }
} .forum_active_Hide + .forum_preset:before { content: " | "; }
.forum_preset_admins:after { .forum_active_Show { display: none !important; }
content: "Admin Only";
} .perm_preset_no_access:before { content: "No Access"; color: maroon; }
.forum_preset_archive:after { .perm_preset_read_only:before { content: "Read Only"; color: green; }
content: "Archive"; .perm_preset_can_post:before { content: "Can Post"; color: green; }
} .perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
.forum_preset_all:after { .perm_preset_custom:before { content: "Custom"; color: black; }
content: "Public"; .perm_preset_default:before { content: "Default"; }
}
.forum_preset_custom, .forum_preset_ {
display: none !important;
}
.forum_active_Hide:before {
content: "Hidden";
}
.forum_active_Hide + .forum_preset:before {
content: " | ";
}
.forum_active_Show {
display: none !important;
}
/* Responsive Layout */ /* Responsive Layout */
/* Anything that isn't a small mobile */ /* Anything that isn't a small mobile */
@ -840,9 +785,7 @@ blockquote p {
} }
.rowblock { border-left: none; border-right: none; border-bottom: none; } .rowblock { border-left: none; border-right: none; border-bottom: none; }
.rowitem { border-left: none; border-right: none; } .rowitem, .rowhead, .tbody { border-left: none; border-right: none; }
.rowhead { border-left: none; border-right: none; }
.tbody { border-left: none; border-right: none; }
} }
@media(max-width: 620px) { @media(max-width: 620px) {
@ -1000,9 +943,7 @@ blockquote p {
border: 1px solid rgba(90,90,90,0.75); border: 1px solid rgba(90,90,90,0.75);
transition: transform 0.7s; transition: transform 0.7s;
} }
ul:hover { ul:hover { transform: rotateX(-15deg); }
transform: rotateX(-15deg);
}
li { li {
font-size: 15px; font-size: 15px;
@ -1055,23 +996,13 @@ blockquote p {
} }
@media (min-width: 1603px) { @media (min-width: 1603px) {
#back { #back { width: 1548px; }
width: 1548px;
margin-left: auto;
margin-right: auto;
}
#main { width: 1250px; } #main { width: 1250px; }
#main:not(.shrink_main) { width: calc(100% - 30px); } #main:not(.shrink_main) { width: calc(100% - 30px); }
} }
@media (min-width: 2400px) { @media (min-width: 2400px) {
#back { #back { width: 2000px; }
width: 2000px;
margin-left: auto;
margin-right: auto;
}
#main { width: 1690px; } #main { width: 1690px; }
#main:not(.shrink_main) { width: calc(100% - 30px); } #main:not(.shrink_main) { width: calc(100% - 30px); }
.index_category { .index_category {
@ -1089,6 +1020,5 @@ blockquote p {
#main:not(.shrink_main) { width: calc(100% - 30px); } #main:not(.shrink_main) { width: calc(100% - 30px); }
.index_category { width: 1230px; } .index_category { width: 1230px; }
.index_category:only-child { width: 100%; } .index_category:only-child { width: 100%; }
.right_sidebar { width: 350px; } .right_sidebar { width: 350px; }
} }

View File

@ -87,9 +87,7 @@ li:hover {
opacity: 0.8; opacity: 0.8;
text-align: center; text-align: center;
} }
.menu_alerts .alert_counter:empty { .menu_alerts .alert_counter:empty { display: none; }
display: none;
}
.selectedAlert { .selectedAlert {
background: white; background: white;
@ -100,12 +98,8 @@ li:hover {
color: black; color: black;
font-weight: bold; font-weight: bold;
} }
.selectedAlert .alert_counter { .selectedAlert .alert_counter { display: none; }
display: none; .menu_alerts .alertList { display: none; }
}
.menu_alerts .alertList {
display: none;
}
.selectedAlert .alertList { .selectedAlert .alertList {
position: absolute; position: absolute;
top: 41px; top: 41px;
@ -142,9 +136,7 @@ li:hover {
width: 100%; width: 100%;
color: black; color: black;
} }
.alertItem .text.smaller { .alertItem .text.smaller { font-size: 9px; }
font-size: 9px;
}
hr { color: silver; border: 1px solid silver; } hr { color: silver; border: 1px solid silver; }
@ -180,6 +172,14 @@ hr { color: silver; border: 1px solid silver; }
.rowblock:first-of-type { margin-top: 8px; } .rowblock:first-of-type { margin-top: 8px; }
.rowitem:not(:last-child) { border-bottom: 1px dotted #ccc; } .rowitem:not(:last-child) { border-bottom: 1px dotted #ccc; }
.datarow {
padding-top: 10px;
padding-bottom: 10px;
}
.rowsmall {
font-size:12px;
}
.rowhead, .colhead { .rowhead, .colhead {
background: #ce2424; background: #ce2424;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#f97779), to(#ce2424)); background: -webkit-gradient(linear, 0 0, 0 bottom, from(#f97779), to(#ce2424));
@ -247,8 +247,7 @@ hr { color: silver; border: 1px solid silver; }
word-wrap: break-word; word-wrap: break-word;
} }
.colstack_head { margin-bottom: 0px; } .colstack_head { margin-bottom: 0px; }
.colstack_left:empty { display: none; } .colstack_left:empty, .colstack_right:empty { display: none; }
.colstack_right:empty { display: none; }
.colstack_grid { .colstack_grid {
display: grid; display: grid;
@ -492,7 +491,6 @@ blockquote p {
top: 44px; top: 44px;
} }
.gadget { padding-bottom: 20px; } .gadget { padding-bottom: 20px; }
.cell_author img { margin-right: 8px; } .cell_author img { margin-right: 8px; }
.cell_last img { margin-right: 8px; } .cell_last img { margin-right: 8px; }
@ -542,10 +540,7 @@ blockquote p {
border-top-right-radius: 3px; border-top-right-radius: 3px;
right: -1px; right: -1px;
} }
.tag_block.groupRibbon { display: none; }
.tag_block.groupRibbon {
display: none;
}
/* From Tempra Conflux */ /* From Tempra Conflux */
.user_content:not(.simple) { .user_content:not(.simple) {
@ -558,9 +553,7 @@ blockquote p {
width: 100%; width: 100%;
border-radius: 4px; border-radius: 4px;
} }
.user_content.nobuttons { .user_content.nobuttons { min-height: 190px; }
min-height: 190px;
}
.button_container { .button_container {
border-top: solid 1px #eaeaea; border-top: solid 1px #eaeaea;
@ -589,26 +582,14 @@ blockquote p {
border-left: solid 1px #eaeaea; border-left: solid 1px #eaeaea;
} }
.like_label:before { .like_label:before { content: "😀"; }
content: "😀"; .edit_label:before { content: "🖊️"; }
} .trash_label:before { content: "🗑️"; }
.edit_label:before { .flag_label:before { content: "🚩"; }
content: "🖊️";
}
.trash_label:before {
content: "🗑️";
}
.flag_label:before {
content: "🚩";
}
.mod_button { .mod_button { margin-right: 4px; }
margin-right: 4px;
}
.post_item:not(.simple) { .post_item:not(.simple) { background-color: #eaeaea; }
background-color: #eaeaea;
}
.post_item { .post_item {
padding-top: 4px; padding-top: 4px;
padding-left: 7px !important; padding-left: 7px !important;
@ -618,9 +599,7 @@ blockquote p {
padding-right: 7px !important; padding-right: 7px !important;
padding-bottom: 2px; padding-bottom: 2px;
} }
.post_item:last-child { .post_item:last-child { padding-bottom: 7px; }
padding-bottom: 7px;
}
.the_name { .the_name {
margin-top: 3px; margin-top: 3px;
text-align: center; text-align: center;
@ -630,7 +609,6 @@ blockquote p {
.userinfo { .userinfo {
border-radius: 5px; border-radius: 5px;
background: white; background: white;
width: 132px; width: 132px;
padding: 2px; padding: 2px;
@ -661,9 +639,7 @@ blockquote p {
border-radius: 4px; border-radius: 4px;
} }
.action_item .userinfo { .action_item .userinfo { display: none; }
display: none;
}
.action_item .content_container { .action_item .content_container {
min-height: auto; min-height: auto;
padding: 15px; padding: 15px;
@ -717,73 +693,40 @@ blockquote p {
font-size: 14px; font-size: 14px;
} }
.panel_floater { .panel_floater { float: right; }
float: right; #panel_groups > .rowitem > .panel_floater { float: none; }
} #panel_groups > .rowitem > .panel_floater > .panel_right_button { float: right; }
#panel_groups > .rowitem > .panel_floater { #panel_forums > .rowitem > .panel_floater { float: none; }
float: none; #panel_forums > .rowitem > .panel_floater > .panel_buttons { float: right; }
}
#panel_groups > .rowitem > .panel_floater > .panel_right_button {
float: right;
}
#panel_forums > .rowitem > .panel_floater {
float: none;
}
#panel_forums > .rowitem > .panel_floater > .panel_buttons {
float: right;
}
.panel_rank_tag, .forum_preset, .forum_active { .panel_rank_tag, .forum_preset, .forum_active {
float: none; float: none;
color: #202020 !important; color: #202020 !important;
font-size: 11px; font-size: 11px;
} }
.panel_rank_tag_admin:before { .panel_rank_tag_admin:before { content: "Admins"; }
content: "Admins"; .panel_rank_tag_mod:before { content: "Mods"; }
} .panel_rank_tag_banned:before { content: "Banned"; }
.panel_rank_tag_mod:before { .panel_rank_tag_guest:before { content: "Guests"; }
content: "Mods"; .panel_rank_tag_member:before { content: "Members"; }
}
.panel_rank_tag_banned:before {
content: "Banned";
}
.panel_rank_tag_guest:before {
content: "Guests";
}
.panel_rank_tag_member:before {
content: "Members";
}
.forum_preset_announce:after { .forum_preset_announce:after { content: "Announcements"; }
content: "Announcements"; .forum_preset_members:after { content: "Member Only"; }
} .forum_preset_staff:after { content: "Staff Only"; }
.forum_preset_members:after { .forum_preset_admins:after { content: "Admin Only"; }
content: "Member Only"; .forum_preset_archive:after { content: "Archive"; }
} .forum_preset_all:after { content: "Public"; }
.forum_preset_staff:after { .forum_preset_custom, .forum_preset_ { display: none !important; }
content: "Staff Only"; .forum_active_Hide:before { content: "Hidden"; }
} .forum_active_Hide + .forum_preset:before { content: " | "; }
.forum_preset_admins:after { .forum_active_Show { display: none !important; }
content: "Admin Only";
} .perm_preset_no_access:before { content: "No Access"; color: maroon; }
.forum_preset_archive:after { .perm_preset_read_only:before { content: "Read Only"; color: green; }
content: "Archive"; .perm_preset_can_post:before { content: "Can Post"; color: green; }
} .perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
.forum_preset_all:after { .perm_preset_custom:before { content: "Custom"; color: black; }
content: "Public"; .perm_preset_default:before { content: "Default"; }
}
.forum_preset_custom, .forum_preset_ {
display: none !important;
}
.forum_active_Hide:before {
content: "Hidden";
}
.forum_active_Hide + .forum_preset:before {
content: " | ";
}
.forum_active_Show {
display: none !important;
}
/* Responsive Layout */ /* Responsive Layout */
/* Anything that isn't a small mobile */ /* Anything that isn't a small mobile */

View File

@ -12,9 +12,7 @@ body {
} }
/* Patch for Edge, until they fix emojis in arial x.x */ /* Patch for Edge, until they fix emojis in arial x.x */
@supports (-ms-ime-align:auto) { @supports (-ms-ime-align:auto) { .user_content { font-family: Segoe UI Emoji, arial; } }
.user_content { font-family: Segoe UI Emoji, arial; }
}
ul { ul {
padding-left: 0px; padding-left: 0px;
@ -49,11 +47,15 @@ li a {
padding-right: 10px; padding-right: 10px;
} }
.menu_bell {
cursor: default;
}
.menu_alerts { .menu_alerts {
/*padding-left: 7px;*/ /*padding-left: 7px;*/
font-size: 20px; font-size: 20px;
padding-top: 2px; padding-top: 2px;
color: rgb(80,80,80); color: rgb(80,80,80);
z-index: 500;
} }
.menu_alerts .alert_counter { .menu_alerts .alert_counter {
position: relative; position: relative;
@ -69,9 +71,7 @@ li a {
text-align: center; text-align: center;
border: white solid 1px; border: white solid 1px;
} }
.menu_alerts .alert_counter:empty { .menu_alerts .alert_counter:empty { display: none; }
display: none;
}
.selectedAlert { .selectedAlert {
background: white; background: white;
@ -126,9 +126,7 @@ li a {
white-space: nowrap; white-space: nowrap;
font-weight: normal; font-weight: normal;
} }
.alertItem:not(.withAvatar) { .alertItem:not(.withAvatar) { margin-left: 5px; }
margin-left: 5px;
}
.container { .container {
width: 90%; width: 90%;
@ -144,6 +142,9 @@ li a {
padding-top: 0px; padding-top: 0px;
} }
.rowblock:empty { display: none; } .rowblock:empty { display: none; }
.rowsmall {
font-size:12px;
}
.colblock_left { .colblock_left {
border: 1px solid #ccc; border: 1px solid #ccc;
@ -184,8 +185,7 @@ li a {
word-wrap: break-word; word-wrap: break-word;
} }
.colstack_head { margin-bottom: 0px; } .colstack_head { margin-bottom: 0px; }
.colstack_left:empty { display: none; } .colstack_left:empty, .colstack_right:empty { display: none; }
.colstack_right:empty { display: none; }
.colstack_grid { .colstack_grid {
display: grid; display: grid;
@ -241,6 +241,10 @@ li a {
} }
.rowitem a:hover { color: silver; } .rowitem a:hover { color: silver; }
.opthead { display: none; } .opthead { display: none; }
.datarow {
padding-top: 10px;
padding-bottom: 10px;
}
.formrow { .formrow {
width: 100%; width: 100%;
@ -310,9 +314,7 @@ button {
} }
.topic_status:empty { display: none; } .topic_status:empty { display: none; }
.rowhead { .rowhead { background: linear-gradient(to bottom, white, hsl(0, 0%, 93%)); }
background: linear-gradient(to bottom, white, hsl(0, 0%, 93%));
}
.topic_sticky_head { .topic_sticky_head {
background-color: #FFFFEA; background-color: #FFFFEA;
background: linear-gradient(to bottom, hsl(60, 70%, 96%), hsl(60, 70%, 89%)), url('/static/fabric-base-simple-alpha.png'); background: linear-gradient(to bottom, hsl(60, 70%, 96%), hsl(60, 70%, 89%)), url('/static/fabric-base-simple-alpha.png');
@ -395,9 +397,7 @@ button.username {
padding-bottom: 0; padding-bottom: 0;
width: 100%; width: 100%;
} }
.user_content.nobuttons { .user_content.nobuttons { min-height: 168px; }
min-height: 168px;
}
.button_container { .button_container {
border-top: solid 1px #eaeaea; border-top: solid 1px #eaeaea;
@ -426,29 +426,17 @@ button.username {
border-left: solid 1px #eaeaea; border-left: solid 1px #eaeaea;
} }
.like_label:before { .like_label:before { content: "😀"; }
content: "😀"; .edit_label:before { content: "🖊️"; }
} .trash_label:before { content: "🗑️"; }
.edit_label:before { .flag_label:before { content: "🚩"; }
content: "🖊️";
}
.trash_label:before {
content: "🗑️";
}
.flag_label:before {
content: "🚩";
}
.mod_button { .mod_button { margin-right: 4px; }
margin-right: 4px;
}
.simple > .real_username { color: #404040; font-size: 17px; } .simple > .real_username { color: #404040; font-size: 17px; }
.simple > .user_content { background: none; } .simple > .user_content { background: none; }
.simple { background-color: white; } .simple { background-color: white; }
.post_item:not(.simple) { .post_item:not(.simple) { background-color: #eaeaea; }
background-color: #eaeaea;
}
.post_item { .post_item {
padding-top: 4px; padding-top: 4px;
padding-left: 5px; padding-left: 5px;
@ -457,9 +445,7 @@ button.username {
padding-right: 4px; padding-right: 4px;
padding-bottom: 2px; padding-bottom: 2px;
} }
.post_item:last-child { .post_item:last-child { padding-bottom: 7px; }
padding-bottom: 7px;
}
.post_tag { .post_tag {
margin-top: 0px; margin-top: 0px;
text-align: center; text-align: center;
@ -504,9 +490,7 @@ button.username {
box-shadow:0 1px 2px rgba(0,0,0,.1); box-shadow:0 1px 2px rgba(0,0,0,.1);
} }
.action_item .userinfo { .action_item .userinfo { display: none; }
display: none;
}
.action_item .content_container { .action_item .content_container {
min-height: auto; min-height: auto;
padding: 15px; padding: 15px;
@ -544,9 +528,7 @@ button.username {
} }
/* Control Panel */ /* Control Panel */
.panel_upshift:visited { .panel_upshift:visited { color: black; }
color: black;
}
.tag-mini { .tag-mini {
margin-left: 0px; margin-left: 0px;
@ -568,82 +550,48 @@ button.username {
font-size: 14px; font-size: 14px;
} }
.panel_floater { .panel_floater { float: right; }
float: right; #panel_groups > .rowitem > .panel_floater { float: none; }
} #panel_groups > .rowitem > .panel_floater > .panel_right_button { float: right; }
#panel_groups > .rowitem > .panel_floater { #panel_forums > .rowitem > .panel_floater { float: none; }
float: none; #panel_forums > .rowitem > .panel_floater > .panel_buttons { float: right; }
} #panel_forums > .rowitem > span > .forum_name { margin-right: 4px; }
#panel_groups > .rowitem > .panel_floater > .panel_right_button { #panel_forum_quick_perms > .formrow > .formitem > a { margin-right: 4px; }
float: right; .forum_active > select { margin-bottom: 3px } /* Quick fix, need to properly patch this */
}
#panel_forums > .rowitem > .panel_floater {
float: none;
}
#panel_forums > .rowitem > .panel_floater > .panel_buttons {
float: right;
}
.panel_rank_tag, .forum_preset, .forum_active { .panel_rank_tag, .forum_preset, .forum_active {
float: none; float: none;
color: #202020 !important; color: #202020 !important;
font-size: 11px; font-size: 11px;
} }
.panel_rank_tag_admin:before { .panel_rank_tag_admin:before { content: "Admins"; }
content: "Admins"; .panel_rank_tag_mod:before { content: "Mods"; }
} .panel_rank_tag_banned:before { content: "Banned"; }
.panel_rank_tag_mod:before { .panel_rank_tag_guest:before { content: "Guests"; }
content: "Mods"; .panel_rank_tag_member:before { content: "Members"; }
}
.panel_rank_tag_banned:before {
content: "Banned";
}
.panel_rank_tag_guest:before {
content: "Guests";
}
.panel_rank_tag_member:before {
content: "Members";
}
.forum_preset_announce:after { .forum_preset_announce:after { content: "Announcements"; }
content: "Announcements"; .forum_preset_members:after { content: "Member Only"; }
} .forum_preset_staff:after { content: "Staff Only"; }
.forum_preset_members:after { .forum_preset_admins:after { content: "Admin Only"; }
content: "Member Only"; .forum_preset_archive:after { content: "Archive"; }
} .forum_preset_all:after { content: "Public"; }
.forum_preset_staff:after { .forum_preset_custom, .forum_preset_ { display: none !important; }
content: "Staff Only"; .forum_active_Hide:before { content: "Hidden"; }
} .forum_active_Hide + .forum_preset:before { content: " | "; }
.forum_preset_admins:after { .forum_active_Show { display: none !important; }
content: "Admin Only";
}
.forum_preset_archive:after {
content: "Archive";
}
.forum_preset_all:after {
content: "Public";
}
.forum_preset_custom, .forum_preset_ {
display: none !important;
}
.forum_active_Hide:before {
content: "Hidden";
}
.forum_active_Hide + .forum_preset:before {
content: " | ";
}
.forum_active_Show {
display: none !important;
}
.theme_row > .panel_floater > .panel_right_button { .perm_preset_no_access:before { content: "No Access"; color: maroon; }
margin-left: 5px; .perm_preset_read_only:before { content: "Read Only"; color: green; }
} .perm_preset_can_post:before { content: "Can Post"; color: green; }
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
.perm_preset_custom:before { content: "Custom"; color: black; }
.perm_preset_default:before { content: "Default"; }
.theme_row > .panel_floater > .panel_right_button { margin-left: 5px; }
@media(max-width: 1300px) { @media(max-width: 1300px) {
.theme_row { .theme_row { background-image: none !important; }
background-image: none !important;
}
} }
/* The Media Queries */ /* The Media Queries */
@ -717,18 +665,14 @@ button.username {
padding-left: 42px; padding-left: 42px;
height: 46px; height: 46px;
} }
.alertItem { .alertItem { padding: 8px; }
padding: 8px;
}
.alertItem .text { .alertItem .text {
height: 30px; height: 30px;
font-size: 10px; font-size: 10px;
font-weight: bold; font-weight: bold;
white-space: normal; white-space: normal;
} }
.alertItem .text.smaller { .alertItem .text.smaller { font-size: 9px; }
font-size: 9px;
}
.post_container { overflow: visible !important; } .post_container { overflow: visible !important; }
.post_item { .post_item {
@ -772,6 +716,7 @@ button.username {
.user_content.nobuttons { min-height: 100.5px !important; } .user_content.nobuttons { min-height: 100.5px !important; }
.the_name { font-size: 15px; } .the_name { font-size: 15px; }
.post_tag { font-size: 12px; } .post_tag { font-size: 12px; }
.rowtopic { font-size: 14px; }
.container { width: 100% !important; } .container { width: 100% !important; }
} }

View File

@ -49,11 +49,15 @@ li a {
padding-right: 10px; padding-right: 10px;
} }
.menu_bell {
cursor: default;
}
.menu_alerts { .menu_alerts {
/*padding-left: 7px;*/ /*padding-left: 7px;*/
font-size: 20px; font-size: 20px;
padding-top: 2px; padding-top: 2px;
color: rgb(80,80,80); color: rgb(80,80,80);
z-index: 500;
} }
.menu_alerts .alert_counter { .menu_alerts .alert_counter {
position: relative; position: relative;
@ -138,6 +142,7 @@ li a {
padding-top: 0px; padding-top: 0px;
} }
.rowblock:empty { display: none; } .rowblock:empty { display: none; }
.rowsmall { font-size:12px; }
.colblock_left { .colblock_left {
border: 1px solid #ccc; border: 1px solid #ccc;
@ -235,6 +240,11 @@ li a {
.top_post { margin-bottom: 16px; } .top_post { margin-bottom: 16px; }
.opthead { display: none; } .opthead { display: none; }
.datarow {
padding-top: 10px;
padding-bottom: 10px;
}
.formrow { .formrow {
width: 100%; width: 100%;
background-color: white; background-color: white;
@ -501,21 +511,11 @@ button.username {
opacity: 0.7; opacity: 0.7;
} }
.panel_floater { .panel_floater { float: right; }
float: right; #panel_groups > .rowitem > .panel_floater { float: none; }
} #panel_groups > .rowitem > .panel_floater > .panel_right_button { float: right; }
#panel_groups > .rowitem > .panel_floater { #panel_forums > .rowitem > .panel_floater { float: none; }
float: none; #panel_forums > .rowitem > .panel_floater > .panel_buttons { float: right; }
}
#panel_groups > .rowitem > .panel_floater > .panel_right_button {
float: right;
}
#panel_forums > .rowitem > .panel_floater {
float: none;
}
#panel_forums > .rowitem > .panel_floater > .panel_buttons {
float: right;
}
#panel_forums > .rowitem > .panel_floater > .panel_buttons > .panel_right_button { #panel_forums > .rowitem > .panel_floater > .panel_buttons > .panel_right_button {
color: #505050; color: #505050;
font-size: 14px; font-size: 14px;
@ -526,52 +526,30 @@ button.username {
opacity: 0.7; opacity: 0.7;
font-size: 10px; font-size: 10px;
} }
.panel_rank_tag_admin:before { .panel_rank_tag_admin:before { content: "Admin Group"; }
content: "Admin Group"; .panel_rank_tag_mod:before { content: "Mod Group"; }
} .panel_rank_tag_banned:before { content: "Banned Group"; }
.panel_rank_tag_mod:before { .panel_rank_tag_guest:before { content: "Guest Group"; }
content: "Mod Group"; .panel_rank_tag_member:before { content: "Member Group"; }
}
.panel_rank_tag_banned:before { .forum_preset_announce:after { content: "Announcements"; }
content: "Banned Group"; .forum_preset_members:after { content: "Member Only"; }
} .forum_preset_staff:after { content: "Staff Only"; }
.panel_rank_tag_guest:before { .forum_preset_admins:after { content: "Admin Only"; }
content: "Guest Group"; .forum_preset_archive:after { content: "Archive"; }
} .forum_preset_all:after { content: "Public"; }
.panel_rank_tag_member:before { .forum_preset_custom, .forum_preset_ { display: none !important; }
content: "Member Group"; .forum_active_Hide:before { content: "Hidden"; }
} .forum_active_Hide + .forum_preset:before { content: " | "; }
.forum_active_Show { display: none !important; }
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
.perm_preset_read_only:before { content: "Read Only"; color: green; }
.perm_preset_can_post:before { content: "Can Post"; color: green; }
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
.perm_preset_custom:before { content: "Custom"; color: black; }
.perm_preset_default:before { content: "Default"; }
.forum_preset_announce:after {
content: "Announcements";
}
.forum_preset_members:after {
content: "Member Only";
}
.forum_preset_staff:after {
content: "Staff Only";
}
.forum_preset_admins:after {
content: "Admin Only";
}
.forum_preset_archive:after {
content: "Archive";
}
.forum_preset_all:after {
content: "Public";
}
.forum_preset_custom, .forum_preset_ {
display: none !important;
}
.forum_active_Hide:before {
content: "Hidden";
}
.forum_active_Hide + .forum_preset:before {
content: " | ";
}
.forum_active_Show {
display: none !important;
}
@media(max-width: 1300px) { @media(max-width: 1300px) {
.theme_row { .theme_row {
background-image: none !important; background-image: none !important;

View File

@ -10,9 +10,7 @@ body {
} }
/* Patch for Edge, until they fix emojis in arial x.x */ /* Patch for Edge, until they fix emojis in arial x.x */
@supports (-ms-ime-align:auto) { @supports (-ms-ime-align:auto) { .user_content { font-family: Segoe UI Emoji, arial; } }
.user_content { font-family: Segoe UI Emoji, arial; }
}
ul { ul {
padding-left: 0px; padding-left: 0px;
@ -47,6 +45,7 @@ li a {
padding-right: 10px; padding-right: 10px;
} }
.menu_bell { cursor: default; }
.menu_alerts { .menu_alerts {
/*padding-left: 7px;*/ /*padding-left: 7px;*/
font-size: 20px; font-size: 20px;
@ -67,9 +66,7 @@ li a {
text-align: center; text-align: center;
border: white solid 1px; border: white solid 1px;
} }
.menu_alerts .alert_counter:empty { .menu_alerts .alert_counter:empty { display: none; }
display: none;
}
.selectedAlert { .selectedAlert {
background: white; background: white;
@ -79,9 +76,12 @@ li a {
background: white; background: white;
color: black; color: black;
} }
.selectedAlert .alert_counter { display: none; }
.menu_alerts .alertList { .menu_alerts .alertList {
display: none; display: none;
z-index: 500;
} }
.selectedAlert .alertList { .selectedAlert .alertList {
position: absolute; position: absolute;
top: 51px; top: 51px;
@ -142,6 +142,9 @@ li a {
padding-top: 0px; padding-top: 0px;
} }
.rowblock:empty { display: none; } .rowblock:empty { display: none; }
.rowsmall {
font-size:12px;
}
.colblock_left { .colblock_left {
border: 1px solid #ccc; border: 1px solid #ccc;
@ -182,8 +185,7 @@ li a {
word-wrap: break-word; word-wrap: break-word;
} }
.colstack_head { margin-bottom: 0px; } .colstack_head { margin-bottom: 0px; }
.colstack_left:empty { display: none; } .colstack_left:empty, .colstack_right:empty { display: none; }
.colstack_right:empty { display: none; }
.colstack_grid { .colstack_grid {
display: grid; display: grid;
@ -229,15 +231,10 @@ li a {
padding-top: 14px; padding-top: 14px;
padding-bottom: 12px; padding-bottom: 12px;
padding-right: 10px; padding-right: 10px;
/*font-weight: bold;*/
background-color: white; background-color: white;
} }
/*.rowitem:not(.passive) { /*.rowitem:not(.passive) { font-size: 17px; }*/
font-size: 17px; .rowitem:not(:last-child) { border-bottom: 1px dotted #ccc; }
}*/
.rowitem:not(:last-child) {
border-bottom: 1px dotted #ccc;
}
.rowitem a { .rowitem a {
text-decoration: none; text-decoration: none;
color: black; color: black;
@ -246,6 +243,11 @@ li a {
.top_post { margin-bottom: 12px; } .top_post { margin-bottom: 12px; }
.opthead { display: none; } .opthead { display: none; }
.datarow {
padding-top: 10px;
padding-bottom: 10px;
}
.formrow { .formrow {
width: 100%; width: 100%;
background-color: white; background-color: white;
@ -332,11 +334,7 @@ button.username { position: relative; top: -0.25px; }
.username.level { color: #303030; } .username.level { color: #303030; }
.username.real_username { color: #404040; font-size: 17px; } .username.real_username { color: #404040; font-size: 17px; }
.username.real_username:hover { color: black; } .username.real_username:hover { color: black; }
.post_item > .username { margin-top: 20px; display: inline-block; }
.post_item > .username {
margin-top: 20px;
display: inline-block;
}
.tag-mini { .tag-mini {
text-transform: none; text-transform: none;
@ -358,17 +356,13 @@ button.username { position: relative; top: -0.25px; }
color: #202020; color: #202020;
opacity: 0.7; opacity: 0.7;
} }
.post_item > .mod_button > button:hover { .post_item > .mod_button > button:hover { opacity: 0.9; }
opacity: 0.9;
}
.mod_button { .mod_button {
margin-right: 4px; margin-right: 4px;
/*z-index: 10;*/
} }
.like_label:before, .like_count_label:before { content: "😀"; }
.like_label:before, .like_count_label:before {
content: "😀";
}
.like_count_label { .like_count_label {
color: #505050; color: #505050;
float: right; float: right;
@ -383,27 +377,14 @@ button.username { position: relative; top: -0.25px; }
padding-right: 5px; padding-right: 5px;
font-size: 17px; font-size: 17px;
} }
.edit_label:before {
content: "🖊️"; .edit_label:before { content: "🖊️"; }
} .trash_label:before { content: "🗑️"; }
.trash_label:before { .pin_label:before { content: "📌"; }
content: "🗑️"; .unpin_label:before { content: "📌"; }
} .unpin_label { background-color: #D6FFD6; }
.pin_label:before { .flag_label:before { content: "🚩"; }
content: "📌"; .level_label:before { content: "👑"; }
}
.unpin_label:before {
content: "📌";
}
.unpin_label {
background-color: #D6FFD6;
}
.flag_label:before {
content: "🚩";
}
.level_label:before {
content: "👑";
}
.controls { .controls {
margin-top: 23px; margin-top: 23px;
@ -496,9 +477,7 @@ button.username { position: relative; top: -0.25px; }
position: relative; position: relative;
top: -2px; top: -2px;
} }
.panel_upshift:visited { .panel_upshift:visited { color: black; }
color: black;
}
/*.panel_tag_upshift { /*.panel_tag_upshift {
margin-left: 2px; margin-left: 2px;
position: relative; position: relative;
@ -506,49 +485,28 @@ button.username { position: relative; top: -0.25px; }
color: #505050; color: #505050;
}*/ }*/
.panel_floater { .panel_floater { float: right; }
float: right; .panel_rank_tag_admin:before { content: "👑"; }
} .panel_rank_tag_mod:before { content: "👮"; }
.panel_rank_tag_admin:before { .panel_rank_tag_banned:before { content: "⛓️"; }
content: "👑"; .panel_rank_tag_guest:before { content: "👽"; }
} .panel_rank_tag_member:before { content: "👪"; }
.panel_rank_tag_mod:before {
content: "👮";
}
.panel_rank_tag_banned:before {
content: "⛓️";
}
.panel_rank_tag_guest:before {
content: "👽";
}
.panel_rank_tag_member:before {
content: "👪";
}
.forum_preset_announce:before { .forum_preset_announce:before { content: "📣"; }
content: "📣"; .forum_preset_members:before { content: "👪"; }
} .forum_preset_staff:before { content: "👮"; }
.forum_preset_members:before { .forum_preset_admins:before { content: "👑"; }
content: "👪"; .forum_preset_archive:before { content: "☠️"; }
} .forum_preset_all, .forum_preset_custom, .forum_preset_ { display: none !important; }
.forum_preset_staff:before { .forum_active_Hide:before { content: "🕵️"; }
content: "👮"; .forum_active_Show { display: none !important; }
}
.forum_preset_admins:before { .perm_preset_no_access:before { content: "No Access"; color: maroon; }
content: "👑"; .perm_preset_read_only:before { content: "Read Only"; color: green; }
} .perm_preset_can_post:before { content: "Can Post"; color: green; }
.forum_preset_archive:before { .perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
content: "☠️"; .perm_preset_custom:before { content: "Custom"; color: black; }
} .perm_preset_default:before { content: "Default"; }
.forum_preset_all, .forum_preset_custom, .forum_preset_ {
display: none !important;
}
.forum_active_Hide:before {
content: "🕵️";
}
.forum_active_Show {
display: none !important;
}
@media (max-width: 880px) { @media (max-width: 880px) {
li { li {
@ -562,8 +520,7 @@ button.username { position: relative; top: -0.25px; }
height: 30px; height: 30px;
margin-top: 8px; margin-top: 8px;
} }
.menu_left { padding-right: 9px; } .menu_left, .menu_right { padding-right: 9px; }
.menu_right { padding-right: 9px; }
.menu_alerts { .menu_alerts {
padding-left: 7px; padding-left: 7px;
padding-right: 7px; padding-right: 7px;
@ -591,9 +548,8 @@ button.username { position: relative; top: -0.25px; }
} }
li a { font-size: 14px; } li a { font-size: 14px; }
ul { height: 26px; } ul { height: 26px; }
.menu_left { padding-right: 7px; } .menu_left, .menu_right { padding-right: 7px; }
.menu_right { padding-right: 7px; } .menu_create_topic { display: none; }
.menu_create_topic { display: none;}
.menu_alerts { .menu_alerts {
padding-left: 4px; padding-left: 4px;
@ -615,25 +571,34 @@ button.username { position: relative; top: -0.25px; }
width: 135px; width: 135px;
margin-bottom: 5px; margin-bottom: 5px;
} }
.selectedAlert.hasAvatars .alertList { width: calc(100% - 8px); }
.alertItem.withAvatar { .alertItem.withAvatar {
background-size: 36px; background-size: 36px;
text-align: right; text-align: right;
padding-left: 10px; padding-left: 10px;
height: 46px; height: 46px;
} }
.alertItem { .hasAvatars > .alertList > .alertItem.withAvatar {
padding: 8px; background-size: 46px;
text-align: inherit;
padding-left: 56px;
height: 42px;
} }
.alertItem.withAvatar .text { .alertItem { padding: 8px; }
.hasAvatars > .alertList > .alertItem { padding-top: 11px; }
.selectedAlert:not(.hasAvatars) > .alertList > .alertItem.withAvatar .text {
width: calc(100% - 20px); width: calc(100% - 20px);
height: 30px; height: 30px;
white-space: normal; white-space: normal;
} }
.alertItem .text { .selectedAlert:not(.hasAvatars) > .alertList > .alertItem .text {
font-size: 10px; font-size: 10px;
font-weight: bold; font-weight: bold;
margin-left: 0px; margin-left: 0px;
} }
.alertActive {
opacity: 0.7;
}
.hide_on_micro { display: none !important; } .hide_on_micro { display: none !important; }
.post_container { overflow: visible !important; } .post_container { overflow: visible !important; }
@ -672,6 +637,9 @@ button.username { position: relative; top: -0.25px; }
margin-left: 74px; margin-left: 74px;
width: calc(100% - 74px); width: calc(100% - 74px);
} }
.rowtopic {
font-size: 14px;
}
.container { width: 100% !important; } .container { width: 100% !important; }
} }
@ -685,13 +653,7 @@ button.username { position: relative; top: -0.25px; }
text-overflow: clip; text-overflow: clip;
max-width: 84px; max-width: 84px;
} }
.post_item > .controls { .post_item > .controls { margin-left: 72px; }
margin-left: 72px; .top_post > .post_item > .controls > .real_username { max-width: 57px; }
} .top_post > .post_item { padding-right: 4px; }
.top_post > .post_item > .controls > .real_username {
max-width: 57px;
}
.top_post > .post_item {
padding-right: 4px;
}
} }

View File

@ -15,11 +15,13 @@ type Topic struct
Sticky bool Sticky bool
CreatedAt string CreatedAt string
LastReplyAt string LastReplyAt string
//LastReplyBy int
ParentID int ParentID int
Status string // Deprecated. Marked for removal. Status string // Deprecated. Marked for removal.
IpAddress string IpAddress string
PostCount int PostCount int
LikeCount int LikeCount int
ClassName string // CSS Class Name
} }
type TopicUser struct type TopicUser struct
@ -32,11 +34,13 @@ type TopicUser struct
Sticky bool Sticky bool
CreatedAt string CreatedAt string
LastReplyAt string LastReplyAt string
//LastReplyBy int
ParentID int ParentID int
Status string // Deprecated. Marked for removal. Status string // Deprecated. Marked for removal.
IpAddress string IpAddress string
PostCount int PostCount int
LikeCount int LikeCount int
ClassName string
CreatedByName string CreatedByName string
Group int Group int
@ -61,11 +65,13 @@ type TopicsRow struct
Sticky bool Sticky bool
CreatedAt string CreatedAt string
LastReplyAt string LastReplyAt string
//LastReplyBy int
ParentID int ParentID int
Status string // Deprecated. Marked for removal. Status string // Deprecated. Marked for removal.
IpAddress string IpAddress string
PostCount int PostCount int
LikeCount int LikeCount int
ClassName string
CreatedByName string CreatedByName string
Avatar string Avatar string

20
user.go
View File

@ -1,14 +1,16 @@
package main package main
//import "fmt" import (
import "sync" //"fmt"
import "strings" "sync"
import "strconv" "strings"
import "net" "strconv"
import "net/http" "net"
import "golang.org/x/crypto/bcrypt" "net/http"
import "database/sql" "golang.org/x/crypto/bcrypt"
import _ "github.com/go-sql-driver/mysql" "database/sql"
_ "github.com/go-sql-driver/mysql"
)
var guest_user User = User{ID:0,Group:6,Perms:GuestPerms} var guest_user User = User{ID:0,Group:6,Perms:GuestPerms}

View File

@ -48,7 +48,7 @@ func relative_time(in string) (string, error) {
return "", nil return "", nil
} }
layout := "2006-01-02 15:04:05" layout := "2006-01-02 15:04:05"
t, err := time.Parse(layout, in) t, err := time.ParseInLocation(layout, in, timeLocation)
if err != nil { if err != nil {
return "", err return "", err
} }