Added support for screen readers.

Refactored the setting system to make it thread-safe.
Planned out the task system.
Fixed the closed topic status header.
This commit is contained in:
Azareal 2017-08-20 10:39:02 +01:00
parent bfff7f3dee
commit 409719d10e
50 changed files with 360 additions and 219 deletions

23
main.go
View File

@ -32,7 +32,6 @@ var startTime time.Time
//var timeLocation *time.Location
var templates = template.New("")
//var no_css_tmpl template.CSS = template.CSS("")
var settings map[string]interface{} = make(map[string]interface{})
var external_sites map[string]string = map[string]string{
"YT":"https://www.youtube.com/",
}
@ -340,6 +339,28 @@ func main(){
log.Print("Initialising the authentication system")
auth = NewDefaultAuth()
// Run this goroutine once a second
second_ticker := time.NewTicker(1 * time.Second)
fifteen_minute_ticker := time.NewTicker(15 * time.Minute)
//hour_ticker := time.NewTicker(1 * time.Hour)
go func() {
for {
select {
case <- second_ticker.C:
// TO-DO: Handle delayed moderation tasks
// TO-DO: Handle the daily clean-up. Move this to a 24 hour task?
// TO-DO: Sync with the database, if there are any changes
// TO-DO: Manage the TopicStore, UserStore, and ForumStore
// TO-DO: Alert the admin, if CPU usage, RAM usage, or the number of posts in the past second are too high
// TO-DO: Clean-up alerts with no unread matches which are over two weeks old. Move this to a 24 hour task?
case <- fifteen_minute_ticker.C:
// TO-DO: Handle temporary bans.
// TO-DO: Automatically lock topics, if they're really old, and the associated setting is enabled.
// TO-DO: Publish scheduled posts. Move this to a 15 minute task?
}
}
}()
log.Print("Initialising the router")
router = NewGenRouter(http.FileServer(http.Dir("./uploads")))
///router.HandleFunc("/static/", route_static)

View File

@ -15,9 +15,17 @@ type HeaderVars struct
Stylesheets []string
Widgets PageWidgets
Site *Site
Settings map[string]interface{}
ExtData ExtData
}
// TO-DO: Add this to routes which don't use templates. E.g. Json APIs.
type HeaderLite struct
{
Site *Site
Settings SettingBox
}
type PageWidgets struct
{
LeftSidebar template.HTML

View File

@ -219,7 +219,7 @@ func route_panel_forums(w http.ResponseWriter, r *http.Request, user User){
}
func route_panel_forums_create_submit(w http.ResponseWriter, r *http.Request, user User){
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -298,7 +298,7 @@ func route_panel_forums_delete(w http.ResponseWriter, r *http.Request, user User
}
func route_panel_forums_delete_submit(w http.ResponseWriter, r *http.Request, user User, sfid string) {
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -380,7 +380,7 @@ func route_panel_forums_edit(w http.ResponseWriter, r *http.Request, user User,
}
func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, user User, sfid string) {
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -466,7 +466,7 @@ func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, user
}
func route_panel_forums_edit_perms_submit(w http.ResponseWriter, r *http.Request, user User, sfid string){
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -557,6 +557,7 @@ func route_panel_settings(w http.ResponseWriter, r *http.Request, user User){
return
}
//log.Print("headerVars.Settings",headerVars.Settings)
var settingList map[string]interface{} = make(map[string]interface{})
rows, err := get_settings_stmt.Query()
if err != nil {
@ -666,7 +667,7 @@ func route_panel_setting(w http.ResponseWriter, r *http.Request, user User, snam
}
func route_panel_setting_edit(w http.ResponseWriter, r *http.Request, user User, sname string) {
ok := SimplePanelSessionCheck(w,r,&user)
headerLite, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -711,11 +712,13 @@ func route_panel_setting_edit(w http.ResponseWriter, r *http.Request, user User,
return
}
errmsg := parseSetting(sname, scontent, stype, sconstraints)
errmsg := headerLite.Settings.ParseSetting(sname, scontent, stype, sconstraints)
if errmsg != "" {
LocalError(errmsg,w,r,user)
return
}
settingBox.Store(headerLite.Settings)
http.Redirect(w,r,"/panel/settings/",http.StatusSeeOther)
}
@ -749,7 +752,7 @@ func route_panel_plugins(w http.ResponseWriter, r *http.Request, user User){
}
func route_panel_plugins_activate(w http.ResponseWriter, r *http.Request, user User, uname string){
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -825,7 +828,7 @@ func route_panel_plugins_activate(w http.ResponseWriter, r *http.Request, user U
}
func route_panel_plugins_deactivate(w http.ResponseWriter, r *http.Request, user User, uname string){
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -873,7 +876,7 @@ func route_panel_plugins_deactivate(w http.ResponseWriter, r *http.Request, user
}
func route_panel_plugins_install(w http.ResponseWriter, r *http.Request, user User, uname string){
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -1075,7 +1078,7 @@ func route_panel_users_edit(w http.ResponseWriter, r *http.Request, user User, s
}
func route_panel_users_edit_submit(w http.ResponseWriter, r *http.Request, user User, suid string){
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -1369,7 +1372,7 @@ func route_panel_groups_edit_perms(w http.ResponseWriter, r *http.Request, user
}
func route_panel_groups_edit_submit(w http.ResponseWriter, r *http.Request, user User, sgid string){
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -1501,7 +1504,7 @@ func route_panel_groups_edit_submit(w http.ResponseWriter, r *http.Request, user
}
func route_panel_groups_edit_perms_submit(w http.ResponseWriter, r *http.Request, user User, sgid string){
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -1577,7 +1580,7 @@ func route_panel_groups_edit_perms_submit(w http.ResponseWriter, r *http.Request
}
func route_panel_groups_create_submit(w http.ResponseWriter, r *http.Request, user User){
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}
@ -1662,7 +1665,7 @@ func route_panel_themes(w http.ResponseWriter, r *http.Request, user User){
}
func route_panel_themes_default(w http.ResponseWriter, r *http.Request, user User, uname string){
ok := SimplePanelSessionCheck(w,r,&user)
_, ok := SimplePanelSessionCheck(w,r,&user)
if !ok {
return
}

View File

@ -197,7 +197,7 @@ $(document).ready(function(){
$(".topic_item .submit_edit").click(function(event){
event.preventDefault();
console.log("clicked on .topic_item .submit_edit");
//console.log("clicked on .topic_item .submit_edit");
$(".topic_name").html($(".topic_name_input").val());
$(".topic_content").html($(".topic_content_input").val());
$(".topic_status_e:not(.open_edit)").html($(".topic_status_input").val());

View File

@ -480,7 +480,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request, user User){
topic.ClassName = config.StaffCss
}
/*if settings["url_tags"] == false {
/*if headerVars.Settings["url_tags"] == false {
topic.URLName = ""
} else {
topic.URL, ok = external_sites[topic.URLPrefix]
@ -547,7 +547,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request, user User){
replyItem.Tag = groups[replyItem.Group].Tag
/*if settings["url_tags"] == false {
/*if headerVars.Settings["url_tags"] == false {
replyItem.URLName = ""
} else {
replyItem.URL, ok = external_sites[replyItem.URLPrefix]
@ -1683,7 +1683,7 @@ func route_account_own_edit_email_token_submit(w http.ResponseWriter, r *http.Re
}
// If Email Activation is on, then activate the account while we're here
if settings["activation_type"] == 2 {
if headerVars.Settings["activation_type"] == 2 {
_, err = activate_user_stmt.Exec(user.ID)
if err != nil {
InternalError(err,w)
@ -1801,6 +1801,8 @@ func route_register(w http.ResponseWriter, r *http.Request, user User) {
}
func route_register_submit(w http.ResponseWriter, r *http.Request, user User) {
headerLite, _ := SimpleSessionCheck(w,r,&user)
err := r.ParseForm()
if err != nil {
LocalError("Bad Form",w,r,user)
@ -1850,7 +1852,7 @@ func route_register_submit(w http.ResponseWriter, r *http.Request, user User) {
}
var active, group int
switch settings["activation_type"] {
switch headerLite.Settings["activation_type"] {
case 1: // Activate All
active = 1
group = config.DefaultGroup

View File

@ -1,9 +1,12 @@
package main
import "strconv"
import "strings"
import "sync/atomic"
// TO-DO: Move this into the phrase system
var settingLabels map[string]string
type SettingBox map[string]interface{}
var settingBox atomic.Value // An atomic value pointing to a SettingBox
type OptionLabel struct
{
@ -23,6 +26,8 @@ type Setting struct
func init() {
settingLabels = make(map[string]string)
settingLabels["activation_type"] = "Activate All,Email Activation,Admin Approval"
settingBox.Store(SettingBox(make(map[string]interface{})))
//settingBox.Store(make(map[string]interface{}))
}
func LoadSettings() error {
@ -32,13 +37,15 @@ func LoadSettings() error {
}
defer rows.Close()
sBox := settingBox.Load().(SettingBox)
//sBox := settingBox.Load().(map[string]interface{})
var sname, scontent, stype, sconstraints string
for rows.Next() {
err = rows.Scan(&sname, &scontent, &stype, &sconstraints)
if err != nil {
return err
}
errmsg := parseSetting(sname, scontent, stype, sconstraints)
errmsg := sBox.ParseSetting(sname, scontent, stype, sconstraints)
if errmsg != "" {
return err
}
@ -47,21 +54,24 @@ func LoadSettings() error {
if err != nil {
return err
}
settingBox.Store(sBox)
return nil
}
// TO-DO: Add better support for HTML attributes (html-attribute). E.g. Meta descriptions.
func parseSetting(sname string, scontent string, stype string, constraint string) string {
func (sBox SettingBox) ParseSetting(sname string, scontent string, stype string, constraint string) string {
var err error
var ssBox map[string]interface{} = map[string]interface{}(sBox)
if stype == "bool" {
settings[sname] = (scontent == "1")
ssBox[sname] = (scontent == "1")
} else if stype == "int" {
settings[sname], err = strconv.Atoi(scontent)
ssBox[sname], err = strconv.Atoi(scontent)
if err != nil {
return "You were supposed to enter an integer x.x\nType mismatch in " + sname
}
} else if stype == "int64" {
settings[sname], err = strconv.ParseInt(scontent, 10, 64)
ssBox[sname], err = strconv.ParseInt(scontent, 10, 64)
if err != nil {
return "You were supposed to enter an integer x.x\nType mismatch in " + sname
}
@ -88,9 +98,9 @@ func parseSetting(sname string, scontent string, stype string, constraint string
if value < con1 || value > con2 {
return "Only integers between a certain range are allowed in this setting"
}
settings[sname] = value
ssBox[sname] = value
} else {
settings[sname] = scontent
ssBox[sname] = scontent
}
return ""
}

View File

@ -30,7 +30,7 @@ var header_9 []byte = []byte(`.supermod_only { display: none !important; }`)
var header_10 []byte = []byte(`</style>
<div class="container">
`)
var menu_0 []byte = []byte(`<div class="nav">
var menu_0 []byte = []byte(`<nav class="nav">
<div class="move_left">
<div class="move_right">
<ul>
@ -63,7 +63,7 @@ var menu_6 []byte = []byte(`
</div>
</div>
<div style="clear: both;"></div>
</div>
</nav>
`)
var header_11 []byte = []byte(`
<div id="back"><div id="main" `)
@ -90,6 +90,8 @@ var topic_9 []byte = []byte(`">&gt;</a>
</div>`)
var topic_10 []byte = []byte(`
<main>
<div class="rowblock rowhead topic_block">
<div class="rowitem topic_item`)
var topic_11 []byte = []byte(` topic_sticky_head`)
@ -114,7 +116,7 @@ var topic_20 []byte = []byte(`
</div>
</div>
<div class="rowblock post_container top_post">
<article class="rowblock post_container top_post">
<div class="rowitem passive editable_parent post_item `)
var topic_21 []byte = []byte(`" style="`)
var topic_22 []byte = []byte(`background-image:url(`)
@ -162,18 +164,18 @@ var topic_52 []byte = []byte(`
</span>
</div>
</div>
</article>
<div class="rowblock post_container" style="overflow: hidden;">`)
var topic_53 []byte = []byte(`
<div class="rowitem passive deletable_block editable_parent post_item action_item">
<article class="rowitem passive deletable_block editable_parent post_item action_item">
<span class="action_icon" style="font-size: 18px;padding-right: 5px;">`)
var topic_54 []byte = []byte(`</span>
<span>`)
var topic_55 []byte = []byte(`</span>
</div>
</article>
`)
var topic_56 []byte = []byte(`
<div class="rowitem passive deletable_block editable_parent post_item `)
<article class="rowitem passive deletable_block editable_parent post_item `)
var topic_57 []byte = []byte(`" style="`)
var topic_58 []byte = []byte(`background-image:url(`)
var topic_59 []byte = []byte(`), url(/static/post-avatar-bg.jpg);background-position: 0px `)
@ -212,7 +214,7 @@ var topic_82 []byte = []byte(`</a><a class="username hide_on_micro level_label"
var topic_83 []byte = []byte(`
</span>
</div>
</article>
`)
var topic_84 []byte = []byte(`</div>
@ -230,6 +232,11 @@ var topic_86 []byte = []byte(`' type="hidden" />
</div>
</form>
</div>
`)
var topic_87 []byte = []byte(`
</main>
`)
var footer_0 []byte = []byte(` </div>
`)
@ -253,6 +260,8 @@ var topic_alt_6 []byte = []byte(`?page=`)
var topic_alt_7 []byte = []byte(`">&gt;</a></div>`)
var topic_alt_8 []byte = []byte(`
<main>
<div class="rowblock rowhead topic_block">
<form action='/topic/edit/submit/`)
var topic_alt_9 []byte = []byte(`' method="post">
@ -280,9 +289,10 @@ var topic_alt_19 []byte = []byte(`
</form>
</div>
<!-- Stop inling this x.x -->
<style type="text/css">.rowitem:last-child .content_container { margin-bottom: 5px !important; }</style>
<div class="rowblock post_container" style="border-top: none;">
<div class="rowitem passive deletable_block editable_parent post_item top_post" style="background-color: #eaeaea;padding-top: 4px;padding-left: 5px;clear: both;border-bottom: none;padding-right: 4px;padding-bottom: 2px;">
<article class="rowitem passive deletable_block editable_parent post_item top_post" style="background-color: #eaeaea;padding-top: 4px;padding-left: 5px;clear: both;border-bottom: none;padding-right: 4px;padding-bottom: 2px;">
<div class="userinfo">
<div class="avatar_item" style="background-image: url(`)
var topic_alt_20 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div>
@ -329,10 +339,10 @@ var topic_alt_48 []byte = []byte(` up</a>`)
var topic_alt_49 []byte = []byte(`
</div>
</div><div style="clear:both;"></div>
</div>
</article>
`)
var topic_alt_50 []byte = []byte(`
<div class="rowitem passive deletable_block editable_parent post_item `)
<article class="rowitem passive deletable_block editable_parent post_item `)
var topic_alt_51 []byte = []byte(`action_item`)
var topic_alt_52 []byte = []byte(`">
<div class="userinfo">
@ -388,7 +398,7 @@ var topic_alt_83 []byte = []byte(`
var topic_alt_84 []byte = []byte(`
</div>
<div style="clear:both;"></div>
</div>
</article>
`)
var topic_alt_85 []byte = []byte(`</div>
`)
@ -405,6 +415,11 @@ var topic_alt_87 []byte = []byte(`' type="hidden" />
</div>
</form>
</div>
`)
var topic_alt_88 []byte = []byte(`
</main>
`)
var profile_0 []byte = []byte(`
@ -510,6 +525,8 @@ var profile_39 []byte = []byte(`
`)
var forums_0 []byte = []byte(`
<main>
<div class="rowblock opthead">
<div class="rowitem"><a>Forums</a></div>
</div>
@ -549,8 +566,12 @@ var forums_16 []byte = []byte(`
var forums_17 []byte = []byte(`<div class="rowitem passive">You don't have access to any forums.</div>`)
var forums_18 []byte = []byte(`
</div>
</main>
`)
var topics_0 []byte = []byte(`
<main>
<div class="rowblock rowhead">
<div class="rowitem"><a>Topic List</a></div>
</div>
@ -604,6 +625,8 @@ var topics_28 []byte = []byte(` <a href="/topics/create/">Start one?</a>`)
var topics_29 []byte = []byte(`</div>`)
var topics_30 []byte = []byte(`
</div>
</main>
`)
var forum_0 []byte = []byte(`<div id="prevFloat" class="prev_button"><a class="prev_link" href="/forum/`)
var forum_1 []byte = []byte(`?page=`)
@ -616,6 +639,8 @@ var forum_6 []byte = []byte(`?page=`)
var forum_7 []byte = []byte(`">&gt;</a></div>`)
var forum_8 []byte = []byte(`
<main>
<div id="forum_head_block" class="rowblock rowhead">
<div class="rowitem forum_title`)
var forum_9 []byte = []byte(` has_opt`)
@ -680,4 +705,6 @@ var forum_41 []byte = []byte(`">Start one?</a>`)
var forum_42 []byte = []byte(`</div>`)
var forum_43 []byte = []byte(`
</div>
</main>
`)

View File

@ -3,8 +3,8 @@
// Code generated by Gosora. More below:
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
package main
import "strconv"
import "net/http"
import "strconv"
func init() {
template_topic_handle = template_topic
@ -256,6 +256,7 @@ w.Write(topic_85)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_86)
}
w.Write(topic_87)
w.Write(footer_0)
if tmpl_topic_vars.Header.Widgets.RightSidebar != "" {
w.Write(footer_1)

View File

@ -259,6 +259,7 @@ w.Write(topic_alt_86)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_87)
}
w.Write(topic_alt_88)
w.Write(footer_0)
if tmpl_topic_alt_vars.Header.Widgets.RightSidebar != "" {
w.Write(footer_1)

View File

@ -1,15 +1,15 @@
<div class="colstack_left">
<nav class="colstack_left">
<div class="colstack_item colstack_head rowhead">
<div class="rowitem"><a>My Account</a></div>
</div>
<div class="colstack_item rowmenu">
<div class="rowitem passive"><a href="/user/edit/avatar/">Change Avatar</a></div>
<div class="rowitem passive"><a href="/user/edit/username/">Change Username</a></div>
<div class="rowitem passive"><a href="/user/edit/critical/">Change Password</a></div>
<div class="rowitem passive"><a href="/user/edit/email/">Change Email</a></div>
<div class="rowitem passive"><a href="/user/notifications">Notifications</a></div>
<div class="rowitem passive"><a href="/user/edit/avatar/">Avatar</a></div>
<div class="rowitem passive"><a href="/user/edit/username/">Username</a></div>
<div class="rowitem passive"><a href="/user/edit/critical/">Password</a></div>
<div class="rowitem passive"><a href="/user/edit/email/">Email</a></div>
<div class="rowitem passive"><a href="/user/edit/notifications">Notifications</a></div>
{{/** TO-DO: Add an alerts page with pagination to go through alerts which either don't fit in the alerts drop-down or which have already been dismissed. Bear in mind though that dismissed alerts older than two weeks might be purged to save space and to speed up the database **/}}
<div class="rowitem passive"><a>Coming Soon</a></div>
<div class="rowitem passive"><a>Coming Soon</a></div>
</div>
</div>
</nav>

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
{{template "account-menu.html" . }}
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head rowhead">
<div class="rowitem"><a>Edit Avatar</a></div>
</div>
@ -20,5 +20,5 @@
</div>
</form>
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
{{template "account-menu.html" . }}
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head rowhead">
<div class="rowitem"><a>Emails</a></div>
</div>
@ -16,5 +16,5 @@
</div>
{{end}}
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
{{template "account-menu.html" . }}
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head rowhead">
<div class="rowitem"><a>Edit Username</a></div>
</div>
@ -19,5 +19,5 @@
</div>
</form>
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
{{template "account-menu.html" . }}
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head rowhead">
<div class="rowitem"><a>Edit Password</a></div>
</div>
@ -23,5 +23,5 @@
</div>
</form>
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,4 +1,5 @@
{{template "header.html" . }}
<main>
<div class="rowblock rowhead">
<div class="rowitem"><a>Are you sure?</a></div>
</div>
@ -7,4 +8,5 @@
<a class="username" href="{{.Something.URL}}?session={{.CurrentUser.Session}}">Continue</a>
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,4 +1,5 @@
{{template "header.html" . }}
<main>
<div class="rowblock rowhead">
<div class="rowitem"><a>Create Topic</a></div>
</div>
@ -23,4 +24,5 @@
</div>
</form>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,8 @@
{{template "header.html" . }}
<main>
<div class="rowblock">
<div class="rowitem">{{.Title}}</div>
</div>
<div class="rowblock">{{.Something}}</div>
</main>
{{template "footer.html" . }}

View File

@ -1,4 +1,5 @@
{{template "header.html" . }}
<main>
<div class="rowblock">
<form action='/topic/edit/{{index .Something "ID"}}/submit/' method="post">
<div class="rowitem">
@ -11,9 +12,7 @@
</form>
</div>
<div class="rowblock">
{{range $index, $element := .ItemList}}<div class="rowitem passive">
{{$element.Content}}
</div>{{end}}
{{range $index, $element := .ItemList}}<div class="rowitem passive">{{$element.Content}}</div>{{end}}
</div>
<div class="rowblock">
<form action="/reply/create/" method="post">
@ -26,4 +25,5 @@
</div>
</form>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,8 +1,10 @@
{{template "header.html" . }}
<main>
<div class="rowblock rowhead">
<div class="rowitem"><a>An error has occured</a></div>
</div>
<div class="rowblock">
<div class="rowitem passive">{{.Something}}</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -4,6 +4,8 @@
{{if ne .LastPage .Page}}<link rel="prerender" href="/forum/{{.Forum.ID}}?page={{add .Page 1}}" />
<div id="nextFloat" class="next_button"><a class="next_link" href="/forum/{{.Forum.ID}}?page={{add .Page 1}}">&gt;</a></div>{{end}}
<main>
<div id="forum_head_block" class="rowblock rowhead">
<div class="rowitem forum_title{{if ne .CurrentUser.ID 0}} has_opt{{end}}"><a>{{.Title}}</a>
</div>
@ -36,4 +38,6 @@
</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}}
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,4 +1,6 @@
{{template "header.html" . }}
<main>
<div class="rowblock opthead">
<div class="rowitem"><a>Forums</a></div>
</div>
@ -20,4 +22,6 @@
</div>
{{else}}<div class="rowitem passive">You don't have access to any forums.</div>{{end}}
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,4 +1,4 @@
<div class="nav">
<nav class="nav">
<div class="move_left">
<div class="move_right">
<ul>
@ -25,4 +25,4 @@
</div>
</div>
<div style="clear: both;"></div>
</div>
</nav>

View File

@ -1,3 +1,5 @@
{{template "header.html" . }}
<main>
</main>
{{template "footer.html" . }}

View File

@ -1,5 +1,5 @@
{{template "header.html" . }}
<div class="colstack_left">
<nav class="colstack_left">
<div class="colstack_item colstack_head">
<div class="rowitem"><a href="/panel/logs/mod/">Logs</a></div>
</div>
@ -8,8 +8,8 @@
{{if .CurrentUser.Perms.ViewAdminLogs}}<div class="rowitem passive"><a>Administration Logs</a></div>{{end}}
</div>
{{template "panel-inner-menu.html" . }}
</div>
<div class="colstack_right">
</nav>
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Administration Logs</a></div>
</div>
@ -24,5 +24,5 @@
</div>
{{end}}
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div id="panel_dashboard_right" class="colstack_right">
<main id="panel_dashboard_right" class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Dashboard</a></div>
</div>
@ -10,5 +10,5 @@
{{if .Background}}background-color: {{.Background}};{{end}}">{{.Body}}</div>
{{end}}
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div id="panel_dashboard_right" class="colstack_right">
<main id="panel_dashboard_right" class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Debug</a></div>
</div>
@ -13,5 +13,5 @@
<div class="grid_item grid_stat">{{.OpenConns}}</div>
<div class="grid_item grid_stat">{{.DBAdapter}}</div>
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -4,7 +4,7 @@
var form_vars = {'perm_preset': ['can_moderate','can_post','read_only','no_access','default','custom']};
</script>
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>{{.Name}} Forum</a></div>
</div>
@ -62,5 +62,5 @@ var form_vars = {'perm_preset': ['can_moderate','can_post','read_only','no_acces
</div>
{{end}}
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -5,7 +5,7 @@
'forum_preset': ['all','announce','members','staff','admins','archive','custom']};
</script>
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Forums</a></div>
</div>
@ -70,6 +70,6 @@
</div>
</form>
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,5 +1,5 @@
{{template "header.html" . }}
<div class="colstack_left">
<nav class="colstack_left">
<div class="colstack_item colstack_head">
<div class="rowitem"><a href="/panel/groups/edit/{{.ID}}">Group Editor</a></div>
</div>
@ -9,8 +9,8 @@
<div class="rowitem passive"><a href="/panel/groups/edit/perms/{{.ID}}">Permissions</a></div>
</div>
{{template "panel-inner-menu.html" . }}
</div>
<div class="colstack_right">
</nav>
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>{{.Name}} Group</a></div>
</div>
@ -59,5 +59,5 @@
</div>
</div>
</form>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,5 +1,5 @@
{{template "header.html" . }}
<div class="colstack_left">
<nav class="colstack_left">
<div class="colstack_item colstack_head">
<div class="rowitem"><a href="/panel/groups/edit/{{.ID}}">Group Editor</a></div>
</div>
@ -9,8 +9,8 @@
<div class="rowitem passive"><a href="/panel/groups/edit/perms/{{.ID}}">Permissions</a></div>
</div>
{{template "panel-inner-menu.html" . }}
</div>
<div class="colstack_right">
</nav>
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>{{.Name}} Group</a></div>
</div>
@ -42,5 +42,5 @@
</div>
</form>
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Groups</a></div>
</div>
@ -56,5 +56,5 @@
</div>
</form>
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1 +1 @@
<div class="colstack_left">{{template "panel-inner-menu.html" . }}</div>
<nav class="colstack_left">{{template "panel-inner-menu.html" . }}</nav>

View File

@ -1,5 +1,5 @@
{{template "header.html" . }}
<div class="colstack_left">
<nav class="colstack_left">
<div class="colstack_item colstack_head">
<div class="rowitem"><a href="/panel/logs/mod/">Logs</a></div>
</div>
@ -8,8 +8,8 @@
{{if .CurrentUser.Perms.ViewAdminLogs}}<div class="rowitem passive"><a>Administration Logs</a></div>{{end}}
</div>
{{template "panel-inner-menu.html" . }}
</div>
<div class="colstack_right">
</nav>
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Moderation Logs</a></div>
</div>
@ -36,5 +36,5 @@
{{if ne .LastPage .Page}}<div class="pageitem"><a href="?page={{add .Page 1}}">Next</a></div>{{end}}
</div>
{{end}}
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Plugins</a></div>
</div>
@ -20,5 +20,5 @@
</div>
{{end}}
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Edit Setting</a></div>
</div>
@ -33,5 +33,5 @@
</div>
</form>
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Settings</a></div>
</div>
@ -12,5 +12,5 @@
</div>
{{end}}
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,5 +1,5 @@
{{template "header.html" . }}
<div class="colstack_left">
<nav class="colstack_left">
<div class="colstack_item colstack_head">
<div class="rowitem"><a href="/panel/themes/">Theme Manager</a></div>
</div>
@ -7,7 +7,7 @@
<div class="rowitem passive"><a href="#">Widgets</a></div>
</div>
{{template "panel-inner-menu.html" . }}
</div>
</nav>
<!-- Stop inlining this x.x -->
<style type="text/css">
@ -18,7 +18,7 @@
}
</style>
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Primary Themes</a></div>
</div>
@ -55,5 +55,5 @@
</div>
{{end}}
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>User Editor</a></div>
</div>
@ -32,5 +32,5 @@
</div>
</form>
</div>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colstack_right">
<main class="colstack_right">
<div class="colstack_item colstack_head">
<div class="rowitem"><a>Users</a></div>
</div>
@ -28,5 +28,5 @@
{{if ne .LastPage .Page}}<div class="pageitem"><a href="?page={{add .Page 1}}">Next</a></div>{{end}}
</div>
{{end}}
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,4 +1,6 @@
{{template "header.html" . }}
<main>
<div class="rowblock rowhead">
<div class="rowitem"><a>Create Account</a></div>
</div>
@ -25,4 +27,6 @@
</div>
</form>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,4 +1,6 @@
{{template "header.html" . }}
<main>
<div class="rowblock rowhead">
<div class="rowitem"><a>Create Group</a></div>
</div>
@ -27,4 +29,6 @@
</div>
</form>
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,4 +1,5 @@
{{template "header.html" . }}
<main>
<div class="rowblock opthead">
<div class="rowitem"><a>Group List</a></div>
</div>
@ -16,4 +17,5 @@
</div>
{{else}}<div class="rowitem passive">There aren't any visible groups.</div>{{end}}
</div>
</main>
{{template "footer.html" . }}

View File

@ -8,16 +8,16 @@
<div id="nextFloat" class="next_button"><a class="next_link" href="/group/members/{{.SocialGroup.ID}}?page={{add .Page 1}}">&gt;</a></div>{{end}}
<div class="sgBackdrop">
<div class="miniMenu">
<nav class="miniMenu">
<div class="menuItem"><a href="/group/{{.SocialGroup.ID}}">{{.SocialGroup.Name}}</a></div>
<div class="menuItem"><a href="#">About</a></div>
<div class="menuItem"><a href="/group/members/{{.SocialGroup.ID}}">Members</a></div>
<div class="menuItem rightMenu"><a href="#">Edit</a></div>
<div class="menuItem rightMenu"><a href="/group/join/{{.SocialGroup.ID}}">Join</a></div>
</div>
</nav>
<div style="clear: both;"></div>
</div>
<div id="socialgroups_member_list" class="rowblock member_list" style="position: relative;z-index: 50;">
<main id="socialgroups_member_list" class="rowblock member_list" style="position: relative;z-index: 50;">
{{range .ItemList}}<div class="rowitem passive datarow" style="{{if .User.Avatar}}background-image: url({{.User.Avatar}});background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 78px;{{end}}{{if .Offline}}background-color: #eaeaea;{{else if gt .Rank 0}}background-color: #e6f3ff;{{end}}">
<span style="float: right;">
<span class="rank" style="font-size: 15px;">{{.RankString}}</span><br />
@ -30,5 +30,5 @@
</span>
</div>
{{end}}
</div>
</main>
{{template "footer.html" . }}

View File

@ -8,17 +8,17 @@
<div id="nextFloat" class="next_button"><a class="next_link" href="/group/{{.SocialGroup.ID}}?page={{add .Page 1}}">&gt;</a></div>{{end}}
<div class="sgBackdrop">
<div class="miniMenu">
<nav class="miniMenu">
<div class="menuItem"><a href="/group/{{.SocialGroup.ID}}">{{.SocialGroup.Name}}</a></div>
<div class="menuItem"><a href="#">About</a></div>
<div class="menuItem"><a href="/group/members/{{.SocialGroup.ID}}">Members</a></div>
<div class="menuItem rightMenu"><a href="#">Edit</a></div>
<div class="menuItem rightMenu"><a href="/topics/create/{{.Forum.ID}}">Reply</a></div>
<div class="menuItem rightMenu"><a href="/group/join/{{.SocialGroup.ID}}">Join</a></div>
</div>
</nav>
<div style="clear: both;"></div>
</div>
<div id="forum_topic_list" class="rowblock topic_list" style="position: relative;z-index: 50;">
<main id="forum_topic_list" class="rowblock topic_list" style="position: relative;z-index: 50;">
{{range .ItemList}}<div class="rowitem topic_left passive datarow" style="{{if .Creator.Avatar}}background-image: url({{.Creator.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}}">
<span class="topic_inner_right rowsmall" style="float: right;">
<span class="replyCount">{{.PostCount}} replies</span><br />
@ -37,5 +37,5 @@
</span>
</div>
{{else}}<div class="rowitem passive">There aren't any topics in here yet.{{if .CurrentUser.Perms.CreateTopic}} <a href="/topics/create/{{.Forum.ID}}">Start one?</a>{{end}}</div>{{end}}
</div>
</main>
{{template "footer.html" . }}

View File

@ -8,6 +8,8 @@
<a class="next_link" href="/topic/{{.Topic.ID}}?page={{add .Page 1}}">&gt;</a>
</div>{{end}}
<main>
<div class="rowblock rowhead topic_block">
<div class="rowitem topic_item{{if .Topic.Sticky}} topic_sticky_head{{else if .Topic.Is_Closed}} topic_closed_head{{end}}">
<a class='topic_name hide_on_edit'>{{.Topic.Title}}</a>
@ -23,7 +25,7 @@
</div>
</div>
<div class="rowblock post_container top_post">
<article class="rowblock post_container top_post">
<div class="rowitem passive editable_parent post_item {{.Topic.ClassName}}" style="{{if .Topic.Avatar}}background-image:url({{.Topic.Avatar}}), url(/static/post-avatar-bg.jpg);background-position: 0px {{if le .Topic.ContentLines 5}}-1{{end}}0px;background-repeat:no-repeat, repeat-y;{{end}}">
<p class="hide_on_edit topic_content user_content" style="margin:0;padding:0;">{{.Topic.Content}}</p>
<textarea name="topic_content" class="show_on_edit topic_content_input">{{.Topic.Content}}</textarea>
@ -47,14 +49,14 @@
</span>
</div>
</div>
</article>
<div class="rowblock post_container" style="overflow: hidden;">{{range .ItemList}}{{if .ActionType}}
<div class="rowitem passive deletable_block editable_parent post_item action_item">
<article class="rowitem passive deletable_block editable_parent post_item action_item">
<span class="action_icon" style="font-size: 18px;padding-right: 5px;">{{.ActionIcon}}</span>
<span>{{.ActionType}}</span>
</div>
</article>
{{else}}
<div class="rowitem passive deletable_block editable_parent post_item {{.ClassName}}" style="{{if .Avatar}}background-image:url({{.Avatar}}), url(/static/post-avatar-bg.jpg);background-position: 0px {{if le .ContentLines 5}}-1{{end}}0px;background-repeat:no-repeat, repeat-y;{{end}}">
<article class="rowitem passive deletable_block editable_parent post_item {{.ClassName}}" style="{{if .Avatar}}background-image:url({{.Avatar}}), url(/static/post-avatar-bg.jpg);background-position: 0px {{if le .ContentLines 5}}-1{{end}}0px;background-repeat:no-repeat, repeat-y;{{end}}">
<p class="editable_block user_content" style="margin:0;padding:0;">{{.ContentHtml}}</p>
<span class="controls">
@ -72,7 +74,7 @@
{{if .Tag}}<a class="username hide_on_micro user_tag">{{.Tag}}</a>{{else}}<a class="username hide_on_micro level">{{.Level}}</a><a class="username hide_on_micro level_label" style="float:right;" title="Level"></a>{{end}}
</span>
</div>
</article>
{{end}}{{end}}</div>
{{if .CurrentUser.Perms.CreateReply}}
@ -88,4 +90,7 @@
</form>
</div>
{{end}}
</main>
{{template "footer.html" . }}

View File

@ -3,6 +3,8 @@
{{if ne .LastPage .Page}}<link rel="prerender" href="/topic/{{.Topic.ID}}?page={{add .Page 1}}" />
<div id="nextFloat" class="next_button"><a class="next_link" href="/topic/{{.Topic.ID}}?page={{add .Page 1}}">&gt;</a></div>{{end}}
<main>
<div class="rowblock rowhead topic_block">
<form action='/topic/edit/submit/{{.Topic.ID}}' method="post">
<div class="rowitem topic_item{{if .Topic.Sticky}} topic_sticky_head{{else if .Topic.Is_Closed}} topic_closed_head{{end}}">
@ -20,9 +22,10 @@
</form>
</div>
<!-- Stop inling this x.x -->
<style type="text/css">.rowitem:last-child .content_container { margin-bottom: 5px !important; }</style>
<div class="rowblock post_container" style="border-top: none;">
<div class="rowitem passive deletable_block editable_parent post_item top_post" style="background-color: #eaeaea;padding-top: 4px;padding-left: 5px;clear: both;border-bottom: none;padding-right: 4px;padding-bottom: 2px;">
<article class="rowitem passive deletable_block editable_parent post_item top_post" style="background-color: #eaeaea;padding-top: 4px;padding-left: 5px;clear: both;border-bottom: none;padding-right: 4px;padding-bottom: 2px;">
<div class="userinfo">
<div class="avatar_item" style="background-image: url({{.Topic.Avatar}}), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div>
<a href="{{.Topic.UserLink}}" class="the_name">{{.Topic.CreatedByName}}</a>
@ -45,9 +48,9 @@
{{if .Topic.LikeCount}}<a class="action_button action_button_right hide_on_micro">{{.Topic.LikeCount}} up</a>{{end}}
</div>
</div><div style="clear:both;"></div>
</div>
</article>
{{range .ItemList}}
<div class="rowitem passive deletable_block editable_parent post_item {{if .ActionType}}action_item{{end}}">
<article class="rowitem passive deletable_block editable_parent post_item {{if .ActionType}}action_item{{end}}">
<div class="userinfo">
<div class="avatar_item" style="background-image: url({{.Avatar}}), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div>
<a href="{{.UserLink}}" class="the_name">{{.CreatedByName}}</a>
@ -73,7 +76,7 @@
{{end}}
</div>
<div style="clear:both;"></div>
</div>
</article>
{{end}}</div>
{{if .CurrentUser.Perms.CreateReply}}
<div class="rowblock topic_reply_form" style="border-top: none;">
@ -88,4 +91,7 @@
</form>
</div>
{{end}}
</main>
{{template "footer.html" . }}

View File

@ -1,4 +1,6 @@
{{template "header.html" . }}
<main>
<div class="rowblock rowhead">
<div class="rowitem"><a>Topic List</a></div>
</div>
@ -24,4 +26,6 @@
</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}}
</div>
</main>
{{template "footer.html" . }}

View File

@ -1,6 +1,6 @@
<div class="rowblock rowhead">
<div class="rowitem">{{.Name}}</div>
</div>
<div class="rowblock">{{range .MenuList}}
<nav class="rowblock">{{range .MenuList}}
<div class="rowitem {{if .Compact}}datarow{{end}}"><a href="{{.Location}}">{{.Text}}</a></div>
{{end}}</div>
{{end}}</nav>

View File

@ -166,9 +166,16 @@ a {
display: none;
}
/* Topic View */
/* TO-DO: How should we handle the sticky headers? */
.topic_sticky_head {
}
.topic_closed_head {
/* TO-DO: Rewrite the closed topic header so that it looks more consistent with the rest of the theme */
.topic_closed_head .topic_status_closed {
margin-bottom: -10px;
font-size: 19px;
}
.post_item {

28
user.go
View File

@ -14,10 +14,13 @@ import (
var guest_user User = User{ID:0,Link:"#",Group:6,Perms:GuestPerms}
var PreRoute func(http.ResponseWriter, *http.Request) (User,bool) = _pre_route
// TO-DO: Are these even session checks anymore? We might need to rethink these names
var PanelSessionCheck func(http.ResponseWriter, *http.Request, *User) (HeaderVars,PanelStats,bool) = _panel_session_check
var SimplePanelSessionCheck func(http.ResponseWriter, *http.Request, *User) bool = _simple_panel_session_check
var SimplePanelSessionCheck func(http.ResponseWriter, *http.Request, *User) (HeaderLite,bool) = _simple_panel_session_check
var SimpleForumSessionCheck func(w http.ResponseWriter, r *http.Request, user *User, fid int) (success bool) = _simple_forum_session_check
var ForumSessionCheck func(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerVars HeaderVars, success bool) = _forum_session_check
var SimpleSessionCheck func(w http.ResponseWriter, r *http.Request, user *User) (headerLite HeaderLite, success bool) = _simple_session_check
var SessionCheck func(w http.ResponseWriter, r *http.Request, user *User) (headerVars HeaderVars, success bool) = _session_check
var CheckPassword func(real_password string, password string, salt string) (err error) = BcryptCheckPassword
@ -210,6 +213,7 @@ func _forum_session_check(w http.ResponseWriter, r *http.Request, user *User, fi
// Even if they have the right permissions, the control panel is only open to supermods+. There are many areas without subpermissions which assume that the current user is a supermod+ and admins are extremely unlikely to give these permissions to someone who isn't at-least a supermod to begin with
func _panel_session_check(w http.ResponseWriter, r *http.Request, user *User) (headerVars HeaderVars, stats PanelStats, success bool) {
headerVars.Site = site
headerVars.Settings = settingBox.Load().(SettingBox)
if !user.Is_Super_Mod {
NoPermissions(w,r,*user)
return headerVars, stats, false
@ -241,7 +245,7 @@ func _panel_session_check(w http.ResponseWriter, r *http.Request, user *User) (h
stats.Users = users.GetGlobalCount()
stats.Forums = fstore.GetGlobalCount() // TO-DO: Stop it from showing the blanked forums
stats.Settings = len(settings) // TO-DO: IS this racey?
stats.Settings = len(headerVars.Settings) // TO-DO: IS this racey?
stats.Themes = len(themes)
stats.Reports = 0 // TO-DO: Do the report count. Only show open threads?
@ -258,16 +262,27 @@ func _panel_session_check(w http.ResponseWriter, r *http.Request, user *User) (h
return headerVars, stats, true
}
func _simple_panel_session_check(w http.ResponseWriter, r *http.Request, user *User) (success bool) {
func _simple_panel_session_check(w http.ResponseWriter, r *http.Request, user *User) (headerLite HeaderLite, success bool) {
if !user.Is_Super_Mod {
NoPermissions(w,r,*user)
return false
return headerLite, false
}
return true
headerLite.Site = site
headerLite.Settings = settingBox.Load().(SettingBox)
return headerLite, true
}
// SimpleSessionCheck is back from the grave, yay :D
func _simple_session_check(w http.ResponseWriter, r *http.Request, user *User) (headerLite HeaderLite, success bool) {
headerLite.Site = site
headerLite.Settings = settingBox.Load().(SettingBox)
return headerLite, true
}
func _session_check(w http.ResponseWriter, r *http.Request, user *User) (headerVars HeaderVars, success bool) {
headerVars.Site = site
headerVars.Settings = settingBox.Load().(SettingBox)
if user.Is_Banned {
headerVars.NoticeList = append(headerVars.NoticeList,"Your account has been suspended. Some of your permissions may have been revoked.")
}
@ -336,6 +351,7 @@ func words_to_score(wcount int, topic bool) (score int) {
score = 1
}
settings := settingBox.Load().(map[string]interface{})
if wcount >= settings["megapost_min_words"].(int) {
score += 4
} else if wcount >= settings["bigpost_min_words"].(int) {
@ -355,6 +371,7 @@ func increase_post_user_stats(wcount int, uid int, topic bool, user User) error
base_score = 2
}
settings := settingBox.Load().(map[string]interface{})
if wcount >= settings["megapost_min_words"].(int) {
_, err := increment_user_megaposts_stmt.Exec(1,1,1,uid)
if err != nil {
@ -394,6 +411,7 @@ func decrease_post_user_stats(wcount int, uid int, topic bool, user User) error
base_score = -2
}
settings := settingBox.Load().(map[string]interface{})
if wcount >= settings["megapost_min_words"].(int) {
_, err := increment_user_megaposts_stmt.Exec(-1,-1,-1,uid)
if err != nil {