diff --git a/README.md b/README.md index d29f5950..82dfe48e 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,8 @@ We're looking for ways to clean-up the plugin system so that all of them (except # Images +![Shadow Theme](https://github.com/Azareal/Gosora/blob/master/images/shadow.png) + ![Tempra Simple Theme](https://github.com/Azareal/Gosora/blob/master/images/tempra-simple.png) ![Tempra Simple Topic List](https://github.com/Azareal/Gosora/blob/master/images/topic-list.png) @@ -154,6 +156,8 @@ We're looking for ways to clean-up the plugin system so that all of them (except ![Cosmo Theme](https://github.com/Azareal/Gosora/blob/master/images/cosmo.png) +More images in the /images/ folder. Beware though, some of them are *really* outdated. + # Dependencies * Go 1.8 diff --git a/alerts.go b/alerts.go index da512f4e..de567ccb 100644 --- a/alerts.go +++ b/alerts.go @@ -2,7 +2,6 @@ package main import "log" import "strings" -import "strconv" import "errors" /* @@ -20,130 +19,130 @@ import "errors" */ func build_alert(event string, elementType string, actor_id int, targetUser_id int, elementID int, user User /* The current user */) (string, error) { - var targetUser *User + var targetUser *User - actor, err := users.CascadeGet(actor_id) - if err != nil { - return "", errors.New("Unable to find the actor") - } + actor, err := users.CascadeGet(actor_id) + if err != nil { + return "", errors.New("Unable to find the actor") + } - /*if elementType != "forum" { - targetUser, err = users.CascadeGet(targetUser_id) - if err != nil { - LocalErrorJS("Unable to find the target user",w,r) - return - } - }*/ + /*if elementType != "forum" { + targetUser, err = users.CascadeGet(targetUser_id) + if err != nil { + LocalErrorJS("Unable to find the target user",w,r) + return + } + }*/ - if event == "friend_invite" { - return `{"msg":"You received a friend invite from {0}","sub":["` + actor.Name + `"],"path":"\/user\/`+actor.Slug+`.`+strconv.Itoa(actor.ID)+`","avatar":"`+strings.Replace(actor.Avatar,"/","\\/",-1)+`"}`, nil - } + if event == "friend_invite" { + return `{"msg":"You received a friend invite from {0}","sub":["` + actor.Name + `"],"path":"`+actor.Link+`","avatar":"`+strings.Replace(actor.Avatar,"/","\\/",-1)+`"}`, nil + } - var act, post_act, url, area string - var start_frag, end_frag string - switch(elementType) { - case "forum": - if event == "reply" { - act = "created a new topic" - topic, err := topics.CascadeGet(elementID) - if err != nil { - return "", errors.New("Unable to find the linked topic") - } - url = build_topic_url(topic.Slug,elementID) - area = topic.Title - // Store the forum ID in the targetUser column instead of making a new one? o.O - // Add an additional column for extra information later on when we add the ability to link directly to posts. We don't need the forum data for now... - } else { - act = "did something in a forum" - } - case "topic": - topic, err := topics.CascadeGet(elementID) - if err != nil { - return "", errors.New("Unable to find the linked topic") - } - url = build_topic_url(topic.Slug,elementID) - area = topic.Title + var act, post_act, url, area string + var start_frag, end_frag string + switch(elementType) { + case "forum": + if event == "reply" { + act = "created a new topic" + topic, err := topics.CascadeGet(elementID) + if err != nil { + return "", errors.New("Unable to find the linked topic") + } + url = topic.Link + area = topic.Title + // Store the forum ID in the targetUser column instead of making a new one? o.O + // Add an additional column for extra information later on when we add the ability to link directly to posts. We don't need the forum data for now... + } else { + act = "did something in a forum" + } + case "topic": + topic, err := topics.CascadeGet(elementID) + if err != nil { + return "", errors.New("Unable to find the linked topic") + } + url = topic.Link + area = topic.Title - if targetUser_id == user.ID { - post_act = " your topic" - } - case "user": - targetUser, err = users.CascadeGet(elementID) - if err != nil { - return "", errors.New("Unable to find the target user") - } - area = targetUser.Name - end_frag = "'s profile" - url = build_profile_url(targetUser.Slug,elementID) - case "post": - topic, err := get_topic_by_reply(elementID) - if err != nil { - return "", errors.New("Unable to find the linked reply or parent topic") - } - url = build_topic_url(topic.Slug,topic.ID) - area = topic.Title - if targetUser_id == user.ID { - post_act = " your post in" - } - default: - return "", errors.New("Invalid elementType") - } + if targetUser_id == user.ID { + post_act = " your topic" + } + case "user": + targetUser, err = users.CascadeGet(elementID) + if err != nil { + return "", errors.New("Unable to find the target user") + } + area = targetUser.Name + end_frag = "'s profile" + url = targetUser.Link + case "post": + topic, err := get_topic_by_reply(elementID) + if err != nil { + return "", errors.New("Unable to find the linked reply or parent topic") + } + url = topic.Link + area = topic.Title + if targetUser_id == user.ID { + post_act = " your post in" + } + default: + return "", errors.New("Invalid elementType") + } - switch(event) { - case "like": - if elementType == "user" { - act = "likes" - end_frag = "" - if targetUser.ID == user.ID { - area = "you" - } - } else { - act = "liked" - } - case "mention": - if elementType == "user" { - act = "mentioned you on" - } else { - act = "mentioned you in" - post_act = "" - } - case "reply": act = "replied to" - } + switch(event) { + case "like": + if elementType == "user" { + act = "likes" + end_frag = "" + if targetUser.ID == user.ID { + area = "you" + } + } else { + act = "liked" + } + case "mention": + if elementType == "user" { + act = "mentioned you on" + } else { + act = "mentioned you in" + post_act = "" + } + case "reply": act = "replied to" + } - return `{"msg":"{0} ` + start_frag + act + post_act + ` {1}` + end_frag + `","sub":["` + actor.Name + `","` + area + `"],"path":"` + url + `","avatar":"` + actor.Avatar + `"}`, nil + return `{"msg":"{0} ` + start_frag + act + post_act + ` {1}` + end_frag + `","sub":["` + actor.Name + `","` + area + `"],"path":"` + url + `","avatar":"` + actor.Avatar + `"}`, nil } func notify_watchers(asid int64) { - rows, err := get_watchers_stmt.Query(asid) - if err != nil && err != ErrNoRows { + rows, err := get_watchers_stmt.Query(asid) + if err != nil && err != ErrNoRows { log.Fatal(err.Error()) return } - var uid int - var uids []int - for rows.Next() { - err := rows.Scan(&uid) - if err != nil { - log.Fatal(err.Error()) - return - } - uids = append(uids,uid) - } - err = rows.Err() - if err != nil { - log.Fatal(err.Error()) - return - } - rows.Close() + var uid int + var uids []int + for rows.Next() { + err := rows.Scan(&uid) + if err != nil { + log.Fatal(err.Error()) + return + } + uids = append(uids,uid) + } + err = rows.Err() + if err != nil { + log.Fatal(err.Error()) + return + } + rows.Close() - var actor_id, targetUser_id, elementID int - var event, elementType string - err = get_activity_entry_stmt.QueryRow(asid).Scan(&actor_id, &targetUser_id, &event, &elementType, &elementID) - if err != nil && err != ErrNoRows { - log.Fatal(err.Error()) - return - } + var actor_id, targetUser_id, elementID int + var event, elementType string + err = get_activity_entry_stmt.QueryRow(asid).Scan(&actor_id, &targetUser_id, &event, &elementType, &elementID) + if err != nil && err != ErrNoRows { + log.Fatal(err.Error()) + return + } - _ = ws_hub.push_alerts(uids, event, elementType, actor_id, targetUser_id, elementID) + _ = ws_hub.push_alerts(uids, event, elementType, actor_id, targetUser_id, elementID) } diff --git a/config.go b/config.go index ef798c93..d42883bc 100644 --- a/config.go +++ b/config.go @@ -2,7 +2,7 @@ package main func init() { // Site Info -site.Name = "Test Site" // Should be a setting in the database +site.Name = "TS" // Should be a setting in the database site.Email = "" // Should be a setting in the database site.Url = "localhost" site.Port = "8080" diff --git a/forum.go b/forum.go index 8f5d1160..9e58bbc6 100644 --- a/forum.go +++ b/forum.go @@ -26,7 +26,7 @@ type Forum struct ParentID int ParentType string TopicCount int - LastTopicSlug string + LastTopicLink string LastTopic string LastTopicID int LastReplyer string diff --git a/forum_store.go b/forum_store.go index 68a10822..7fcbe517 100644 --- a/forum_store.go +++ b/forum_store.go @@ -97,7 +97,7 @@ func (sfs *StaticForumStore) LoadForums() error { } forum.Link = build_forum_url(name_to_slug(forum.Name),forum.ID) - forum.LastTopicSlug = build_slug(name_to_slug(forum.LastTopic),forum.LastTopicID) + forum.LastTopicLink = build_topic_url(name_to_slug(forum.LastTopic),forum.LastTopicID) forums = append(forums,&forum) } err = rows.Err() @@ -306,7 +306,7 @@ func (sfs *StaticForumStore) CreateForum(forum_name string, forum_desc string, a } fid = int(fid64) - sfs.forums = append(sfs.forums, &Forum{fid,name_to_slug(forum_name),forum_name,forum_desc,active,preset,0,"",0,"","",0,"",0,""}) + sfs.forums = append(sfs.forums, &Forum{fid,build_forum_url(name_to_slug(forum_name),fid),forum_name,forum_desc,active,preset,0,"",0,"","",0,"",0,""}) sfs.forumCapCount++ // TO-DO: Add a GroupStore. How would it interact with the ForumStore? diff --git a/general_test.go b/general_test.go index 0fe8aa15..9a0c646a 100644 --- a/general_test.go +++ b/general_test.go @@ -36,7 +36,7 @@ func gloinit() { startTime = time.Now() //timeLocation = startTime.Location() process_config() - + init_themes() err := init_database() if err != nil { @@ -171,16 +171,16 @@ func BenchmarkTopicsTemplateSerial(b *testing.B) { admin := User{1,"admin-alice","Admin Alice","admin@localhost",0,true,true,true,true,true,false,AllPerms,make(map[string]bool),"",false,"","","","","",-1,58,"127.0.0.1"} var topicList []TopicsRow - topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserSlug:"admin-alice",CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) - topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserSlug:"admin-alice",CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) - topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserSlug:"admin-alice",CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) - topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserSlug:"admin-alice",CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) - topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserSlug:"admin-alice",CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) - topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserSlug:"admin-alice",CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) - topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserSlug:"admin-alice",CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) - topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserSlug:"admin-alice",CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) - topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserSlug:"admin-alice",CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) - topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserSlug:"admin-alice",CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) + topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserLink:build_profile_url("admin-alice",1),CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) + topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserLink:build_profile_url("admin-alice",1),CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) + topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserLink:build_profile_url("admin-alice",1),CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) + topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserLink:build_profile_url("admin-alice",1),CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) + topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserLink:build_profile_url("admin-alice",1),CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) + topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserLink:build_profile_url("admin-alice",1),CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) + topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserLink:build_profile_url("admin-alice",1),CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) + topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserLink:build_profile_url("admin-alice",1),CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) + topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserLink:build_profile_url("admin-alice",1),CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) + topicList = append(topicList, TopicsRow{Title: "Hey everyone!",Content: "Hey everyone!",CreatedBy: 1,CreatedAt: "0000-00-00 00:00:00",ParentID: 1,UserLink:build_profile_url("admin-alice",1),CreatedByName:"Admin Alice",Css: no_css_tmpl,Tag: "Admin", Level: 58, IpAddress: "127.0.0.1"}) headerVars := HeaderVars{ NoticeList:[]string{"test"}, diff --git a/images/shadow-forumlist.png b/images/shadow-forumlist.png new file mode 100644 index 00000000..f2685ed9 Binary files /dev/null and b/images/shadow-forumlist.png differ diff --git a/images/shadow-mobile-320px.png b/images/shadow-mobile-320px.png new file mode 100644 index 00000000..be785316 Binary files /dev/null and b/images/shadow-mobile-320px.png differ diff --git a/images/shadow-mobile-forumlist-320px.png b/images/shadow-mobile-forumlist-320px.png new file mode 100644 index 00000000..c2c7d7e8 Binary files /dev/null and b/images/shadow-mobile-forumlist-320px.png differ diff --git a/images/shadow-panel-320px.png b/images/shadow-panel-320px.png new file mode 100644 index 00000000..be5b0450 Binary files /dev/null and b/images/shadow-panel-320px.png differ diff --git a/images/shadow-panel-768px.png b/images/shadow-panel-768px.png new file mode 100644 index 00000000..0fc4814a Binary files /dev/null and b/images/shadow-panel-768px.png differ diff --git a/images/shadow-panel.png b/images/shadow-panel.png new file mode 100644 index 00000000..739a8f51 Binary files /dev/null and b/images/shadow-panel.png differ diff --git a/images/shadow-profile-768px.png b/images/shadow-profile-768px.png new file mode 100644 index 00000000..508e50a2 Binary files /dev/null and b/images/shadow-profile-768px.png differ diff --git a/images/shadow-profile.png b/images/shadow-profile.png new file mode 100644 index 00000000..e00f68e2 Binary files /dev/null and b/images/shadow-profile.png differ diff --git a/images/shadow-tablet-768px.png b/images/shadow-tablet-768px.png new file mode 100644 index 00000000..0046d963 Binary files /dev/null and b/images/shadow-tablet-768px.png differ diff --git a/images/shadow-topics.png b/images/shadow-topics.png new file mode 100644 index 00000000..ff5e8607 Binary files /dev/null and b/images/shadow-topics.png differ diff --git a/images/shadow-topicview-320px.png b/images/shadow-topicview-320px.png new file mode 100644 index 00000000..e560a391 Binary files /dev/null and b/images/shadow-topicview-320px.png differ diff --git a/images/shadow-topicview-768px.png b/images/shadow-topicview-768px.png new file mode 100644 index 00000000..0a8e1892 Binary files /dev/null and b/images/shadow-topicview-768px.png differ diff --git a/images/shadow.png b/images/shadow.png new file mode 100644 index 00000000..b4fef731 Binary files /dev/null and b/images/shadow.png differ diff --git a/main.go b/main.go index 072595a4..57254cb9 100644 --- a/main.go +++ b/main.go @@ -47,7 +47,7 @@ var template_create_topic_handle func(CreateTopicPage,io.Writer) = nil func compile_templates() error { var c CTemplateSet - user := User{62,"fake-user","Fake User","compiler@localhost",0,false,false,false,false,false,false,GuestPerms,make(map[string]bool),"",false,"","","","","",0,0,"0.0.0.0.0"} + user := User{62,build_profile_url("fake-user",62),"Fake User","compiler@localhost",0,false,false,false,false,false,false,GuestPerms,make(map[string]bool),"",false,"","","","","",0,0,"0.0.0.0.0"} headerVars := HeaderVars{ Site:site, NoticeList:[]string{"test"}, @@ -60,7 +60,7 @@ func compile_templates() error { log.Print("Compiling the templates") - topic := TopicUser{1,"blah","Blah","Hey there!",0,false,false,"Date","Date",0,"","127.0.0.1",0,1,"classname","weird-data","fake-user","Fake User",config.DefaultGroup,"",0,"","","","",58,false} + topic := TopicUser{1,"blah","Blah","Hey there!",0,false,false,"Date","Date",0,"","127.0.0.1",0,1,"classname","weird-data",build_profile_url("fake-user",62),"Fake User",config.DefaultGroup,"",0,"","","","",58,false} var replyList []Reply replyList = append(replyList, Reply{0,0,"Yo!","Yo!",0,"alice","Alice",config.DefaultGroup,"",0,0,"","",0,"","","","",0,"127.0.0.1",false,1,"",""}) diff --git a/pages.go b/pages.go index 3c3ebdc2..9d08732f 100644 --- a/pages.go +++ b/pages.go @@ -509,7 +509,7 @@ func parse_message(msg string/*, user User*/) string { } outbytes = append(outbytes, url_open...) - var url_bit []byte = []byte(build_profile_url(menUser.Slug,uid)) + var url_bit []byte = []byte(menUser.Link) outbytes = append(outbytes, url_bit...) outbytes = append(outbytes, bytes_singlequote...) outbytes = append(outbytes, url_mention...) diff --git a/panel_routes.go b/panel_routes.go index d83103e0..66060c09 100644 --- a/panel_routes.go +++ b/panel_routes.go @@ -1734,64 +1734,64 @@ func route_panel_logs_mod(w http.ResponseWriter, r *http.Request, user User){ actor, err := users.CascadeGet(actorID) if err != nil { - actor = &User{Name:"Unknown",Slug:"unknown"} + actor = &User{Name:"Unknown",Link:build_profile_url("unknown",0)} } switch(action) { case "lock": topic, err := topics.CascadeGet(elementID) if err != nil { - topic = &Topic{Title:"Unknown",Slug:"unknown"} + topic = &Topic{Title:"Unknown",Link:build_profile_url("unknown",0)} } - action = "" + topic.Title + " was locked by "+actor.Name+"" + action = "" + topic.Title + " was locked by "+actor.Name+"" case "unlock": topic, err := topics.CascadeGet(elementID) if err != nil { - topic = &Topic{Title:"Unknown",Slug:"unknown"} + topic = &Topic{Title:"Unknown",Link:build_profile_url("unknown",0)} } - action = "" + topic.Title + " was reopened by "+actor.Name+"" + action = "" + topic.Title + " was reopened by "+actor.Name+"" case "stick": topic, err := topics.CascadeGet(elementID) if err != nil { - topic = &Topic{Title:"Unknown",Slug:"unknown"} + topic = &Topic{Title:"Unknown",Link:build_profile_url("unknown",0)} } - action = "" + topic.Title + " was pinned by "+actor.Name+"" + action = "" + topic.Title + " was pinned by "+actor.Name+"" case "unstick": topic, err := topics.CascadeGet(elementID) if err != nil { - topic = &Topic{Title:"Unknown",Slug:"unknown"} + topic = &Topic{Title:"Unknown",Link:build_profile_url("unknown",0)} } - action = "" + topic.Title + " was unpinned by "+actor.Name+"" + action = "" + topic.Title + " was unpinned by "+actor.Name+"" case "delete": if elementType == "topic" { - action = "Topic #" + strconv.Itoa(elementID) + " was deleted by "+actor.Name+"" + action = "Topic #" + strconv.Itoa(elementID) + " was deleted by "+actor.Name+"" } else { topic, err := get_topic_by_reply(elementID) if err != nil { - topic = &Topic{Title:"Unknown",Slug:"unknown"} + topic = &Topic{Title:"Unknown",Link:build_profile_url("unknown",0)} } - action = "A reply in " + topic.Title + " was deleted by "+actor.Name+"" + action = "A reply in " + topic.Title + " was deleted by "+actor.Name+"" } case "ban": targetUser, err := users.CascadeGet(elementID) if err != nil { - targetUser = &User{Name:"Unknown",Slug:"unknown"} + targetUser = &User{Name:"Unknown",Link:build_profile_url("unknown",0)} } - action = "" + targetUser.Name + " was banned by "+actor.Name+"" + action = "" + targetUser.Name + " was banned by "+actor.Name+"" case "unban": targetUser, err := users.CascadeGet(elementID) if err != nil { - targetUser = &User{Name:"Unknown",Slug:"unknown"} + targetUser = &User{Name:"Unknown",Link:build_profile_url("unknown",0)} } - action = "" + targetUser.Name + " was unbanned by "+actor.Name+"" + action = "" + targetUser.Name + " was unbanned by "+actor.Name+"" case "activate": targetUser, err := users.CascadeGet(elementID) if err != nil { - targetUser = &User{Name:"Unknown",Slug:"unknown"} + targetUser = &User{Name:"Unknown",Link:build_profile_url("unknown",0)} } - action = "" + targetUser.Name + " was activated by "+actor.Name+"" + action = "" + targetUser.Name + " was activated by "+actor.Name+"" default: - action = "Unknown action '" + action + "' by "+actor.Name+"" + action = "Unknown action '" + action + "' by "+actor.Name+"" } logs = append(logs, Log{Action:template.HTML(action),IPAddress:ipaddress,DoneAt:doneAt}) } diff --git a/reply.go b/reply.go index 8327864e..37edf916 100644 --- a/reply.go +++ b/reply.go @@ -10,7 +10,7 @@ type Reply struct /* Should probably rename this to ReplyUser and rename ReplySh Content string ContentHtml string CreatedBy int - UserSlug string + UserLink string CreatedByName string Group int CreatedAt string diff --git a/routes.go b/routes.go index dc97e697..0ee099d3 100644 --- a/routes.go +++ b/routes.go @@ -155,8 +155,8 @@ func route_topics(w http.ResponseWriter, r *http.Request, user User){ return } - topicItem.Slug = name_to_slug(topicItem.Title) - topicItem.UserSlug = name_to_slug(topicItem.CreatedByName) + topicItem.Link = build_topic_url(name_to_slug(topicItem.Title),topicItem.ID) + topicItem.UserLink = build_profile_url(name_to_slug(topicItem.CreatedByName),topicItem.CreatedBy) if topicItem.Avatar != "" { if topicItem.Avatar[0] == '.' { @@ -278,8 +278,8 @@ func route_forum(w http.ResponseWriter, r *http.Request, user User, sfid string) return } - topicItem.Slug = name_to_slug(topicItem.Title) - topicItem.UserSlug = name_to_slug(topicItem.CreatedByName) + topicItem.Link = build_topic_url(name_to_slug(topicItem.Title),topicItem.ID) + topicItem.UserLink = build_profile_url(name_to_slug(topicItem.CreatedByName),topicItem.CreatedBy) if topicItem.Avatar != "" { if topicItem.Avatar[0] == '.' { @@ -491,7 +491,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request, user User){ return } - replyItem.UserSlug = name_to_slug(replyItem.CreatedByName) + replyItem.UserLink = build_profile_url(name_to_slug(replyItem.CreatedByName),replyItem.CreatedBy) replyItem.ParentID = topic.ID replyItem.ContentHtml = parse_message(replyItem.Content) replyItem.ContentLines = strings.Count(replyItem.Content,"\n") @@ -532,16 +532,16 @@ func route_topic_id(w http.ResponseWriter, r *http.Request, user User){ if replyItem.ActionType != "" { switch(replyItem.ActionType) { case "lock": - replyItem.ActionType = "This topic has been locked by " + replyItem.CreatedByName + "" + replyItem.ActionType = "This topic has been locked by " + replyItem.CreatedByName + "" replyItem.ActionIcon = "🔒︎" case "unlock": - replyItem.ActionType = "This topic has been reopened by " + replyItem.CreatedByName + "" + replyItem.ActionType = "This topic has been reopened by " + replyItem.CreatedByName + "" replyItem.ActionIcon = "🔓︎" case "stick": - replyItem.ActionType = "This topic has been pinned by " + replyItem.CreatedByName + "" + replyItem.ActionType = "This topic has been pinned by " + replyItem.CreatedByName + "" replyItem.ActionIcon = "📌︎" case "unstick": - replyItem.ActionType = "This topic has been unpinned by " + replyItem.CreatedByName + "" + replyItem.ActionType = "This topic has been unpinned by " + replyItem.CreatedByName + "" replyItem.ActionIcon = "📌︎" default: replyItem.ActionType = replyItem.ActionType + " has happened" @@ -665,7 +665,7 @@ func route_profile(w http.ResponseWriter, r *http.Request, user User){ // TO-DO: Add a hook here - replyList = append(replyList, Reply{rid,puser.ID,replyContent,parse_message(replyContent),replyCreatedBy,name_to_slug(replyCreatedByName),replyCreatedByName,replyGroup,replyCreatedAt,replyLastEdit,replyLastEditBy,replyAvatar,replyClassName,replyLines,replyTag,"","","",0,"",replyLiked,replyLikeCount,"",""}) + replyList = append(replyList, Reply{rid,puser.ID,replyContent,parse_message(replyContent),replyCreatedBy,build_profile_url(name_to_slug(replyCreatedByName),replyCreatedBy),replyCreatedByName,replyGroup,replyCreatedAt,replyLastEdit,replyLastEditBy,replyAvatar,replyClassName,replyLines,replyTag,"","","",0,"",replyLiked,replyLikeCount,"",""}) } err = rows.Err() if err != nil { diff --git a/template_forum.go b/template_forum.go index 0ec937c9..4e457433 100644 --- a/template_forum.go +++ b/template_forum.go @@ -2,8 +2,8 @@ /* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ // +build !no_templategen package main -import "io" import "strconv" +import "io" func init() { template_forum_handle = template_forum @@ -35,35 +35,33 @@ w.Write(header_6) w.Write(header_7) w.Write([]byte(tmpl_forum_vars.CurrentUser.Session)) w.Write(header_8) +if !tmpl_forum_vars.CurrentUser.Is_Super_Mod { +w.Write(header_9) +} +w.Write(header_10) w.Write(menu_0) w.Write([]byte(tmpl_forum_vars.Header.Site.Name)) w.Write(menu_1) if tmpl_forum_vars.CurrentUser.Loggedin { w.Write(menu_2) -w.Write([]byte(tmpl_forum_vars.CurrentUser.Slug)) +w.Write([]byte(tmpl_forum_vars.CurrentUser.Link)) w.Write(menu_3) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.CurrentUser.ID))) +w.Write([]byte(tmpl_forum_vars.CurrentUser.Session)) w.Write(menu_4) -if tmpl_forum_vars.CurrentUser.Is_Super_Mod { +} else { w.Write(menu_5) } w.Write(menu_6) -w.Write([]byte(tmpl_forum_vars.CurrentUser.Session)) -w.Write(menu_7) -} else { -w.Write(menu_8) -} -w.Write(menu_9) -w.Write(header_9) -if tmpl_forum_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_10) -} w.Write(header_11) +if tmpl_forum_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_12) +} +w.Write(header_13) if len(tmpl_forum_vars.Header.NoticeList) != 0 { for _, item := range tmpl_forum_vars.Header.NoticeList { -w.Write(header_12) +w.Write(header_14) w.Write([]byte(item)) -w.Write(header_13) +w.Write(header_15) } } if tmpl_forum_vars.Page > 1 { @@ -123,33 +121,29 @@ w.Write([]byte(strconv.Itoa(item.PostCount))) w.Write(forum_24) w.Write([]byte(item.LastReplyAt)) w.Write(forum_25) -w.Write([]byte(item.Slug)) +w.Write([]byte(item.Link)) w.Write(forum_26) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(forum_27) w.Write([]byte(item.Title)) +w.Write(forum_27) +w.Write([]byte(item.UserLink)) w.Write(forum_28) -w.Write([]byte(item.UserSlug)) -w.Write(forum_29) -w.Write([]byte(strconv.Itoa(item.CreatedBy))) -w.Write(forum_30) w.Write([]byte(item.CreatedByName)) -w.Write(forum_31) +w.Write(forum_29) if item.Is_Closed { -w.Write(forum_32) +w.Write(forum_30) } -w.Write(forum_33) +w.Write(forum_31) } } else { -w.Write(forum_34) +w.Write(forum_32) if tmpl_forum_vars.CurrentUser.Perms.CreateTopic { -w.Write(forum_35) +w.Write(forum_33) w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) +w.Write(forum_34) +} +w.Write(forum_35) +} w.Write(forum_36) -} -w.Write(forum_37) -} -w.Write(forum_38) w.Write(footer_0) if tmpl_forum_vars.Header.Widgets.RightSidebar != "" { w.Write(footer_1) diff --git a/template_forums.go b/template_forums.go index 2b3a1111..6eae71f5 100644 --- a/template_forums.go +++ b/template_forums.go @@ -3,7 +3,6 @@ // +build !no_templategen package main import "io" -import "strconv" func init() { template_forums_handle = template_forums @@ -35,35 +34,33 @@ w.Write(header_6) w.Write(header_7) w.Write([]byte(tmpl_forums_vars.CurrentUser.Session)) w.Write(header_8) +if !tmpl_forums_vars.CurrentUser.Is_Super_Mod { +w.Write(header_9) +} +w.Write(header_10) w.Write(menu_0) w.Write([]byte(tmpl_forums_vars.Header.Site.Name)) w.Write(menu_1) if tmpl_forums_vars.CurrentUser.Loggedin { w.Write(menu_2) -w.Write([]byte(tmpl_forums_vars.CurrentUser.Slug)) +w.Write([]byte(tmpl_forums_vars.CurrentUser.Link)) w.Write(menu_3) -w.Write([]byte(strconv.Itoa(tmpl_forums_vars.CurrentUser.ID))) +w.Write([]byte(tmpl_forums_vars.CurrentUser.Session)) w.Write(menu_4) -if tmpl_forums_vars.CurrentUser.Is_Super_Mod { +} else { w.Write(menu_5) } w.Write(menu_6) -w.Write([]byte(tmpl_forums_vars.CurrentUser.Session)) -w.Write(menu_7) -} else { -w.Write(menu_8) -} -w.Write(menu_9) -w.Write(header_9) -if tmpl_forums_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_10) -} w.Write(header_11) +if tmpl_forums_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_12) +} +w.Write(header_13) if len(tmpl_forums_vars.Header.NoticeList) != 0 { for _, item := range tmpl_forums_vars.Header.NoticeList { -w.Write(header_12) +w.Write(header_14) w.Write([]byte(item)) -w.Write(header_13) +w.Write(header_15) } } w.Write(forums_0) @@ -90,7 +87,7 @@ w.Write([]byte(item.Name)) w.Write(forums_10) } w.Write(forums_11) -w.Write([]byte(item.LastTopicSlug)) +w.Write([]byte(item.LastTopicLink)) w.Write(forums_12) w.Write([]byte(item.LastTopic)) w.Write(forums_13) diff --git a/template_list.go b/template_list.go index 4158b257..80cddd69 100644 --- a/template_list.go +++ b/template_list.go @@ -20,12 +20,16 @@ var header_6 []byte = []byte(`"> `) var header_7 []byte = []byte(` +var header_8 []byte = []byte(`"; +
`) var menu_0 []byte = []byte(`
`) -var header_9 []byte = []byte(` +var header_11 []byte = []byte(`
+var header_12 []byte = []byte(`class="shrink_main"`) +var header_13 []byte = []byte(`> `) -var header_12 []byte = []byte(`
`) -var header_13 []byte = []byte(`
`) +var header_14 []byte = []byte(`
`) +var header_15 []byte = []byte(`
`) var topic_0 []byte = []byte(`
`) -var topic_38 []byte = []byte(``) -var topic_40 []byte = []byte(``) -var topic_42 []byte = []byte(``) -var topic_44 []byte = []byte(` +var topic_33 []byte = []byte(`background-color:/*#eaffea*/#D6FFD6;`) +var topic_34 []byte = []byte(`">`) +var topic_35 []byte = []byte(``) +var topic_37 []byte = []byte(``) +var topic_39 []byte = []byte(``) +var topic_41 []byte = []byte(``) +var topic_43 []byte = []byte(` +var topic_44 []byte = []byte(`?session=`) +var topic_45 []byte = []byte(`&type=topic" class="mod_button report_item" style="font-weight:normal;" title="Flag Topic"> `) -var topic_47 []byte = []byte(``) -var topic_49 []byte = []byte(``) -var topic_50 []byte = []byte(``) -var topic_51 []byte = []byte(``) -var topic_52 []byte = []byte(``) -var topic_53 []byte = []byte(` +var topic_46 []byte = []byte(``) +var topic_48 []byte = []byte(``) +var topic_49 []byte = []byte(``) +var topic_50 []byte = []byte(``) +var topic_51 []byte = []byte(``) +var topic_52 []byte = []byte(`
`) -var topic_54 []byte = []byte(` +var topic_53 []byte = []byte(`
`) -var topic_55 []byte = []byte(` +var topic_54 []byte = []byte(` `) -var topic_56 []byte = []byte(` +var topic_55 []byte = []byte(`
`) -var topic_57 []byte = []byte(` +var topic_56 []byte = []byte(`
+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 `) +var topic_60 []byte = []byte(`-1`) +var topic_61 []byte = []byte(`0px;background-repeat:no-repeat, repeat-y;`) +var topic_62 []byte = []byte(`">

`) -var topic_64 []byte = []byte(`

+var topic_63 []byte = []byte(`

- `) -var topic_67 []byte = []byte(`   + `) +var topic_65 []byte = []byte(`   `) -var topic_68 []byte = []byte(``) -var topic_72 []byte = []byte(``) -var topic_74 []byte = []byte(``) -var topic_76 []byte = []byte(` +var topic_66 []byte = []byte(``) +var topic_70 []byte = []byte(``) +var topic_72 []byte = []byte(``) +var topic_74 []byte = []byte(` +var topic_75 []byte = []byte(`?session=`) +var topic_76 []byte = []byte(`&type=reply" class="mod_button report_item" title="Flag Reply"> `) -var topic_79 []byte = []byte(``) -var topic_81 []byte = []byte(``) -var topic_82 []byte = []byte(``) -var topic_83 []byte = []byte(``) -var topic_84 []byte = []byte(``) -var topic_85 []byte = []byte(` +var topic_77 []byte = []byte(``) +var topic_79 []byte = []byte(``) +var topic_80 []byte = []byte(``) +var topic_81 []byte = []byte(``) +var topic_82 []byte = []byte(``) +var topic_83 []byte = []byte(`
`) -var topic_86 []byte = []byte(`
+var topic_84 []byte = []byte(` `) -var topic_87 []byte = []byte(` +var topic_85 []byte = []byte(`
+var topic_86 []byte = []byte(`' type="hidden" />
@@ -289,119 +288,117 @@ var topic_alt_19 []byte = []byte(`
 
- `) -var topic_alt_23 []byte = []byte(` + `) +var topic_alt_22 []byte = []byte(` `) -var topic_alt_24 []byte = []byte(`
`) -var topic_alt_26 []byte = []byte(`
`) -var topic_alt_28 []byte = []byte(` +var topic_alt_23 []byte = []byte(`
`) +var topic_alt_25 []byte = []byte(`
`) +var topic_alt_27 []byte = []byte(`
`) -var topic_alt_29 []byte = []byte(`
+var topic_alt_28 []byte = []byte(`
+var topic_alt_29 []byte = []byte(`
`) -var topic_alt_31 []byte = []byte(`+1`) -var topic_alt_33 []byte = []byte(`Edit`) -var topic_alt_35 []byte = []byte(`Delete`) -var topic_alt_37 []byte = []byte(`Unpin`) -var topic_alt_39 []byte = []byte(`Pin`) -var topic_alt_41 []byte = []byte(` +var topic_alt_30 []byte = []byte(`+1`) +var topic_alt_32 []byte = []byte(`Edit`) +var topic_alt_34 []byte = []byte(`Delete`) +var topic_alt_36 []byte = []byte(`Unpin`) +var topic_alt_38 []byte = []byte(`Pin`) +var topic_alt_40 []byte = []byte(` Report +var topic_alt_41 []byte = []byte(`?session=`) +var topic_alt_42 []byte = []byte(`&type=topic" class="action_button report_item">Report `) -var topic_alt_44 []byte = []byte(``) -var topic_alt_45 []byte = []byte(``) -var topic_alt_46 []byte = []byte(` +var topic_alt_43 []byte = []byte(``) +var topic_alt_44 []byte = []byte(``) +var topic_alt_45 []byte = []byte(` `) -var topic_alt_47 []byte = []byte(` +var topic_alt_46 []byte = []byte(` `) -var topic_alt_48 []byte = []byte(``) -var topic_alt_49 []byte = []byte(` up`) -var topic_alt_50 []byte = []byte(` +var topic_alt_47 []byte = []byte(``) +var topic_alt_48 []byte = []byte(` up`) +var topic_alt_49 []byte = []byte(`
`) -var topic_alt_51 []byte = []byte(` +var topic_alt_50 []byte = []byte(`
+var topic_alt_51 []byte = []byte(`action_item`) +var topic_alt_52 []byte = []byte(`">
 
- `) -var topic_alt_57 []byte = []byte(` +var topic_alt_53 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;"> 
+ `) +var topic_alt_55 []byte = []byte(` `) -var topic_alt_58 []byte = []byte(`
+var topic_alt_61 []byte = []byte(`style="margin-left: 0px;"`) +var topic_alt_62 []byte = []byte(`> `) -var topic_alt_65 []byte = []byte(` +var topic_alt_63 []byte = []byte(` `) -var topic_alt_66 []byte = []byte(` +var topic_alt_64 []byte = []byte(` `) -var topic_alt_67 []byte = []byte(` +var topic_alt_65 []byte = []byte(` `) -var topic_alt_68 []byte = []byte(` +var topic_alt_66 []byte = []byte(`
`) -var topic_alt_69 []byte = []byte(`
+var topic_alt_67 []byte = []byte(`
`) -var topic_alt_70 []byte = []byte(`+1`) -var topic_alt_72 []byte = []byte(`Edit`) -var topic_alt_74 []byte = []byte(`Delete`) -var topic_alt_76 []byte = []byte(` +var topic_alt_68 []byte = []byte(`+1`) +var topic_alt_70 []byte = []byte(`Edit`) +var topic_alt_72 []byte = []byte(`Delete`) +var topic_alt_74 []byte = []byte(` Report +var topic_alt_75 []byte = []byte(`?session=`) +var topic_alt_76 []byte = []byte(`&type=reply" class="action_button report_item">Report `) -var topic_alt_79 []byte = []byte(``) -var topic_alt_80 []byte = []byte(``) -var topic_alt_81 []byte = []byte(` +var topic_alt_77 []byte = []byte(``) +var topic_alt_78 []byte = []byte(``) +var topic_alt_79 []byte = []byte(` `) -var topic_alt_82 []byte = []byte(` +var topic_alt_80 []byte = []byte(` `) -var topic_alt_83 []byte = []byte(``) -var topic_alt_84 []byte = []byte(` up`) -var topic_alt_85 []byte = []byte(` +var topic_alt_81 []byte = []byte(``) +var topic_alt_82 []byte = []byte(` up`) +var topic_alt_83 []byte = []byte(`
`) -var topic_alt_86 []byte = []byte(` +var topic_alt_84 []byte = []byte(`
`) -var topic_alt_87 []byte = []byte(` +var topic_alt_85 []byte = []byte(` `) -var topic_alt_88 []byte = []byte(` +var topic_alt_86 []byte = []byte(`
+var topic_alt_87 []byte = []byte(`' type="hidden" />
@@ -462,42 +459,44 @@ var profile_17 []byte = []byte(`
`) -var profile_24 []byte = []byte(`

- `) -var profile_27 []byte = []byte(`   +var profile_24 []byte = []byte(` - `) -var profile_28 []byte = []byte(` + + `) +var profile_26 []byte = []byte(`   - `) -var profile_31 []byte = []byte(` + `) +var profile_27 []byte = []byte(` - + `) +var profile_30 []byte = []byte(` - `) -var profile_34 []byte = []byte(``) -var profile_35 []byte = []byte(``) -var profile_36 []byte = []byte(` + + + `) +var profile_33 []byte = []byte(``) +var profile_34 []byte = []byte(``) +var profile_35 []byte = []byte(` +
`) -var profile_37 []byte = []byte(`
+var profile_36 []byte = []byte(` `) -var profile_38 []byte = []byte(` +var profile_37 []byte = []byte(` +var profile_38 []byte = []byte(`' type="hidden" />
@@ -508,7 +507,7 @@ var profile_39 []byte = []byte(`' type="hidden" />
`) -var profile_40 []byte = []byte(` +var profile_39 []byte = []byte(`
`) @@ -538,7 +537,7 @@ var forums_10 []byte = []byte(` var forums_11 []byte = []byte(` - `) var forums_13 []byte = []byte(` `) @@ -573,28 +572,26 @@ var topics_8 []byte = []byte(` replies
var topics_9 []byte = []byte(` - `) -var topics_12 []byte = []byte(` `) -var topics_13 []byte = []byte(``) -var topics_15 []byte = []byte(``) -var topics_16 []byte = []byte(` -
Starter: `) -var topics_19 []byte = []byte(` + `) +var topics_11 []byte = []byte(` `) +var topics_12 []byte = []byte(``) +var topics_14 []byte = []byte(``) +var topics_15 []byte = []byte(` +
Starter: `) +var topics_17 []byte = []byte(` `) -var topics_20 []byte = []byte(` | 🔒︎`) -var topics_21 []byte = []byte(` +var topics_18 []byte = []byte(` | 🔒︎`) +var topics_19 []byte = []byte(`
`) -var topics_22 []byte = []byte(`
There aren't any topics yet.`) -var topics_23 []byte = []byte(` Start one?`) -var topics_24 []byte = []byte(`
`) -var topics_25 []byte = []byte(` +var topics_20 []byte = []byte(`
There aren't any topics yet.`) +var topics_21 []byte = []byte(` Start one?`) +var topics_22 []byte = []byte(`
`) +var topics_23 []byte = []byte(` `) var forum_0 []byte = []byte(`
`) -var forum_28 []byte = []byte(` -
Starter: `) -var forum_31 []byte = []byte(` + `) +var forum_27 []byte = []byte(` +
Starter: `) +var forum_29 []byte = []byte(` `) -var forum_32 []byte = []byte(` | 🔒︎`) -var forum_33 []byte = []byte(` +var forum_30 []byte = []byte(` | 🔒︎`) +var forum_31 []byte = []byte(`
`) -var forum_34 []byte = []byte(`
There aren't any topics in this forum yet.`) -var forum_35 []byte = []byte(` Start one?`) -var forum_37 []byte = []byte(`
`) -var forum_38 []byte = []byte(` +var forum_32 []byte = []byte(`
There aren't any topics in this forum yet.`) +var forum_33 []byte = []byte(` Start one?`) +var forum_35 []byte = []byte(`
`) +var forum_36 []byte = []byte(` `) diff --git a/template_profile.go b/template_profile.go index 85702831..0b1f0f1c 100644 --- a/template_profile.go +++ b/template_profile.go @@ -35,35 +35,33 @@ w.Write(header_6) w.Write(header_7) w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) w.Write(header_8) +if !tmpl_profile_vars.CurrentUser.Is_Super_Mod { +w.Write(header_9) +} +w.Write(header_10) w.Write(menu_0) w.Write([]byte(tmpl_profile_vars.Header.Site.Name)) w.Write(menu_1) if tmpl_profile_vars.CurrentUser.Loggedin { w.Write(menu_2) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Slug)) +w.Write([]byte(tmpl_profile_vars.CurrentUser.Link)) w.Write(menu_3) -w.Write([]byte(strconv.Itoa(tmpl_profile_vars.CurrentUser.ID))) +w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) w.Write(menu_4) -if tmpl_profile_vars.CurrentUser.Is_Super_Mod { +} else { w.Write(menu_5) } w.Write(menu_6) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(menu_7) -} else { -w.Write(menu_8) -} -w.Write(menu_9) -w.Write(header_9) -if tmpl_profile_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_10) -} w.Write(header_11) +if tmpl_profile_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_12) +} +w.Write(header_13) if len(tmpl_profile_vars.Header.NoticeList) != 0 { for _, item := range tmpl_profile_vars.Header.NoticeList { -w.Write(header_12) +w.Write(header_14) w.Write([]byte(item)) -w.Write(header_13) +w.Write(header_15) } } w.Write(profile_0) @@ -116,39 +114,37 @@ w.Write(profile_22) w.Write(profile_23) w.Write([]byte(item.ContentHtml)) w.Write(profile_24) -w.Write([]byte(item.UserSlug)) +w.Write([]byte(item.UserLink)) w.Write(profile_25) -w.Write([]byte(strconv.Itoa(item.CreatedBy))) -w.Write(profile_26) w.Write([]byte(item.CreatedByName)) -w.Write(profile_27) +w.Write(profile_26) if tmpl_profile_vars.CurrentUser.Is_Mod { +w.Write(profile_27) +w.Write([]byte(strconv.Itoa(item.ID))) w.Write(profile_28) w.Write([]byte(strconv.Itoa(item.ID))) w.Write(profile_29) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(profile_30) } -w.Write(profile_31) +w.Write(profile_30) w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(profile_32) +w.Write(profile_31) w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_33) +w.Write(profile_32) if item.Tag != "" { -w.Write(profile_34) +w.Write(profile_33) w.Write([]byte(item.Tag)) +w.Write(profile_34) +} w.Write(profile_35) } +} w.Write(profile_36) -} -} -w.Write(profile_37) if !tmpl_profile_vars.CurrentUser.Is_Banned { -w.Write(profile_38) +w.Write(profile_37) w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) -w.Write(profile_39) +w.Write(profile_38) } -w.Write(profile_40) +w.Write(profile_39) w.Write(footer_0) if tmpl_profile_vars.Header.Widgets.RightSidebar != "" { w.Write(footer_1) diff --git a/template_topic.go b/template_topic.go index 6b749b2c..0ab5aa86 100644 --- a/template_topic.go +++ b/template_topic.go @@ -35,35 +35,33 @@ w.Write(header_6) w.Write(header_7) w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) w.Write(header_8) +if !tmpl_topic_vars.CurrentUser.Is_Super_Mod { +w.Write(header_9) +} +w.Write(header_10) w.Write(menu_0) w.Write([]byte(tmpl_topic_vars.Header.Site.Name)) w.Write(menu_1) if tmpl_topic_vars.CurrentUser.Loggedin { w.Write(menu_2) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Slug)) +w.Write([]byte(tmpl_topic_vars.CurrentUser.Link)) w.Write(menu_3) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.CurrentUser.ID))) +w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) w.Write(menu_4) -if tmpl_topic_vars.CurrentUser.Is_Super_Mod { +} else { w.Write(menu_5) } w.Write(menu_6) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(menu_7) -} else { -w.Write(menu_8) -} -w.Write(menu_9) -w.Write(header_9) -if tmpl_topic_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_10) -} w.Write(header_11) +if tmpl_topic_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_12) +} +w.Write(header_13) if len(tmpl_topic_vars.Header.NoticeList) != 0 { for _, item := range tmpl_topic_vars.Header.NoticeList { -w.Write(header_12) +w.Write(header_14) w.Write([]byte(item)) -w.Write(header_13) +w.Write(header_15) } } w.Write(topic_0) @@ -127,139 +125,135 @@ w.Write([]byte(tmpl_topic_vars.Topic.Content)) w.Write(topic_27) w.Write([]byte(tmpl_topic_vars.Topic.Content)) w.Write(topic_28) -w.Write([]byte(tmpl_topic_vars.Topic.UserSlug)) +w.Write([]byte(tmpl_topic_vars.Topic.UserLink)) w.Write(topic_29) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.CreatedBy))) -w.Write(topic_30) w.Write([]byte(tmpl_topic_vars.Topic.CreatedByName)) -w.Write(topic_31) +w.Write(topic_30) if tmpl_topic_vars.CurrentUser.Perms.LikeItem { -w.Write(topic_32) +w.Write(topic_31) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_33) +w.Write(topic_32) if tmpl_topic_vars.Topic.Liked { +w.Write(topic_33) +} w.Write(topic_34) } -w.Write(topic_35) -} if tmpl_topic_vars.CurrentUser.Perms.EditTopic { -w.Write(topic_36) +w.Write(topic_35) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_37) +w.Write(topic_36) } if tmpl_topic_vars.CurrentUser.Perms.DeleteTopic { -w.Write(topic_38) +w.Write(topic_37) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_39) +w.Write(topic_38) } if tmpl_topic_vars.CurrentUser.Perms.PinTopic { if tmpl_topic_vars.Topic.Sticky { +w.Write(topic_39) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_40) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_41) } else { +w.Write(topic_41) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_42) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +} +} w.Write(topic_43) -} -} -w.Write(topic_44) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_45) +w.Write(topic_44) w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_46) +w.Write(topic_45) if tmpl_topic_vars.Topic.LikeCount > 0 { -w.Write(topic_47) +w.Write(topic_46) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.LikeCount))) -w.Write(topic_48) +w.Write(topic_47) } if tmpl_topic_vars.Topic.Tag != "" { -w.Write(topic_49) +w.Write(topic_48) w.Write([]byte(tmpl_topic_vars.Topic.Tag)) -w.Write(topic_50) +w.Write(topic_49) } else { -w.Write(topic_51) +w.Write(topic_50) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level))) -w.Write(topic_52) +w.Write(topic_51) } -w.Write(topic_53) +w.Write(topic_52) if len(tmpl_topic_vars.ItemList) != 0 { for _, item := range tmpl_topic_vars.ItemList { if item.ActionType != "" { -w.Write(topic_54) +w.Write(topic_53) w.Write([]byte(item.ActionIcon)) -w.Write(topic_55) +w.Write(topic_54) w.Write([]byte(item.ActionType)) -w.Write(topic_56) +w.Write(topic_55) } else { -w.Write(topic_57) +w.Write(topic_56) w.Write([]byte(item.ClassName)) -w.Write(topic_58) +w.Write(topic_57) if item.Avatar != "" { -w.Write(topic_59) +w.Write(topic_58) w.Write([]byte(item.Avatar)) -w.Write(topic_60) +w.Write(topic_59) if item.ContentLines <= 5 { +w.Write(topic_60) +} w.Write(topic_61) } w.Write(topic_62) -} -w.Write(topic_63) w.Write([]byte(item.ContentHtml)) +w.Write(topic_63) +w.Write([]byte(item.UserLink)) w.Write(topic_64) -w.Write([]byte(item.UserSlug)) -w.Write(topic_65) -w.Write([]byte(strconv.Itoa(item.CreatedBy))) -w.Write(topic_66) w.Write([]byte(item.CreatedByName)) -w.Write(topic_67) +w.Write(topic_65) if tmpl_topic_vars.CurrentUser.Perms.LikeItem { -w.Write(topic_68) +w.Write(topic_66) w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_69) +w.Write(topic_67) if item.Liked { -w.Write(topic_70) +w.Write(topic_68) } -w.Write(topic_71) +w.Write(topic_69) } if tmpl_topic_vars.CurrentUser.Perms.EditReply { +w.Write(topic_70) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_71) +} +if tmpl_topic_vars.CurrentUser.Perms.DeleteReply { w.Write(topic_72) w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_73) } -if tmpl_topic_vars.CurrentUser.Perms.DeleteReply { w.Write(topic_74) w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_75) -} -w.Write(topic_76) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_77) w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_78) +w.Write(topic_76) if item.LikeCount > 0 { -w.Write(topic_79) +w.Write(topic_77) w.Write([]byte(strconv.Itoa(item.LikeCount))) -w.Write(topic_80) +w.Write(topic_78) } if item.Tag != "" { -w.Write(topic_81) +w.Write(topic_79) w.Write([]byte(item.Tag)) -w.Write(topic_82) +w.Write(topic_80) } else { -w.Write(topic_83) +w.Write(topic_81) w.Write([]byte(strconv.Itoa(item.Level))) +w.Write(topic_82) +} +w.Write(topic_83) +} +} +} w.Write(topic_84) -} -w.Write(topic_85) -} -} -} -w.Write(topic_86) if tmpl_topic_vars.CurrentUser.Perms.CreateReply { -w.Write(topic_87) +w.Write(topic_85) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_88) +w.Write(topic_86) } w.Write(footer_0) if tmpl_topic_vars.Header.Widgets.RightSidebar != "" { diff --git a/template_topic_alt.go b/template_topic_alt.go index a9927c0f..56f891f1 100644 --- a/template_topic_alt.go +++ b/template_topic_alt.go @@ -35,35 +35,33 @@ w.Write(header_6) w.Write(header_7) w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) w.Write(header_8) +if !tmpl_topic_alt_vars.CurrentUser.Is_Super_Mod { +w.Write(header_9) +} +w.Write(header_10) w.Write(menu_0) w.Write([]byte(tmpl_topic_alt_vars.Header.Site.Name)) w.Write(menu_1) if tmpl_topic_alt_vars.CurrentUser.Loggedin { w.Write(menu_2) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Slug)) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Link)) w.Write(menu_3) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.CurrentUser.ID))) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) w.Write(menu_4) -if tmpl_topic_alt_vars.CurrentUser.Is_Super_Mod { +} else { w.Write(menu_5) } w.Write(menu_6) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(menu_7) -} else { -w.Write(menu_8) -} -w.Write(menu_9) -w.Write(header_9) -if tmpl_topic_alt_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_10) -} w.Write(header_11) +if tmpl_topic_alt_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_12) +} +w.Write(header_13) if len(tmpl_topic_alt_vars.Header.NoticeList) != 0 { for _, item := range tmpl_topic_alt_vars.Header.NoticeList { -w.Write(header_12) +w.Write(header_14) w.Write([]byte(item)) -w.Write(header_13) +w.Write(header_15) } } if tmpl_topic_alt_vars.Page > 1 { @@ -112,157 +110,153 @@ w.Write(topic_alt_18) w.Write(topic_alt_19) w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar)) w.Write(topic_alt_20) -w.Write([]byte(tmpl_topic_alt_vars.Topic.UserSlug)) +w.Write([]byte(tmpl_topic_alt_vars.Topic.UserLink)) w.Write(topic_alt_21) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.CreatedBy))) -w.Write(topic_alt_22) w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName)) -w.Write(topic_alt_23) +w.Write(topic_alt_22) if tmpl_topic_alt_vars.Topic.Tag != "" { -w.Write(topic_alt_24) +w.Write(topic_alt_23) w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag)) -w.Write(topic_alt_25) +w.Write(topic_alt_24) } else { -w.Write(topic_alt_26) +w.Write(topic_alt_25) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level))) -w.Write(topic_alt_27) +w.Write(topic_alt_26) } +w.Write(topic_alt_27) +w.Write([]byte(tmpl_topic_alt_vars.Topic.Content)) w.Write(topic_alt_28) w.Write([]byte(tmpl_topic_alt_vars.Topic.Content)) w.Write(topic_alt_29) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Content)) -w.Write(topic_alt_30) if tmpl_topic_alt_vars.CurrentUser.Loggedin { if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem { -w.Write(topic_alt_31) +w.Write(topic_alt_30) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_32) +w.Write(topic_alt_31) } if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic { -w.Write(topic_alt_33) +w.Write(topic_alt_32) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_34) +w.Write(topic_alt_33) } if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteTopic { -w.Write(topic_alt_35) +w.Write(topic_alt_34) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_36) +w.Write(topic_alt_35) } if tmpl_topic_alt_vars.CurrentUser.Perms.PinTopic { if tmpl_topic_alt_vars.Topic.Sticky { +w.Write(topic_alt_36) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) w.Write(topic_alt_37) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_38) } else { +w.Write(topic_alt_38) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) w.Write(topic_alt_39) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +} +} w.Write(topic_alt_40) -} -} -w.Write(topic_alt_41) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_42) +w.Write(topic_alt_41) w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_43) +w.Write(topic_alt_42) if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { -w.Write(topic_alt_44) +w.Write(topic_alt_43) w.Write([]byte(tmpl_topic_alt_vars.Topic.IpAddress)) +w.Write(topic_alt_44) +} +} w.Write(topic_alt_45) -} -} -w.Write(topic_alt_46) w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedAt)) -w.Write(topic_alt_47) +w.Write(topic_alt_46) if tmpl_topic_alt_vars.Topic.LikeCount > 0 { -w.Write(topic_alt_48) +w.Write(topic_alt_47) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.LikeCount))) -w.Write(topic_alt_49) +w.Write(topic_alt_48) } -w.Write(topic_alt_50) +w.Write(topic_alt_49) if len(tmpl_topic_alt_vars.ItemList) != 0 { for _, item := range tmpl_topic_alt_vars.ItemList { -w.Write(topic_alt_51) +w.Write(topic_alt_50) if item.ActionType != "" { -w.Write(topic_alt_52) +w.Write(topic_alt_51) } -w.Write(topic_alt_53) +w.Write(topic_alt_52) w.Write([]byte(item.Avatar)) +w.Write(topic_alt_53) +w.Write([]byte(item.UserLink)) w.Write(topic_alt_54) -w.Write([]byte(item.UserSlug)) -w.Write(topic_alt_55) -w.Write([]byte(strconv.Itoa(item.CreatedBy))) -w.Write(topic_alt_56) w.Write([]byte(item.CreatedByName)) -w.Write(topic_alt_57) +w.Write(topic_alt_55) if item.Tag != "" { -w.Write(topic_alt_58) +w.Write(topic_alt_56) w.Write([]byte(item.Tag)) -w.Write(topic_alt_59) +w.Write(topic_alt_57) } else { -w.Write(topic_alt_60) +w.Write(topic_alt_58) w.Write([]byte(strconv.Itoa(item.Level))) +w.Write(topic_alt_59) +} +w.Write(topic_alt_60) +if item.ActionType != "" { w.Write(topic_alt_61) } w.Write(topic_alt_62) if item.ActionType != "" { w.Write(topic_alt_63) -} -w.Write(topic_alt_64) -if item.ActionType != "" { -w.Write(topic_alt_65) w.Write([]byte(item.ActionIcon)) -w.Write(topic_alt_66) +w.Write(topic_alt_64) w.Write([]byte(item.ActionType)) -w.Write(topic_alt_67) +w.Write(topic_alt_65) } else { -w.Write(topic_alt_68) +w.Write(topic_alt_66) w.Write([]byte(item.ContentHtml)) -w.Write(topic_alt_69) +w.Write(topic_alt_67) if tmpl_topic_alt_vars.CurrentUser.Loggedin { if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem { +w.Write(topic_alt_68) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_alt_69) +} +if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply { w.Write(topic_alt_70) w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_alt_71) } -if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply { +if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply { w.Write(topic_alt_72) w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_alt_73) } -if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply { w.Write(topic_alt_74) w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_alt_75) -} -w.Write(topic_alt_76) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_alt_77) w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_78) +w.Write(topic_alt_76) if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { -w.Write(topic_alt_79) +w.Write(topic_alt_77) w.Write([]byte(item.IpAddress)) -w.Write(topic_alt_80) +w.Write(topic_alt_78) } } -w.Write(topic_alt_81) +w.Write(topic_alt_79) w.Write([]byte(item.CreatedAt)) -w.Write(topic_alt_82) +w.Write(topic_alt_80) if item.LikeCount > 0 { -w.Write(topic_alt_83) +w.Write(topic_alt_81) w.Write([]byte(strconv.Itoa(item.LikeCount))) +w.Write(topic_alt_82) +} +w.Write(topic_alt_83) +} w.Write(topic_alt_84) } +} w.Write(topic_alt_85) -} -w.Write(topic_alt_86) -} -} -w.Write(topic_alt_87) if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply { -w.Write(topic_alt_88) +w.Write(topic_alt_86) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_89) +w.Write(topic_alt_87) } w.Write(footer_0) if tmpl_topic_alt_vars.Header.Widgets.RightSidebar != "" { diff --git a/template_topics.go b/template_topics.go index c934e1ae..211401af 100644 --- a/template_topics.go +++ b/template_topics.go @@ -35,35 +35,33 @@ w.Write(header_6) w.Write(header_7) w.Write([]byte(tmpl_topics_vars.CurrentUser.Session)) w.Write(header_8) +if !tmpl_topics_vars.CurrentUser.Is_Super_Mod { +w.Write(header_9) +} +w.Write(header_10) w.Write(menu_0) w.Write([]byte(tmpl_topics_vars.Header.Site.Name)) w.Write(menu_1) if tmpl_topics_vars.CurrentUser.Loggedin { w.Write(menu_2) -w.Write([]byte(tmpl_topics_vars.CurrentUser.Slug)) +w.Write([]byte(tmpl_topics_vars.CurrentUser.Link)) w.Write(menu_3) -w.Write([]byte(strconv.Itoa(tmpl_topics_vars.CurrentUser.ID))) +w.Write([]byte(tmpl_topics_vars.CurrentUser.Session)) w.Write(menu_4) -if tmpl_topics_vars.CurrentUser.Is_Super_Mod { +} else { w.Write(menu_5) } w.Write(menu_6) -w.Write([]byte(tmpl_topics_vars.CurrentUser.Session)) -w.Write(menu_7) -} else { -w.Write(menu_8) -} -w.Write(menu_9) -w.Write(header_9) -if tmpl_topics_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_10) -} w.Write(header_11) +if tmpl_topics_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_12) +} +w.Write(header_13) if len(tmpl_topics_vars.Header.NoticeList) != 0 { for _, item := range tmpl_topics_vars.Header.NoticeList { -w.Write(header_12) +w.Write(header_14) w.Write([]byte(item)) -w.Write(header_13) +w.Write(header_15) } } w.Write(topics_0) @@ -88,39 +86,35 @@ w.Write([]byte(strconv.Itoa(item.PostCount))) w.Write(topics_8) w.Write([]byte(item.LastReplyAt)) w.Write(topics_9) -w.Write([]byte(item.Slug)) +w.Write([]byte(item.Link)) w.Write(topics_10) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topics_11) w.Write([]byte(item.Title)) -w.Write(topics_12) +w.Write(topics_11) if item.ForumName != "" { -w.Write(topics_13) +w.Write(topics_12) w.Write([]byte(item.ForumLink)) -w.Write(topics_14) +w.Write(topics_13) w.Write([]byte(item.ForumName)) +w.Write(topics_14) +} w.Write(topics_15) -} +w.Write([]byte(item.UserLink)) w.Write(topics_16) -w.Write([]byte(item.UserSlug)) -w.Write(topics_17) -w.Write([]byte(strconv.Itoa(item.CreatedBy))) -w.Write(topics_18) w.Write([]byte(item.CreatedByName)) -w.Write(topics_19) +w.Write(topics_17) if item.Is_Closed { -w.Write(topics_20) +w.Write(topics_18) } -w.Write(topics_21) +w.Write(topics_19) } } else { -w.Write(topics_22) +w.Write(topics_20) if tmpl_topics_vars.CurrentUser.Perms.CreateTopic { +w.Write(topics_21) +} +w.Write(topics_22) +} w.Write(topics_23) -} -w.Write(topics_24) -} -w.Write(topics_25) w.Write(footer_0) if tmpl_topics_vars.Header.Widgets.RightSidebar != "" { w.Write(footer_1) diff --git a/templates.go b/templates.go index c31e85db..4bdf5a21 100644 --- a/templates.go +++ b/templates.go @@ -78,7 +78,6 @@ func (c *CTemplateSet) compile_template(name string, dir string, expects string, c.importMap = map[string]string{ "io":"io", - "strconv":"strconv", } c.varList = varList //c.pVarList = "" @@ -889,6 +888,7 @@ func (c *CTemplateSet) compile_varsub(varname string, val reflect.Value) string switch val.Kind() { case reflect.Int: + c.importMap["strconv"] = "strconv" return "w.Write([]byte(strconv.Itoa(" + varname + ")))\n" case reflect.Bool: return "if " + varname + " {\nw.Write([]byte(\"true\"))} else {\nw.Write([]byte(\"false\"))\n}\n" @@ -899,6 +899,7 @@ func (c *CTemplateSet) compile_varsub(varname string, val reflect.Value) string return "w.Write([]byte(" + varname + "))\n" } case reflect.Int64: + c.importMap["strconv"] = "strconv" return "w.Write([]byte(strconv.FormatInt(" + varname + ", 10)))" default: if !val.IsValid() { diff --git a/templates/forum.html b/templates/forum.html index aef5f944..9c798209 100644 --- a/templates/forum.html +++ b/templates/forum.html @@ -21,8 +21,8 @@ {{.LastReplyAt}} - {{.Title}} -
Starter: {{.CreatedByName}} + {{.Title}} +
Starter: {{.CreatedByName}} {{if .Is_Closed}} | 🔒︎{{end}}
diff --git a/templates/forums.html b/templates/forums.html index 56a1953e..a4d6a2fe 100644 --- a/templates/forums.html +++ b/templates/forums.html @@ -13,7 +13,7 @@ {{end}} - {{.LastTopic}} + {{.LastTopic}} {{if .LastTopicTime}}
{{.LastTopicTime}}{{end}}
diff --git a/templates/header.html b/templates/header.html index b008783a..bc3988cd 100644 --- a/templates/header.html +++ b/templates/header.html @@ -10,12 +10,14 @@ {{range .Header.Scripts}} {{end}} - + +
{{template "menu.html" .}}
diff --git a/templates/menu.html b/templates/menu.html index a8f908ba..34b1a34e 100644 --- a/templates/menu.html +++ b/templates/menu.html @@ -14,8 +14,8 @@ {{if .CurrentUser.Loggedin}} - - {{if .CurrentUser.Is_Super_Mod}}{{end}} + + {{else}} diff --git a/templates/profile.html b/templates/profile.html index 440d3f27..21adeaf8 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -29,17 +29,20 @@
{{range .ItemList}} -
- {{.ContentHtml}}

- {{.CreatedByName}}   +
+ {{.ContentHtml}} - {{if $.CurrentUser.Is_Mod}} + + {{.CreatedByName}}   - {{end}} + {{if $.CurrentUser.Is_Mod}} - + {{end}} - {{if .Tag}}{{.Tag}}{{end}} + + + {{if .Tag}}{{.Tag}}{{end}} +
{{end}}
diff --git a/templates/socialgroups_view_group.html b/templates/socialgroups_view_group.html index ca4a80f0..eca32260 100644 --- a/templates/socialgroups_view_group.html +++ b/templates/socialgroups_view_group.html @@ -25,8 +25,8 @@ {{.LastReplyAt}} - {{.Title}} -
Starter: {{.CreatedByName}} + {{.Title}} +
Starter: {{.CreatedByName}} {{if .Is_Closed}} | 🔒︎{{end}}
diff --git a/templates/topic.html b/templates/topic.html index e5fc1ce7..21e1a636 100644 --- a/templates/topic.html +++ b/templates/topic.html @@ -30,7 +30,7 @@ - {{.Topic.CreatedByName}}   + {{.Topic.CreatedByName}}   {{if .CurrentUser.Perms.LikeItem}} {{end}} @@ -59,7 +59,7 @@ - {{.CreatedByName}}   + {{.CreatedByName}}   {{if $.CurrentUser.Perms.LikeItem}}{{end}} {{if $.CurrentUser.Perms.EditReply}}{{end}} diff --git a/templates/topic_alt.html b/templates/topic_alt.html index e552f1f6..3467b984 100644 --- a/templates/topic_alt.html +++ b/templates/topic_alt.html @@ -25,7 +25,7 @@
 
- {{.Topic.CreatedByName}} + {{.Topic.CreatedByName}} {{if .Topic.Tag}}
{{else}}
{{end}}
@@ -50,7 +50,7 @@
 
- {{.CreatedByName}} + {{.CreatedByName}} {{if .Tag}}
{{else}}
{{end}}
diff --git a/templates/topics.html b/templates/topics.html index 66a11cc5..28592ff7 100644 --- a/templates/topics.html +++ b/templates/topics.html @@ -9,8 +9,8 @@ {{.LastReplyAt}} - {{.Title}} {{if .ForumName}}{{.ForumName}}{{end}} -
Starter: {{.CreatedByName}} + {{.Title}} {{if .ForumName}}{{.ForumName}}{{end}} +
Starter: {{.CreatedByName}} {{if .Is_Closed}} | 🔒︎{{end}}
diff --git a/themes/cosmo-conflux/public/main.css b/themes/cosmo-conflux/public/main.css index 02c625bc..7d1e0a22 100644 --- a/themes/cosmo-conflux/public/main.css +++ b/themes/cosmo-conflux/public/main.css @@ -467,6 +467,12 @@ button .big { padding: 6px; }*/ padding-bottom: 3px; } +#profile_comments .rowitem { + background-repeat: no-repeat, repeat-y; + background-size: 128px; + padding-left: 136px; +} + .postQuote { padding: 5px; border: 1px solid rgb(200,200,200); diff --git a/themes/cosmo/public/main.css b/themes/cosmo/public/main.css index 6b9395b0..c5471386 100644 --- a/themes/cosmo/public/main.css +++ b/themes/cosmo/public/main.css @@ -447,6 +447,12 @@ button .big { padding: 6px; }*/ padding-bottom: 3px; } +#profile_comments .rowitem { + background-repeat: no-repeat, repeat-y; + background-size: 128px; + padding-left: 136px; +} + .postQuote { border-radius: 4px; padding: 5px; diff --git a/themes/shadow/public/main.css b/themes/shadow/public/main.css index f11a8ae9..1e1e8b3b 100644 --- a/themes/shadow/public/main.css +++ b/themes/shadow/public/main.css @@ -446,6 +446,12 @@ input, select, textarea { .simple .user_tag { font-size: 14px; } +/* TO-DO: Have a has_avatar class for profile comments and topic replies to allow posts without avatars? Won't that look inconsistent next to everything else for just about every theme though? */ +#profile_comments .rowitem { + background-repeat: no-repeat, repeat-y; + background-size: 128px; + padding-left: 136px; +} @media(max-width: 935px) { .simple .user_tag { @@ -530,16 +536,50 @@ input, select, textarea { } } -@media(max-width: 470px) { - .menu_create_topic { +@media(max-width: 520px) { + .user_tag, .level_label, .level { display: none; } + #profile_left_lane { + width: 100px; + } + #profile_comments .rowitem { + background-size: 80px; + padding-left: calc(80px + 12px); + } + #profile_left_lane .avatarRow { + max-height: 100px; + } + #profile_right_lane { + width: calc(100% - 125px); + } +} + +@media(max-width: 470px) { + .menu_create_topic, .like_count_label, .like_count { + display: none; + } + .post_item { + background-size: 100px; + padding-left: calc(100px + 12px); + } } @media(max-width: 370px) { .menu_profile { display: none; } + .post_item { + background-size: 80px; + padding-left: calc(80px + 12px); + } + .controls { + margin-top: 14px; + } + #profile_comments .rowitem { + background-image: none !important; + padding-left: 10px !important; + } } @media(max-width: 324px) { diff --git a/themes/shadow/shadow.png b/themes/shadow/shadow.png new file mode 100644 index 00000000..b4fef731 Binary files /dev/null and b/themes/shadow/shadow.png differ diff --git a/themes/shadow/theme.json b/themes/shadow/theme.json index cf8957f7..ce6ad87f 100644 --- a/themes/shadow/theme.json +++ b/themes/shadow/theme.json @@ -3,6 +3,7 @@ "FriendlyName": "Shadow", "Version": "0.0.1", "Creator": "Azareal", + "FullImage": "shadow.png", "URL": "github.com/Azareal/Gosora", "Tag": "WIP" } diff --git a/themes/tempra-conflux/public/main.css b/themes/tempra-conflux/public/main.css index a47fb407..9ed14692 100644 --- a/themes/tempra-conflux/public/main.css +++ b/themes/tempra-conflux/public/main.css @@ -473,6 +473,12 @@ button.username { background: none; } +#profile_comments .rowitem { + background-repeat: no-repeat, repeat-y; + background-size: 128px; + padding-left: 136px; +} + .simple { background-color: white; } diff --git a/themes/tempra-cursive/public/main.css b/themes/tempra-cursive/public/main.css index b936c0e5..e751f1d4 100644 --- a/themes/tempra-cursive/public/main.css +++ b/themes/tempra-cursive/public/main.css @@ -520,6 +520,12 @@ button.username { font-size: 12px; } +#profile_comments .rowitem { + background-repeat: no-repeat, repeat-y; + background-size: 128px; + padding-left: 136px; +} + /* Media Queries */ @media(min-width: 881px) { diff --git a/themes/tempra-simple/public/main.css b/themes/tempra-simple/public/main.css index bb4b175b..e03f83e2 100644 --- a/themes/tempra-simple/public/main.css +++ b/themes/tempra-simple/public/main.css @@ -553,4 +553,10 @@ button.username { top: -2px; } +#profile_comments .rowitem { + background-repeat: no-repeat, repeat-y; + background-size: 128px; + padding-left: 136px; +} + {{template "media.partial.css" }} diff --git a/topic.go b/topic.go index 67c6bc70..a8dac952 100644 --- a/topic.go +++ b/topic.go @@ -6,7 +6,7 @@ import "html/template" type Topic struct { ID int - Slug string + Link string Title string Content string CreatedBy int @@ -27,7 +27,7 @@ type Topic struct type TopicUser struct { ID int - Slug string + Link string Title string Content string CreatedBy int @@ -44,7 +44,7 @@ type TopicUser struct ClassName string Data string // Used for report metadata - UserSlug string + UserLink string CreatedByName string Group int Avatar string @@ -60,7 +60,7 @@ type TopicUser struct type TopicsRow struct { ID int - Slug string + Link string Title string Content string CreatedBy int @@ -76,7 +76,7 @@ type TopicsRow struct LikeCount int ClassName string - UserSlug string + UserLink string CreatedByName string Avatar string Css template.CSS @@ -120,10 +120,10 @@ func get_topicuser(tid int) (TopicUser,error) { tu := TopicUser{ID:tid} err := get_topic_user_stmt.QueryRow(tid).Scan(&tu.Title, &tu.Content, &tu.CreatedBy, &tu.CreatedAt, &tu.Is_Closed, &tu.Sticky, &tu.ParentID, &tu.IpAddress, &tu.PostCount, &tu.LikeCount, &tu.CreatedByName, &tu.Avatar, &tu.Group, &tu.URLPrefix, &tu.URLName, &tu.Level) - tu.Slug = name_to_slug(tu.Title) - tu.UserSlug = name_to_slug(tu.CreatedByName) + tu.Link = build_topic_url(name_to_slug(tu.Title),tu.ID) + tu.UserLink = build_profile_url(name_to_slug(tu.CreatedByName),tu.CreatedBy) - the_topic := Topic{ID:tu.ID, Slug:tu.Slug, Title:tu.Title, Content:tu.Content, CreatedBy:tu.CreatedBy, Is_Closed:tu.Is_Closed, Sticky:tu.Sticky, CreatedAt:tu.CreatedAt, LastReplyAt:tu.LastReplyAt, ParentID:tu.ParentID, IpAddress:tu.IpAddress, PostCount:tu.PostCount, LikeCount:tu.LikeCount} + the_topic := Topic{ID:tu.ID, Link:tu.Link, Title:tu.Title, Content:tu.Content, CreatedBy:tu.CreatedBy, Is_Closed:tu.Is_Closed, Sticky:tu.Sticky, CreatedAt:tu.CreatedAt, LastReplyAt:tu.LastReplyAt, ParentID:tu.ParentID, IpAddress:tu.IpAddress, PostCount:tu.PostCount, LikeCount:tu.LikeCount} //fmt.Printf("%+v\n", the_topic) tu.Tag = groups[tu.Group].Tag topics.Add(&the_topic) @@ -131,7 +131,7 @@ func get_topicuser(tid int) (TopicUser,error) { } func copy_topic_to_topicuser(topic *Topic, user *User) (tu TopicUser) { - tu.UserSlug = user.Slug + tu.UserLink = user.Link tu.CreatedByName = user.Name tu.Group = user.Group tu.Avatar = user.Avatar @@ -140,7 +140,7 @@ func copy_topic_to_topicuser(topic *Topic, user *User) (tu TopicUser) { tu.Level = user.Level tu.ID = topic.ID - tu.Slug = topic.Slug + tu.Link = topic.Link tu.Title = topic.Title tu.Content = topic.Content tu.CreatedBy = topic.CreatedBy @@ -160,7 +160,7 @@ func copy_topic_to_topicuser(topic *Topic, user *User) (tu TopicUser) { func get_topic_by_reply(rid int) (*Topic, error) { topic := Topic{ID:0} err := get_topic_by_reply_stmt.QueryRow(rid).Scan(&topic.ID, &topic.Title, &topic.Content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.LikeCount, &topic.Data) - topic.Slug = name_to_slug(topic.Title) + topic.Link = build_topic_url(name_to_slug(topic.Title),topic.ID) return &topic, err } diff --git a/topic_store.go b/topic_store.go index 8e766486..eb22adbd 100644 --- a/topic_store.go +++ b/topic_store.go @@ -73,7 +73,7 @@ func (sts *MemoryTopicStore) CascadeGet(id int) (*Topic, error) { topic = &Topic{ID:id} err := sts.get.QueryRow(id).Scan(&topic.Title, &topic.Content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.LikeCount, &topic.Data) if err == nil { - topic.Slug = name_to_slug(topic.Title) + topic.Link = build_topic_url(name_to_slug(topic.Title),id) sts.Add(topic) } return topic, err @@ -82,7 +82,7 @@ func (sts *MemoryTopicStore) CascadeGet(id int) (*Topic, error) { func (sts *MemoryTopicStore) BypassGet(id int) (*Topic, error) { topic := &Topic{ID:id} err := sts.get.QueryRow(id).Scan(&topic.Title, &topic.Content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.LikeCount, &topic.Data) - topic.Slug = name_to_slug(topic.Title) + topic.Link = build_topic_url(name_to_slug(topic.Title),id) return topic, err } @@ -90,7 +90,7 @@ func (sts *MemoryTopicStore) Load(id int) error { topic := &Topic{ID:id} err := sts.get.QueryRow(id).Scan(&topic.Title, &topic.Content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.LikeCount, &topic.Data) if err == nil { - topic.Slug = name_to_slug(topic.Title) + topic.Link = build_topic_url(name_to_slug(topic.Title),id) sts.Set(topic) } else { sts.Remove(id) @@ -180,35 +180,35 @@ func NewSqlTopicStore() *SqlTopicStore { func (sts *SqlTopicStore) Get(id int) (*Topic, error) { topic := Topic{ID:id} err := sts.get.QueryRow(id).Scan(&topic.Title, &topic.Content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.LikeCount, &topic.Data) - topic.Slug = name_to_slug(topic.Title) + topic.Link = build_topic_url(name_to_slug(topic.Title),id) return &topic, err } func (sts *SqlTopicStore) GetUnsafe(id int) (*Topic, error) { topic := Topic{ID:id} err := sts.get.QueryRow(id).Scan(&topic.Title, &topic.Content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.LikeCount, &topic.Data) - topic.Slug = name_to_slug(topic.Title) + topic.Link = build_topic_url(name_to_slug(topic.Title),id) return &topic, err } func (sts *SqlTopicStore) CascadeGet(id int) (*Topic, error) { topic := Topic{ID:id} err := sts.get.QueryRow(id).Scan(&topic.Title, &topic.Content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.LikeCount, &topic.Data) - topic.Slug = name_to_slug(topic.Title) + topic.Link = build_topic_url(name_to_slug(topic.Title),id) return &topic, err } func (sts *SqlTopicStore) BypassGet(id int) (*Topic, error) { topic := &Topic{ID:id} err := sts.get.QueryRow(id).Scan(&topic.Title, &topic.Content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.LikeCount, &topic.Data) - topic.Slug = name_to_slug(topic.Title) + topic.Link = build_topic_url(name_to_slug(topic.Title),id) return topic, err } func (sts *SqlTopicStore) Load(id int) error { topic := Topic{ID:id} err := sts.get.QueryRow(id).Scan(&topic.Title, &topic.Content, &topic.CreatedBy, &topic.CreatedAt, &topic.Is_Closed, &topic.Sticky, &topic.ParentID, &topic.IpAddress, &topic.PostCount, &topic.LikeCount, &topic.Data) - topic.Slug = name_to_slug(topic.Title) + topic.Link = build_topic_url(name_to_slug(topic.Title),id) return err } diff --git a/user.go b/user.go index 3a6d5b11..d403cbac 100644 --- a/user.go +++ b/user.go @@ -11,7 +11,7 @@ import ( "golang.org/x/crypto/bcrypt" ) -var guest_user User = User{ID:0,Group:6,Perms:GuestPerms} +var guest_user User = User{ID:0,Link:"#",Group:6,Perms:GuestPerms} var PreRoute func(http.ResponseWriter, *http.Request) (User,bool) = _pre_route var PanelSessionCheck func(http.ResponseWriter, *http.Request, *User) (HeaderVars,bool) = _panel_session_check @@ -26,7 +26,7 @@ var GeneratePassword func(password string) (hashed_password string, salt string, type User struct { ID int - Slug string + Link string Name string Email string Group int diff --git a/user_store.go b/user_store.go index 673c6078..65905f17 100644 --- a/user_store.go +++ b/user_store.go @@ -103,7 +103,7 @@ func (sus *MemoryUserStore) CascadeGet(id int) (*User, error) { } else { user.Avatar = strings.Replace(config.Noavatar,"{id}",strconv.Itoa(user.ID),1) } - user.Slug = name_to_slug(user.Name) + user.Link = build_profile_url(name_to_slug(user.Name),id) user.Tag = groups[user.Group].Tag init_user_perms(user) if err == nil { @@ -123,7 +123,7 @@ func (sus *MemoryUserStore) BypassGet(id int) (*User, error) { } else { user.Avatar = strings.Replace(config.Noavatar,"{id}",strconv.Itoa(user.ID),1) } - user.Slug = name_to_slug(user.Name) + user.Link = build_profile_url(name_to_slug(user.Name),id) user.Tag = groups[user.Group].Tag init_user_perms(user) return user, err @@ -144,7 +144,7 @@ func (sus *MemoryUserStore) Load(id int) error { } else { user.Avatar = strings.Replace(config.Noavatar,"{id}",strconv.Itoa(user.ID),1) } - user.Slug = name_to_slug(user.Name) + user.Link = build_profile_url(name_to_slug(user.Name),id) user.Tag = groups[user.Group].Tag init_user_perms(user) sus.Set(user) @@ -282,7 +282,7 @@ func (sus *SqlUserStore) Get(id int) (*User, error) { } else { user.Avatar = strings.Replace(config.Noavatar,"{id}",strconv.Itoa(user.ID),1) } - user.Slug = name_to_slug(user.Name) + user.Link = build_profile_url(name_to_slug(user.Name),id) user.Tag = groups[user.Group].Tag init_user_perms(&user) return &user, err @@ -299,7 +299,7 @@ func (sus *SqlUserStore) GetUnsafe(id int) (*User, error) { } else { user.Avatar = strings.Replace(config.Noavatar,"{id}",strconv.Itoa(user.ID),1) } - user.Slug = name_to_slug(user.Name) + user.Link = build_profile_url(name_to_slug(user.Name),id) user.Tag = groups[user.Group].Tag init_user_perms(&user) return &user, err @@ -316,7 +316,7 @@ func (sus *SqlUserStore) CascadeGet(id int) (*User, error) { } else { user.Avatar = strings.Replace(config.Noavatar,"{id}",strconv.Itoa(user.ID),1) } - user.Slug = name_to_slug(user.Name) + user.Link = build_profile_url(name_to_slug(user.Name),id) user.Tag = groups[user.Group].Tag init_user_perms(&user) return &user, err @@ -333,7 +333,7 @@ func (sus *SqlUserStore) BypassGet(id int) (*User, error) { } else { user.Avatar = strings.Replace(config.Noavatar,"{id}",strconv.Itoa(user.ID),1) } - user.Slug = name_to_slug(user.Name) + user.Link = build_profile_url(name_to_slug(user.Name),id) user.Tag = groups[user.Group].Tag init_user_perms(&user) return &user, err