diff --git a/mod_routes.go b/mod_routes.go index fe336061..40a1b762 100644 --- a/mod_routes.go +++ b/mod_routes.go @@ -38,7 +38,7 @@ func route_edit_topic(w http.ResponseWriter, r *http.Request, user User) { } // TODO: Add hooks to make use of headerLite - _, ok := SimpleForumSessionCheck(w, r, &user, oldTopic.ParentID) + _, ok := SimpleForumUserCheck(w, r, &user, oldTopic.ParentID) if !ok { return } @@ -128,7 +128,7 @@ func route_delete_topic(w http.ResponseWriter, r *http.Request, user User) { } // TODO: Add hooks to make use of headerLite - _, ok := SimpleForumSessionCheck(w, r, &user, topic.ParentID) + _, ok := SimpleForumUserCheck(w, r, &user, topic.ParentID) if !ok { return } @@ -202,7 +202,7 @@ func route_stick_topic(w http.ResponseWriter, r *http.Request, user User) { } // TODO: Add hooks to make use of headerLite - _, ok := SimpleForumSessionCheck(w, r, &user, topic.ParentID) + _, ok := SimpleForumUserCheck(w, r, &user, topic.ParentID) if !ok { return } @@ -258,7 +258,7 @@ func route_unstick_topic(w http.ResponseWriter, r *http.Request, user User) { } // TODO: Add hooks to make use of headerLite - _, ok := SimpleForumSessionCheck(w, r, &user, topic.ParentID) + _, ok := SimpleForumUserCheck(w, r, &user, topic.ParentID) if !ok { return } @@ -339,7 +339,7 @@ func route_reply_edit_submit(w http.ResponseWriter, r *http.Request, user User) } // TODO: Add hooks to make use of headerLite - _, ok := SimpleForumSessionCheck(w, r, &user, fid) + _, ok := SimpleForumUserCheck(w, r, &user, fid) if !ok { return } @@ -390,7 +390,7 @@ func route_reply_delete_submit(w http.ResponseWriter, r *http.Request, user User } // TODO: Add hooks to make use of headerLite - _, ok := SimpleForumSessionCheck(w, r, &user, fid) + _, ok := SimpleForumUserCheck(w, r, &user, fid) if !ok { return } @@ -531,7 +531,7 @@ func route_profile_reply_delete_submit(w http.ResponseWriter, r *http.Request, u } func route_ips(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -636,7 +636,7 @@ func route_ips(w http.ResponseWriter, r *http.Request, user User) { // TODO: This is being replaced with the new ban route system /*func route_ban(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w,r,&user) + headerVars, ok := UserCheck(w,r,&user) if !ok { return } diff --git a/panel_routes.go b/panel_routes.go index 2ff39233..464464f4 100644 --- a/panel_routes.go +++ b/panel_routes.go @@ -15,7 +15,7 @@ import ( ) func route_panel(w http.ResponseWriter, r *http.Request, user User) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -181,7 +181,7 @@ func route_panel(w http.ResponseWriter, r *http.Request, user User) { } func route_panel_forums(w http.ResponseWriter, r *http.Request, user User) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -219,7 +219,7 @@ func route_panel_forums(w http.ResponseWriter, r *http.Request, user User) { } func route_panel_forums_create_submit(w http.ResponseWriter, r *http.Request, user User) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -255,7 +255,7 @@ func route_panel_forums_create_submit(w http.ResponseWriter, r *http.Request, us // TODO: Revamp this func route_panel_forums_delete(w http.ResponseWriter, r *http.Request, user User, sfid string) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -299,7 +299,7 @@ func route_panel_forums_delete(w http.ResponseWriter, r *http.Request, user User } func route_panel_forums_delete_submit(w http.ResponseWriter, r *http.Request, user User, sfid string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -331,7 +331,7 @@ func route_panel_forums_delete_submit(w http.ResponseWriter, r *http.Request, us } func route_panel_forums_edit(w http.ResponseWriter, r *http.Request, user User, sfid string) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -381,7 +381,7 @@ func route_panel_forums_edit(w http.ResponseWriter, r *http.Request, user User, } func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, user User, sfid string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -464,7 +464,7 @@ func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, user } func route_panel_forums_edit_perms_submit(w http.ResponseWriter, r *http.Request, user User, sfid string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -543,7 +543,7 @@ func route_panel_forums_edit_perms_submit(w http.ResponseWriter, r *http.Request } func route_panel_settings(w http.ResponseWriter, r *http.Request, user User) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -608,7 +608,7 @@ func route_panel_settings(w http.ResponseWriter, r *http.Request, user User) { } func route_panel_setting(w http.ResponseWriter, r *http.Request, user User, sname string) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -659,7 +659,7 @@ func route_panel_setting(w http.ResponseWriter, r *http.Request, user User, snam } func route_panel_setting_edit(w http.ResponseWriter, r *http.Request, user User, sname string) { - headerLite, ok := SimplePanelSessionCheck(w, r, &user) + headerLite, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -715,7 +715,7 @@ func route_panel_setting_edit(w http.ResponseWriter, r *http.Request, user User, } func route_panel_word_filters(w http.ResponseWriter, r *http.Request, user User) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -738,7 +738,7 @@ func route_panel_word_filters(w http.ResponseWriter, r *http.Request, user User) } func route_panel_word_filters_create(w http.ResponseWriter, r *http.Request, user User) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -779,7 +779,7 @@ func route_panel_word_filters_create(w http.ResponseWriter, r *http.Request, use } func route_panel_word_filters_edit(w http.ResponseWriter, r *http.Request, user User, wfid string) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -803,7 +803,7 @@ func route_panel_word_filters_edit(w http.ResponseWriter, r *http.Request, user } func route_panel_word_filters_edit_submit(w http.ResponseWriter, r *http.Request, user User, wfid string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -849,7 +849,7 @@ func route_panel_word_filters_edit_submit(w http.ResponseWriter, r *http.Request } func route_panel_word_filters_delete_submit(w http.ResponseWriter, r *http.Request, user User, wfid string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -885,7 +885,7 @@ func route_panel_word_filters_delete_submit(w http.ResponseWriter, r *http.Reque } func route_panel_plugins(w http.ResponseWriter, r *http.Request, user User) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -914,7 +914,7 @@ func route_panel_plugins(w http.ResponseWriter, r *http.Request, user User) { } func route_panel_plugins_activate(w http.ResponseWriter, r *http.Request, user User, uname string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -990,7 +990,7 @@ func route_panel_plugins_activate(w http.ResponseWriter, r *http.Request, user U } func route_panel_plugins_deactivate(w http.ResponseWriter, r *http.Request, user User, uname string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -1038,7 +1038,7 @@ func route_panel_plugins_deactivate(w http.ResponseWriter, r *http.Request, user } func route_panel_plugins_install(w http.ResponseWriter, r *http.Request, user User, uname string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -1124,7 +1124,7 @@ func route_panel_plugins_install(w http.ResponseWriter, r *http.Request, user Us } func route_panel_users(w http.ResponseWriter, r *http.Request, user User) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -1186,7 +1186,7 @@ func route_panel_users(w http.ResponseWriter, r *http.Request, user User) { } func route_panel_users_edit(w http.ResponseWriter, r *http.Request, user User, suid string) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -1240,7 +1240,7 @@ func route_panel_users_edit(w http.ResponseWriter, r *http.Request, user User, s } func route_panel_users_edit_submit(w http.ResponseWriter, r *http.Request, user User, suid string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -1335,7 +1335,7 @@ func route_panel_users_edit_submit(w http.ResponseWriter, r *http.Request, user } func route_panel_groups(w http.ResponseWriter, r *http.Request, user User) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -1397,7 +1397,7 @@ func route_panel_groups(w http.ResponseWriter, r *http.Request, user User) { } func route_panel_groups_edit(w http.ResponseWriter, r *http.Request, user User, sgid string) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -1456,7 +1456,7 @@ func route_panel_groups_edit(w http.ResponseWriter, r *http.Request, user User, } func route_panel_groups_edit_perms(w http.ResponseWriter, r *http.Request, user User, sgid string) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -1535,7 +1535,7 @@ func route_panel_groups_edit_perms(w http.ResponseWriter, r *http.Request, user } func route_panel_groups_edit_submit(w http.ResponseWriter, r *http.Request, user User, sgid string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -1667,7 +1667,7 @@ func route_panel_groups_edit_submit(w http.ResponseWriter, r *http.Request, user } func route_panel_groups_edit_perms_submit(w http.ResponseWriter, r *http.Request, user User, sgid string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -1743,7 +1743,7 @@ func route_panel_groups_edit_perms_submit(w http.ResponseWriter, r *http.Request } func route_panel_groups_create_submit(w http.ResponseWriter, r *http.Request, user User) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -1793,7 +1793,7 @@ func route_panel_groups_create_submit(w http.ResponseWriter, r *http.Request, us } func route_panel_themes(w http.ResponseWriter, r *http.Request, user User) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -1828,7 +1828,7 @@ func route_panel_themes(w http.ResponseWriter, r *http.Request, user User) { } func route_panel_themes_set_default(w http.ResponseWriter, r *http.Request, user User, uname string) { - _, ok := SimplePanelSessionCheck(w, r, &user) + _, ok := SimplePanelUserCheck(w, r, &user) if !ok { return } @@ -1909,7 +1909,7 @@ func route_panel_themes_set_default(w http.ResponseWriter, r *http.Request, user } func route_panel_logs_mod(w http.ResponseWriter, r *http.Request, user User) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } @@ -2025,7 +2025,7 @@ func route_panel_logs_mod(w http.ResponseWriter, r *http.Request, user User) { } func route_panel_debug(w http.ResponseWriter, r *http.Request, user User) { - headerVars, stats, ok := PanelSessionCheck(w, r, &user) + headerVars, stats, ok := PanelUserCheck(w, r, &user) if !ok { return } diff --git a/plugin_socialgroups.go b/plugin_socialgroups.go index 418c0b5f..a4db7435 100644 --- a/plugin_socialgroups.go +++ b/plugin_socialgroups.go @@ -282,7 +282,7 @@ func socialgroupsGroupWidgets(headerVars *HeaderVars, sgItem *SocialGroup) (succ */ func socialgroupsGroupList(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -352,7 +352,7 @@ func socialgroupsViewGroup(w http.ResponseWriter, r *http.Request, user User) { } func socialgroupsCreateGroup(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -429,7 +429,7 @@ func socialgroupsCreateGroupSubmit(w http.ResponseWriter, r *http.Request, user } func socialgroupsMemberList(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } diff --git a/routes.go b/routes.go index e131ef12..c1b0d6c4 100644 --- a/routes.go +++ b/routes.go @@ -104,7 +104,7 @@ Disallow: /accounts/ } func route_overview(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -124,7 +124,7 @@ func route_overview(w http.ResponseWriter, r *http.Request, user User) { } func route_custom_page(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -151,7 +151,7 @@ func route_custom_page(w http.ResponseWriter, r *http.Request, user User) { // TODO: Paginate this func route_topics(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -270,7 +270,7 @@ func route_forum(w http.ResponseWriter, r *http.Request, user User, sfid string) return } - headerVars, ok := ForumSessionCheck(w, r, &user, fid) + headerVars, ok := ForumUserCheck(w, r, &user, fid) if !ok { return } @@ -372,7 +372,7 @@ func route_forum(w http.ResponseWriter, r *http.Request, user User, sfid string) } func route_forums(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -453,7 +453,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request, user User) { } topic.ClassName = "" - headerVars, ok := ForumSessionCheck(w, r, &user, topic.ParentID) + headerVars, ok := ForumUserCheck(w, r, &user, topic.ParentID) if !ok { return } @@ -605,7 +605,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request, user User) { } func route_profile(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -714,7 +714,7 @@ func route_topic_create(w http.ResponseWriter, r *http.Request, user User, sfid } } - headerVars, ok := ForumSessionCheck(w, r, &user, fid) + headerVars, ok := ForumUserCheck(w, r, &user, fid) if !ok { return } @@ -790,7 +790,7 @@ func route_topic_create_submit(w http.ResponseWriter, r *http.Request, user User } // TODO: Add hooks to make use of headerLite - _, ok := SimpleForumSessionCheck(w, r, &user, fid) + _, ok := SimpleForumUserCheck(w, r, &user, fid) if !ok { return } @@ -866,7 +866,7 @@ func route_create_reply(w http.ResponseWriter, r *http.Request, user User) { } // TODO: Add hooks to make use of headerLite - _, ok := SimpleForumSessionCheck(w, r, &user, topic.ParentID) + _, ok := SimpleForumUserCheck(w, r, &user, topic.ParentID) if !ok { return } @@ -963,7 +963,7 @@ func route_like_topic(w http.ResponseWriter, r *http.Request, user User) { } // TODO: Add hooks to make use of headerLite - _, ok := SimpleForumSessionCheck(w, r, &user, topic.ParentID) + _, ok := SimpleForumUserCheck(w, r, &user, topic.ParentID) if !ok { return } @@ -1074,7 +1074,7 @@ func route_reply_like_submit(w http.ResponseWriter, r *http.Request, user User) } // TODO: Add hooks to make use of headerLite - _, ok := SimpleForumSessionCheck(w, r, &user, fid) + _, ok := SimpleForumUserCheck(w, r, &user, fid) if !ok { return } @@ -1322,7 +1322,7 @@ func route_report_submit(w http.ResponseWriter, r *http.Request, user User, site } func route_account_own_edit_critical(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -1341,7 +1341,7 @@ func route_account_own_edit_critical(w http.ResponseWriter, r *http.Request, use } func route_account_own_edit_critical_submit(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -1398,7 +1398,7 @@ func route_account_own_edit_critical_submit(w http.ResponseWriter, r *http.Reque } func route_account_own_edit_avatar(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -1422,7 +1422,7 @@ func route_account_own_edit_avatar_submit(w http.ResponseWriter, r *http.Request } r.Body = http.MaxBytesReader(w, r.Body, int64(config.MaxRequestSize)) - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -1514,7 +1514,7 @@ func route_account_own_edit_avatar_submit(w http.ResponseWriter, r *http.Request } func route_account_own_edit_username(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -1532,7 +1532,7 @@ func route_account_own_edit_username(w http.ResponseWriter, r *http.Request, use } func route_account_own_edit_username_submit(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -1572,7 +1572,7 @@ func route_account_own_edit_username_submit(w http.ResponseWriter, r *http.Reque } func route_account_own_edit_email(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -1627,7 +1627,7 @@ func route_account_own_edit_email(w http.ResponseWriter, r *http.Request, user U } func route_account_own_edit_email_token_submit(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -1716,7 +1716,7 @@ func route_logout(w http.ResponseWriter, r *http.Request, user User) { } func route_login(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -1785,7 +1785,7 @@ func route_login_submit(w http.ResponseWriter, r *http.Request, user User) { } func route_register(w http.ResponseWriter, r *http.Request, user User) { - headerVars, ok := SessionCheck(w, r, &user) + headerVars, ok := UserCheck(w, r, &user) if !ok { return } @@ -1803,7 +1803,7 @@ func route_register(w http.ResponseWriter, r *http.Request, user User) { } func route_register_submit(w http.ResponseWriter, r *http.Request, user User) { - headerLite, _ := SimpleSessionCheck(w, r, &user) + headerLite, _ := SimpleUserCheck(w, r, &user) err := r.ParseForm() if err != nil { @@ -1902,7 +1902,7 @@ func route_register_submit(w http.ResponseWriter, r *http.Request, user User) { // TODO: Set the cookie domain func route_change_theme(w http.ResponseWriter, r *http.Request, user User) { - //headerLite, _ := SimpleSessionCheck(w, r, &user) + //headerLite, _ := SimpleUserCheck(w, r, &user) err := r.ParseForm() if err != nil { PreError("Bad Form", w, r) diff --git a/routes_common.go b/routes_common.go index b15f1b4e..f8007d23 100644 --- a/routes_common.go +++ b/routes_common.go @@ -11,14 +11,13 @@ import ( // nolint var PreRoute func(http.ResponseWriter, *http.Request) (User, bool) = preRoute -// TODO: Are these even session checks anymore? We might need to rethink these names // nolint We need these types so people can tell what they are without scrolling to the bottom of the file -var PanelSessionCheck func(http.ResponseWriter, *http.Request, *User) (*HeaderVars, PanelStats, bool) = _panel_session_check -var SimplePanelSessionCheck func(http.ResponseWriter, *http.Request, *User) (*HeaderLite, bool) = _simple_panel_session_check -var SimpleForumSessionCheck func(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerLite *HeaderLite, success bool) = _simple_forum_session_check -var ForumSessionCheck func(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerVars *HeaderVars, success bool) = _forum_session_check -var SimpleSessionCheck func(w http.ResponseWriter, r *http.Request, user *User) (headerLite *HeaderLite, success bool) = _simple_session_check -var SessionCheck func(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, success bool) = _session_check +var PanelUserCheck func(http.ResponseWriter, *http.Request, *User) (*HeaderVars, PanelStats, bool) = panelUserCheck +var SimplePanelUserCheck func(http.ResponseWriter, *http.Request, *User) (*HeaderLite, bool) = simplePanelUserCheck +var SimpleForumUserCheck func(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerLite *HeaderLite, success bool) = simpleForumUserCheck +var ForumUserCheck func(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerVars *HeaderVars, success bool) = forumUserCheck +var SimpleUserCheck func(w http.ResponseWriter, r *http.Request, user *User) (headerLite *HeaderLite, success bool) = simpleUserCheck +var UserCheck func(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, success bool) = userCheck // TODO: Support for left sidebars and sidebars on both sides // http.Request is for context.Context middleware. Mostly for plugin_socialgroups right now @@ -45,7 +44,7 @@ func BuildWidgets(zone string, data interface{}, headerVars *HeaderVars, r *http } } -func _simple_forum_session_check(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerLite *HeaderLite, success bool) { +func simpleForumUserCheck(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerLite *HeaderLite, success bool) { if !fstore.Exists(fid) { PreError("The target forum doesn't exist.", w, r) return nil, false @@ -81,8 +80,8 @@ func _simple_forum_session_check(w http.ResponseWriter, r *http.Request, user *U return headerLite, true } -func _forum_session_check(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerVars *HeaderVars, success bool) { - headerVars, success = SessionCheck(w, r, user) +func forumUserCheck(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerVars *HeaderVars, success bool) { + headerVars, success = UserCheck(w, r, user) if !fstore.Exists(fid) { NotFound(w, r) return headerVars, false @@ -120,7 +119,7 @@ func _forum_session_check(w http.ResponseWriter, r *http.Request, user *User, fi // Even if they have the right permissions, the control panel is only open to supermods+. There are many areas without subpermissions which assume that the current user is a supermod+ and admins are extremely unlikely to give these permissions to someone who isn't at-least a supermod to begin with // TODO: Do a panel specific theme? -func _panel_session_check(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, stats PanelStats, success bool) { +func panelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, stats PanelStats, success bool) { var themeName = defaultThemeBox.Load().(string) cookie, err := r.Cookie("current_theme") @@ -190,7 +189,7 @@ func _panel_session_check(w http.ResponseWriter, r *http.Request, user *User) (h return headerVars, stats, true } -func _simple_panel_session_check(w http.ResponseWriter, r *http.Request, user *User) (headerLite *HeaderLite, success bool) { +func simplePanelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (headerLite *HeaderLite, success bool) { if !user.IsSuperMod { NoPermissions(w, r, *user) return headerLite, false @@ -202,8 +201,8 @@ func _simple_panel_session_check(w http.ResponseWriter, r *http.Request, user *U return headerLite, true } -// SimpleSessionCheck is back from the grave, yay :D -func _simple_session_check(w http.ResponseWriter, r *http.Request, user *User) (headerLite *HeaderLite, success bool) { +// SimpleUserCheck is back from the grave, yay :D +func simpleUserCheck(w http.ResponseWriter, r *http.Request, user *User) (headerLite *HeaderLite, success bool) { headerLite = &HeaderLite{ Site: site, Settings: settingBox.Load().(SettingBox), @@ -212,7 +211,7 @@ func _simple_session_check(w http.ResponseWriter, r *http.Request, user *User) ( } // TODO: Add the ability for admins to restrict certain themes to certain groups? -func _session_check(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, success bool) { +func userCheck(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, success bool) { var themeName = defaultThemeBox.Load().(string) cookie, err := r.Cookie("current_theme")