diff --git a/general_test.go b/general_test.go index 39eeb47a..40f8f04c 100644 --- a/general_test.go +++ b/general_test.go @@ -1334,7 +1334,7 @@ func TestForumAdminRoute(t *testing.T) { admin_session_cookie := http.Cookie{Name:"session",Value: admin.Session,Path:"/",MaxAge: year} forum_w := httptest.NewRecorder() - forum_req := httptest.NewRequest("get","/forum/2",bytes.NewReader(nil)) + forum_req := httptest.NewRequest("get","/forum/1",bytes.NewReader(nil)) forum_req_admin := forum_req forum_req_admin.AddCookie(&admin_uid_cookie) forum_req_admin.AddCookie(&admin_session_cookie) diff --git a/template_forum.go b/template_forum.go index a9f00d89..55a5e609 100644 --- a/template_forum.go +++ b/template_forum.go @@ -1,7 +1,7 @@ /* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ package main -import "strconv" import "io" +import "strconv" func init() { template_forum_handle = template_forum diff --git a/template_list.go b/template_list.go index 535f3350..97def827 100644 --- a/template_list.go +++ b/template_list.go @@ -74,101 +74,102 @@ var topic_14 []byte = []byte(` - - + `) +var topic_18 []byte = []byte(` `) -var topic_17 []byte = []byte(` +var topic_19 []byte = []byte(`
+var topic_20 []byte = []byte(`background-image:url(`) +var topic_21 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px `) +var topic_22 []byte = []byte(`-1`) +var topic_23 []byte = []byte(`0px;background-repeat:no-repeat, repeat-y;background-size:128px;padding-left:136px;`) +var topic_24 []byte = []byte(`">

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

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



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

`) -var topic_26 []byte = []byte(`  -   +var topic_27 []byte = []byte(`" class="username real_username">`) +var topic_28 []byte = []byte(`  `) -var topic_30 []byte = []byte(`  -   - `) -var topic_33 []byte = []byte(``) -var topic_35 []byte = []byte(``) -var topic_37 []byte = []byte(`  +var topic_29 []byte = []byte(` `) +var topic_33 []byte = []byte(` `) +var topic_35 []byte = []byte(` `) +var topic_37 []byte = []byte(``) +var topic_39 []byte = []byte(` `) +var topic_41 []byte = []byte(`   +var topic_42 []byte = []byte(`?session=`) +var topic_43 []byte = []byte(`&type=topic" class="mod_button report_item" style="font-weight:normal;" title="Flag Topic">  `) -var topic_40 []byte = []byte(``) -var topic_41 []byte = []byte(`😀`) -var topic_42 []byte = []byte(``) -var topic_43 []byte = []byte(``) var topic_44 []byte = []byte(``) -var topic_45 []byte = []byte(`👑`) -var topic_46 []byte = []byte(` +var topic_45 []byte = []byte(`😀`) +var topic_46 []byte = []byte(``) +var topic_47 []byte = []byte(``) +var topic_48 []byte = []byte(``) +var topic_49 []byte = []byte(`👑`) +var topic_50 []byte = []byte(`

`) -var topic_47 []byte = []byte(` +var topic_51 []byte = []byte(`
+var topic_52 []byte = []byte(`background-image:url(`) +var topic_53 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px `) +var topic_54 []byte = []byte(`-1`) +var topic_55 []byte = []byte(`0px;background-repeat:no-repeat, repeat-y;background-size:128px;padding-left:136px;`) +var topic_56 []byte = []byte(`">

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



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



`) -var topic_55 []byte = []byte(`  -   +var topic_58 []byte = []byte(`" class="username real_username">`) +var topic_59 []byte = []byte(`  `) -var topic_59 []byte = []byte(` `) -var topic_61 []byte = []byte(` `) -var topic_63 []byte = []byte(` +var topic_60 []byte = []byte(` `) +var topic_64 []byte = []byte(` `) +var topic_66 []byte = []byte(` `) +var topic_68 []byte = []byte(`   +var topic_69 []byte = []byte(`?session=`) +var topic_70 []byte = []byte(`&type=reply" class="mod_button" title="Flag Reply">  `) -var topic_66 []byte = []byte(``) -var topic_67 []byte = []byte(`😀`) -var topic_68 []byte = []byte(``) -var topic_69 []byte = []byte(``) -var topic_70 []byte = []byte(``) -var topic_71 []byte = []byte(`👑`) -var topic_72 []byte = []byte(` +var topic_71 []byte = []byte(``) +var topic_72 []byte = []byte(`😀`) +var topic_73 []byte = []byte(``) +var topic_74 []byte = []byte(``) +var topic_75 []byte = []byte(``) +var topic_76 []byte = []byte(`👑`) +var topic_77 []byte = []byte(`
`) -var topic_73 []byte = []byte(`
+var topic_78 []byte = []byte(` `) -var topic_74 []byte = []byte(` +var topic_79 []byte = []byte(`
+var topic_80 []byte = []byte(`' type="hidden" />
@@ -203,31 +204,18 @@ var topic_alt_12 []byte = []byte(`"> var topic_alt_13 []byte = []byte(` `) var topic_alt_14 []byte = []byte(`🔒︎`) -var topic_alt_15 []byte = []byte(`🖤︎`) -var topic_alt_16 []byte = []byte(` - Edit - Delete - `) -var topic_alt_19 []byte = []byte(`Unpin`) -var topic_alt_21 []byte = []byte(`Pin`) -var topic_alt_23 []byte = []byte(` - +var topic_alt_15 []byte = []byte(` - - + `) +var topic_alt_18 []byte = []byte(` `) -var topic_alt_25 []byte = []byte(` - Report +var topic_alt_19 []byte = []byte(`
@@ -236,75 +224,96 @@ var topic_alt_27 []byte = []byte(`&type=topic" class="username report_item topic
 
+var topic_alt_20 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;"> 
`) -var topic_alt_30 []byte = []byte(` +var topic_alt_21 []byte = []byte(`" class="the_name">`) +var topic_alt_22 []byte = []byte(` `) -var topic_alt_31 []byte = []byte(`
`) -var topic_alt_33 []byte = []byte(`
`) -var topic_alt_35 []byte = []byte(` +var topic_alt_23 []byte = []byte(`
`) +var topic_alt_25 []byte = []byte(`
`) +var topic_alt_27 []byte = []byte(`
`) -var topic_alt_36 []byte = []byte(`
+var topic_alt_28 []byte = []byte(`
+var topic_alt_29 []byte = []byte(`
`) -var topic_alt_38 []byte = []byte(``) -var topic_alt_39 []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_43 []byte = []byte(``) +var topic_alt_44 []byte = []byte(``) +var topic_alt_45 []byte = []byte(``) +var topic_alt_46 []byte = []byte(` up`) +var topic_alt_47 []byte = []byte(`
`) -var topic_alt_41 []byte = []byte(` +var topic_alt_48 []byte = []byte(`
 
+var topic_alt_49 []byte = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;"> 
`) -var topic_alt_44 []byte = []byte(` +var topic_alt_50 []byte = []byte(`" class="the_name">`) +var topic_alt_51 []byte = []byte(` `) -var topic_alt_45 []byte = []byte(`
`) -var topic_alt_47 []byte = []byte(`
`) -var topic_alt_49 []byte = []byte(` +var topic_alt_52 []byte = []byte(`
`) +var topic_alt_54 []byte = []byte(`
`) +var topic_alt_56 []byte = []byte(`
`) -var topic_alt_50 []byte = []byte(`
+var topic_alt_57 []byte = []byte(`
`) -var topic_alt_51 []byte = []byte(`Edit`) -var topic_alt_53 []byte = []byte(`Delete`) -var topic_alt_55 []byte = []byte(` +var topic_alt_58 []byte = []byte(`+1`) +var topic_alt_60 []byte = []byte(`Edit`) +var topic_alt_62 []byte = []byte(`Delete`) +var topic_alt_64 []byte = []byte(` Report +var topic_alt_65 []byte = []byte(`?session=`) +var topic_alt_66 []byte = []byte(`&type=reply" class="action_button report_item">Report `) -var topic_alt_58 []byte = []byte(``) -var topic_alt_59 []byte = []byte(``) -var topic_alt_60 []byte = []byte(` +var topic_alt_67 []byte = []byte(``) +var topic_alt_68 []byte = []byte(``) +var topic_alt_69 []byte = []byte(``) +var topic_alt_70 []byte = []byte(` up`) +var topic_alt_71 []byte = []byte(`
`) -var topic_alt_61 []byte = []byte(` +var topic_alt_72 []byte = []byte(` `) -var topic_alt_62 []byte = []byte(` +var topic_alt_73 []byte = []byte(`
+var topic_alt_74 []byte = []byte(`' type="hidden" />
diff --git a/template_topic.go b/template_topic.go index 9acc93b7..80201881 100644 --- a/template_topic.go +++ b/template_topic.go @@ -74,136 +74,151 @@ w.Write(topic_13) if tmpl_topic_vars.Topic.Is_Closed { w.Write(topic_14) } -if tmpl_topic_vars.CurrentUser.Is_Mod { +if tmpl_topic_vars.CurrentUser.Perms.EditTopic { w.Write(topic_15) w.Write([]byte(tmpl_topic_vars.Topic.Title)) w.Write(topic_16) -} +if tmpl_topic_vars.CurrentUser.Perms.CloseTopic { w.Write(topic_17) -if tmpl_topic_vars.Topic.Avatar != "" { -w.Write(topic_18) -w.Write([]byte(tmpl_topic_vars.Topic.Avatar)) -w.Write(topic_19) -if tmpl_topic_vars.Topic.ContentLines <= 5 { -w.Write(topic_20) } +w.Write(topic_18) +} +w.Write(topic_19) +if tmpl_topic_vars.Topic.Avatar != "" { +w.Write(topic_20) +w.Write([]byte(tmpl_topic_vars.Topic.Avatar)) w.Write(topic_21) +if tmpl_topic_vars.Topic.ContentLines <= 5 { +w.Write(topic_22) +} +w.Write(topic_23) w.Write([]byte(string(tmpl_topic_vars.Topic.Css))) } -w.Write(topic_22) -w.Write([]byte(tmpl_topic_vars.Topic.Content)) -w.Write(topic_23) -w.Write([]byte(tmpl_topic_vars.Topic.Content)) w.Write(topic_24) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.CreatedBy))) +w.Write([]byte(tmpl_topic_vars.Topic.Content)) w.Write(topic_25) -w.Write([]byte(tmpl_topic_vars.Topic.CreatedByName)) +w.Write([]byte(tmpl_topic_vars.Topic.Content)) w.Write(topic_26) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.CreatedBy))) w.Write(topic_27) -if tmpl_topic_vars.Topic.Liked { +w.Write([]byte(tmpl_topic_vars.Topic.CreatedByName)) w.Write(topic_28) -} +if tmpl_topic_vars.CurrentUser.Perms.LikeItem { w.Write(topic_29) -if tmpl_topic_vars.CurrentUser.Is_Mod { +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_30) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +if tmpl_topic_vars.Topic.Liked { w.Write(topic_31) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +} w.Write(topic_32) -if tmpl_topic_vars.Topic.Sticky { +} +if tmpl_topic_vars.CurrentUser.Perms.EditTopic { w.Write(topic_33) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_34) -} else { +} +if tmpl_topic_vars.CurrentUser.Perms.DeleteTopic { w.Write(topic_35) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_36) } -} +if tmpl_topic_vars.CurrentUser.Perms.PinTopic { +if tmpl_topic_vars.Topic.Sticky { w.Write(topic_37) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_38) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_39) -if tmpl_topic_vars.Topic.LikeCount > 0 { -w.Write(topic_40) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.LikeCount))) -w.Write(topic_41) -} -if tmpl_topic_vars.Topic.Tag != "" { -w.Write(topic_42) -w.Write([]byte(tmpl_topic_vars.Topic.Tag)) -w.Write(topic_43) } else { +w.Write(topic_39) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_40) +} +} +w.Write(topic_41) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_42) +w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) +w.Write(topic_43) +if tmpl_topic_vars.Topic.LikeCount > 0 { w.Write(topic_44) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level))) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.LikeCount))) w.Write(topic_45) } +if tmpl_topic_vars.Topic.Tag != "" { w.Write(topic_46) +w.Write([]byte(tmpl_topic_vars.Topic.Tag)) +w.Write(topic_47) +} else { +w.Write(topic_48) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level))) +w.Write(topic_49) +} +w.Write(topic_50) if len(tmpl_topic_vars.ItemList) != 0 { for _, item := range tmpl_topic_vars.ItemList { -w.Write(topic_47) -if item.Avatar != "" { -w.Write(topic_48) -w.Write([]byte(item.Avatar)) -w.Write(topic_49) -if item.ContentLines <= 5 { -w.Write(topic_50) -} w.Write(topic_51) +if item.Avatar != "" { +w.Write(topic_52) +w.Write([]byte(item.Avatar)) +w.Write(topic_53) +if item.ContentLines <= 5 { +w.Write(topic_54) +} +w.Write(topic_55) w.Write([]byte(string(item.Css))) } -w.Write(topic_52) -w.Write([]byte(item.ContentHtml)) -w.Write(topic_53) -w.Write([]byte(strconv.Itoa(item.CreatedBy))) -w.Write(topic_54) -w.Write([]byte(item.CreatedByName)) -w.Write(topic_55) -w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_56) -if item.Liked { +w.Write([]byte(item.ContentHtml)) w.Write(topic_57) -} +w.Write([]byte(strconv.Itoa(item.CreatedBy))) w.Write(topic_58) -if tmpl_topic_vars.CurrentUser.Perms.EditReply { +w.Write([]byte(item.CreatedByName)) w.Write(topic_59) -w.Write([]byte(strconv.Itoa(item.ID))) +if tmpl_topic_vars.CurrentUser.Perms.LikeItem { w.Write(topic_60) -} -if tmpl_topic_vars.CurrentUser.Perms.DeleteReply { -w.Write(topic_61) w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_61) +if item.Liked { w.Write(topic_62) } w.Write(topic_63) -w.Write([]byte(strconv.Itoa(item.ID))) +} +if tmpl_topic_vars.CurrentUser.Perms.EditReply { w.Write(topic_64) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) +w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_65) -if item.LikeCount > 0 { +} +if tmpl_topic_vars.CurrentUser.Perms.DeleteReply { w.Write(topic_66) -w.Write([]byte(strconv.Itoa(item.LikeCount))) +w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_67) } -if item.Tag != "" { w.Write(topic_68) -w.Write([]byte(item.Tag)) +w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_69) -} else { +w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) w.Write(topic_70) -w.Write([]byte(strconv.Itoa(item.Level))) +if item.LikeCount > 0 { w.Write(topic_71) -} +w.Write([]byte(strconv.Itoa(item.LikeCount))) w.Write(topic_72) } -} +if item.Tag != "" { w.Write(topic_73) -if tmpl_topic_vars.CurrentUser.Perms.CreateReply { +w.Write([]byte(item.Tag)) w.Write(topic_74) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +} else { w.Write(topic_75) +w.Write([]byte(strconv.Itoa(item.Level))) +w.Write(topic_76) +} +w.Write(topic_77) +} +} +w.Write(topic_78) +if tmpl_topic_vars.CurrentUser.Perms.CreateReply { +w.Write(topic_79) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_80) } w.Write(footer_0) } diff --git a/template_topic_alt.go b/template_topic_alt.go index 913eebc4..c8518fc9 100644 --- a/template_topic_alt.go +++ b/template_topic_alt.go @@ -73,108 +73,138 @@ w.Write([]byte(tmpl_topic_alt_vars.Topic.Title)) w.Write(topic_alt_13) if tmpl_topic_alt_vars.Topic.Is_Closed { w.Write(topic_alt_14) -} else { +} +if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic { w.Write(topic_alt_15) -} -if tmpl_topic_alt_vars.CurrentUser.Is_Mod { -w.Write(topic_alt_16) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_17) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_18) -if tmpl_topic_alt_vars.Topic.Sticky { -w.Write(topic_alt_19) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_20) -} else { -w.Write(topic_alt_21) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_22) -} -w.Write(topic_alt_23) w.Write([]byte(tmpl_topic_alt_vars.Topic.Title)) -w.Write(topic_alt_24) +w.Write(topic_alt_16) +if tmpl_topic_alt_vars.CurrentUser.Perms.CloseTopic { +w.Write(topic_alt_17) } -w.Write(topic_alt_25) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_26) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_27) +w.Write(topic_alt_18) +} +w.Write(topic_alt_19) w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar)) -w.Write(topic_alt_28) +w.Write(topic_alt_20) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.CreatedBy))) -w.Write(topic_alt_29) +w.Write(topic_alt_21) w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName)) -w.Write(topic_alt_30) +w.Write(topic_alt_22) if tmpl_topic_alt_vars.Topic.Tag != "" { -w.Write(topic_alt_31) +w.Write(topic_alt_23) w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag)) -w.Write(topic_alt_32) +w.Write(topic_alt_24) } else { -w.Write(topic_alt_33) +w.Write(topic_alt_25) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level))) -w.Write(topic_alt_34) +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) +if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem { +w.Write(topic_alt_30) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_31) +} +if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic { +w.Write(topic_alt_32) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_33) +} +if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteTopic { +w.Write(topic_alt_34) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) w.Write(topic_alt_35) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Content)) +} +if tmpl_topic_alt_vars.CurrentUser.Perms.PinTopic { +if tmpl_topic_alt_vars.Topic.Sticky { w.Write(topic_alt_36) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Content)) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) w.Write(topic_alt_37) -if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { +} else { w.Write(topic_alt_38) -w.Write([]byte(tmpl_topic_alt_vars.Topic.IpAddress)) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) w.Write(topic_alt_39) } +} w.Write(topic_alt_40) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_41) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) +w.Write(topic_alt_42) +if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { +w.Write(topic_alt_43) +w.Write([]byte(tmpl_topic_alt_vars.Topic.IpAddress)) +w.Write(topic_alt_44) +} +if tmpl_topic_alt_vars.Topic.LikeCount > 0 { +w.Write(topic_alt_45) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.LikeCount))) +w.Write(topic_alt_46) +} +w.Write(topic_alt_47) if len(tmpl_topic_alt_vars.ItemList) != 0 { for _, item := range tmpl_topic_alt_vars.ItemList { -w.Write(topic_alt_41) -w.Write([]byte(item.Avatar)) -w.Write(topic_alt_42) -w.Write([]byte(strconv.Itoa(item.CreatedBy))) -w.Write(topic_alt_43) -w.Write([]byte(item.CreatedByName)) -w.Write(topic_alt_44) -if item.Tag != "" { -w.Write(topic_alt_45) -w.Write([]byte(item.Tag)) -w.Write(topic_alt_46) -} else { -w.Write(topic_alt_47) -w.Write([]byte(strconv.Itoa(item.Level))) w.Write(topic_alt_48) -} +w.Write([]byte(item.Avatar)) w.Write(topic_alt_49) -w.Write([]byte(item.ContentHtml)) +w.Write([]byte(strconv.Itoa(item.CreatedBy))) w.Write(topic_alt_50) -if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply { +w.Write([]byte(item.CreatedByName)) w.Write(topic_alt_51) -w.Write([]byte(strconv.Itoa(item.ID))) +if item.Tag != "" { w.Write(topic_alt_52) -} -if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply { +w.Write([]byte(item.Tag)) w.Write(topic_alt_53) -w.Write([]byte(strconv.Itoa(item.ID))) +} else { w.Write(topic_alt_54) -} +w.Write([]byte(strconv.Itoa(item.Level))) w.Write(topic_alt_55) -w.Write([]byte(strconv.Itoa(item.ID))) +} w.Write(topic_alt_56) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) +w.Write([]byte(item.ContentHtml)) w.Write(topic_alt_57) -if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { +if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem { w.Write(topic_alt_58) -w.Write([]byte(item.IpAddress)) +w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_alt_59) } +if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply { w.Write(topic_alt_60) -} -} +w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_alt_61) -if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply { +} +if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply { w.Write(topic_alt_62) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_alt_63) } +w.Write(topic_alt_64) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_alt_65) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) +w.Write(topic_alt_66) +if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { +w.Write(topic_alt_67) +w.Write([]byte(item.IpAddress)) +w.Write(topic_alt_68) +} +if item.LikeCount > 0 { +w.Write(topic_alt_69) +w.Write([]byte(strconv.Itoa(item.LikeCount))) +w.Write(topic_alt_70) +} +w.Write(topic_alt_71) +} +} +w.Write(topic_alt_72) +if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply { +w.Write(topic_alt_73) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_74) +} w.Write(footer_0) } diff --git a/templates/topic.html b/templates/topic.html index bc0b373d..0d8c407c 100644 --- a/templates/topic.html +++ b/templates/topic.html @@ -7,12 +7,12 @@
{{.Topic.Title}} {{if .Topic.Is_Closed}}🔒︎{{end}} - {{if .CurrentUser.Is_Mod}} + {{if .CurrentUser.Perms.EditTopic}} - - + {{end}} {{end}}
@@ -23,11 +23,10 @@

{{.Topic.Content}}



{{.Topic.CreatedByName}}  -   - {{if .CurrentUser.Is_Mod}}  -   - {{if .Topic.Sticky}}{{else}}{{end}} - {{end}}  + {{if .CurrentUser.Perms.LikeItem}} {{end}} + {{if .CurrentUser.Perms.EditTopic}} {{end}} + {{if .CurrentUser.Perms.DeleteTopic}} {{end}} + {{if .CurrentUser.Perms.PinTopic}}{{if .Topic.Sticky}}{{else}} {{end}}{{end}}   {{if .Topic.LikeCount}}{{.Topic.LikeCount}}😀{{end}} {{if .Topic.Tag}}{{.Topic.Tag}}{{else}}{{.Topic.Level}}👑{{end}} @@ -37,7 +36,7 @@

{{.ContentHtml}}



{{.CreatedByName}}  -   + {{if $.CurrentUser.Perms.LikeItem}} {{end}} {{if $.CurrentUser.Perms.EditReply}} {{end}} {{if $.CurrentUser.Perms.DeleteReply}} {{end}}   diff --git a/templates/topic_alt.html b/templates/topic_alt.html index 23bef1b6..3cef331c 100644 --- a/templates/topic_alt.html +++ b/templates/topic_alt.html @@ -6,20 +6,15 @@
{{.Topic.Title}} - {{if .Topic.Is_Closed}}🔒︎{{else}}🖤︎{{end}} - {{if .CurrentUser.Is_Mod}} - Edit - Delete - {{if .Topic.Sticky}}Unpin{{else}}Pin{{end}} - + {{if .Topic.Is_Closed}}🔒︎{{end}} + {{if .CurrentUser.Perms.EditTopic}} - - + {{end}} {{end}} - Report
@@ -35,8 +30,15 @@
{{.Topic.Content}}
+ {{if .CurrentUser.Perms.LikeItem}}+1{{end}} + {{if .CurrentUser.Perms.EditTopic}}Edit{{end}} + {{if .CurrentUser.Perms.DeleteTopic}}Delete{{end}} + {{if .CurrentUser.Perms.PinTopic}} + {{if .Topic.Sticky}}Unpin{{else}}Pin{{end}}{{end}} + Report {{/* Element Queries might help with having to use JS. Unfortunately, the W3C is taking a while with it */}} - {{if $.CurrentUser.Perms.ViewIPs}}{{.Topic.IpAddress}}{{end}} + {{if .CurrentUser.Perms.ViewIPs}}{{.Topic.IpAddress}}{{end}} + {{if .Topic.LikeCount}}{{.Topic.LikeCount}} up{{end}}
@@ -50,10 +52,12 @@
{{.ContentHtml}}
+ {{if $.CurrentUser.Perms.LikeItem}}+1{{end}} {{if $.CurrentUser.Perms.EditReply}}Edit{{end}} {{if $.CurrentUser.Perms.DeleteReply}}Delete{{end}} Report - {{if $.CurrentUser.Perms.ViewIPs}}{{.IpAddress}}{{end}} + {{if $.CurrentUser.Perms.ViewIPs}}{{.IpAddress}}{{end}} + {{if .LikeCount}}{{.LikeCount}} up{{end}}
diff --git a/user.go b/user.go index 1fb3ebf8..e05e7496 100644 --- a/user.go +++ b/user.go @@ -96,7 +96,7 @@ func (sts *StaticUserStore) CascadeGet(id int) (*User, error) { return user, nil } - user = &User{ID:id} + user = &User{ID:id,Loggedin:true} err := get_full_user_stmt.QueryRow(id).Scan(&user.Name, &user.Group, &user.Is_Super_Admin, &user.Session, &user.Email, &user.Avatar, &user.Message, &user.URLPrefix, &user.URLName, &user.Level, &user.Score, &user.Last_IP) if user.Avatar != "" { @@ -115,7 +115,7 @@ func (sts *StaticUserStore) CascadeGet(id int) (*User, error) { } func (sts *StaticUserStore) Load(id int) error { - user := &User{ID:id} + user := &User{ID:id,Loggedin:true} err := get_full_user_stmt.QueryRow(id).Scan(&user.Name, &user.Group, &user.Is_Super_Admin, &user.Session, &user.Email, &user.Avatar, &user.Message, &user.URLPrefix, &user.URLName, &user.Level, &user.Score, &user.Last_IP) if err != nil { return err @@ -209,7 +209,7 @@ func NewSqlUserStore() *SqlUserStore { } func (sus *SqlUserStore) Get(id int) (*User, error) { - user := User{ID:id} + user := User{ID:id,Loggedin:true} err := get_full_user_stmt.QueryRow(id).Scan(&user.Name, &user.Group, &user.Is_Super_Admin, &user.Session, &user.Email, &user.Avatar, &user.Message, &user.URLPrefix, &user.URLName, &user.Level, &user.Score, &user.Last_IP) if user.Avatar != "" { @@ -225,7 +225,7 @@ func (sus *SqlUserStore) Get(id int) (*User, error) { } func (sus *SqlUserStore) GetUnsafe(id int) (*User, error) { - user := User{ID:id} + user := User{ID:id,Loggedin:true} err := get_full_user_stmt.QueryRow(id).Scan(&user.Name, &user.Group, &user.Is_Super_Admin, &user.Session, &user.Email, &user.Avatar, &user.Message, &user.URLPrefix, &user.URLName, &user.Level, &user.Score, &user.Last_IP) if user.Avatar != "" { @@ -241,7 +241,7 @@ func (sus *SqlUserStore) GetUnsafe(id int) (*User, error) { } func (sus *SqlUserStore) CascadeGet(id int) (*User, error) { - user := User{ID:id} + user := User{ID:id,Loggedin:true} err := get_full_user_stmt.QueryRow(id).Scan(&user.Name, &user.Group, &user.Is_Super_Admin, &user.Session, &user.Email, &user.Avatar, &user.Message, &user.URLPrefix, &user.URLName, &user.Level, &user.Score, &user.Last_IP) if user.Avatar != "" {