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(`
@@ -46,33 +50,30 @@ var menu_1 []byte = []byte(`
`)
var menu_2 []byte = []byte(`
-
- `)
-var menu_5 []byte = []byte(``)
-var menu_6 []byte = []byte(`
+
+
+var menu_4 []byte = []byte(`">Logout
`)
-var menu_8 []byte = []byte(`
+var menu_5 []byte = []byte(`
`)
-var menu_9 []byte = []byte(`
+var menu_6 []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_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_80 []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_78 []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_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_55 []byte = []byte(`
`)
-var topic_alt_58 []byte = []byte(`
`)
+var topic_alt_56 []byte = []byte(`
`)
+var topic_alt_57 []byte = []byte(`
`)
+var topic_alt_58 []byte = []byte(`
Level `)
var topic_alt_59 []byte = []byte(`
`)
-var topic_alt_60 []byte = []byte(`
Level `)
-var topic_alt_61 []byte = []byte(`
`)
-var topic_alt_62 []byte = []byte(`
+var topic_alt_60 []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_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 profile_36 []byte = []byte(`
`)
-var profile_38 []byte = []byte(`
+var profile_37 []byte = []byte(`