From ba98b0c952e208667c8ec8d00193e89b0bc3e6e0 Mon Sep 17 00:00:00 2001 From: Azareal Date: Wed, 16 May 2018 20:46:14 +1000 Subject: [PATCH] Added the registration logs. Tweaked the h1 CSS for the Control Panel in Cosora. Improved the support for autocompleters. Reverted some of the int64s back to ints. The per-request user variable should now have the IPs for guests. Removed some obsolete statements. Removed a couple obsolete phrases. Moved a couple more accumulator initializers out of the store initializers. Refactored one of the report statements to use a store instead of a statement. Created the menuhead CSS class. Added the GetOffset method to the LogStore interface and refactored the mod and admin log pages to use it. Changed the labels on the adminlog and modlog pages to make them more understandable. Removed the generated templates from Git. Run the patcher / update script to get the new table. --- common/audit_logs.go | 68 +- common/common.go | 20 +- common/misc_logs.go | 93 ++ common/pages.go | 19 +- common/routes_common.go | 9 +- common/site.go | 2 +- common/utils.go | 12 +- gen_mssql.go | 54 - gen_mysql.go | 48 - gen_pgsql.go | 8 - gen_router.go | 282 ++-- langs/english.json | 20 +- main.go | 8 +- member_routes.go | 4 +- panel_routes.go | 80 +- patcher/main.go | 63 +- patcher/patches.go | 29 + patcher/utils.go | 45 + query_gen/main.go | 14 +- query_gen/tables.go | 26 +- router_gen/routes.go | 1 + routes/account.go | 70 +- schema/mssql/query_registration_logs.sql | 10 + schema/mysql/query_registration_logs.sql | 10 + schema/pgsql/query_registration_logs.sql | 10 + schema/schema.json | 2 +- template_error.go | 121 -- template_forum.go | 370 ----- template_forums.go | 174 --- template_guilds_guild_list.go | 133 -- template_ip_search.go | 154 -- template_list.go | 1720 ---------------------- template_login.go | 134 -- template_profile.go | 347 ----- template_register.go | 137 -- template_topic.go | 590 -------- template_topic_alt.go | 583 -------- template_topics.go | 388 ----- templates/account_menu.html | 2 +- templates/account_own_edit.html | 6 +- templates/panel-inner-menu.html | 1 + templates/panel-user-edit.html | 2 +- templates/panel_reglogs.html | 27 + templates/register.html | 2 +- themes/cosora/public/main.css | 7 +- 45 files changed, 621 insertions(+), 5284 deletions(-) create mode 100644 common/misc_logs.go create mode 100644 patcher/utils.go create mode 100644 schema/mssql/query_registration_logs.sql create mode 100644 schema/mysql/query_registration_logs.sql create mode 100644 schema/pgsql/query_registration_logs.sql delete mode 100644 template_error.go delete mode 100644 template_forum.go delete mode 100644 template_forums.go delete mode 100644 template_guilds_guild_list.go delete mode 100644 template_ip_search.go delete mode 100644 template_list.go delete mode 100644 template_login.go delete mode 100644 template_profile.go delete mode 100644 template_register.go delete mode 100644 template_topic.go delete mode 100644 template_topic_alt.go delete mode 100644 template_topics.go create mode 100644 templates/panel_reglogs.html diff --git a/common/audit_logs.go b/common/audit_logs.go index d4fe5b6e..f10fbcb1 100644 --- a/common/audit_logs.go +++ b/common/audit_logs.go @@ -9,21 +9,32 @@ import ( var ModLogs LogStore var AdminLogs LogStore +type LogItem struct { + Action string + ElementID int + ElementType string + IPAddress string + ActorID int + DoneAt string +} + type LogStore interface { Create(action string, elementID int, elementType string, ipaddress string, actorID int) (err error) GlobalCount() int + GetOffset(offset int, perPage int) (logs []LogItem, err error) } type SQLModLogStore struct { - create *sql.Stmt - count *sql.Stmt + create *sql.Stmt + count *sql.Stmt + getOffset *sql.Stmt } -func NewModLogStore() (*SQLModLogStore, error) { - acc := qgen.Builder.Accumulator() +func NewModLogStore(acc *qgen.Accumulator) (*SQLModLogStore, error) { return &SQLModLogStore{ - create: acc.Insert("moderation_logs").Columns("action, elementID, elementType, ipaddress, actorID, doneAt").Fields("?,?,?,?,?,UTC_TIMESTAMP()").Prepare(), - count: acc.Count("moderation_logs").Prepare(), + create: acc.Insert("moderation_logs").Columns("action, elementID, elementType, ipaddress, actorID, doneAt").Fields("?,?,?,?,?,UTC_TIMESTAMP()").Prepare(), + count: acc.Count("moderation_logs").Prepare(), + getOffset: acc.Select("moderation_logs").Columns("action, elementID, elementType, ipaddress, actorID, doneAt").Orderby("doneAt DESC").Limit("?,?").Prepare(), }, acc.FirstError() } @@ -41,16 +52,38 @@ func (store *SQLModLogStore) GlobalCount() (logCount int) { return logCount } -type SQLAdminLogStore struct { - create *sql.Stmt - count *sql.Stmt +func buildLogList(rows *sql.Rows) (logs []LogItem, err error) { + for rows.Next() { + var log LogItem + err := rows.Scan(&log.Action, &log.ElementID, &log.ElementType, &log.IPAddress, &log.ActorID, &log.DoneAt) + if err != nil { + return logs, err + } + logs = append(logs, log) + } + return logs, rows.Err() } -func NewAdminLogStore() (*SQLAdminLogStore, error) { - acc := qgen.Builder.Accumulator() +func (store *SQLModLogStore) GetOffset(offset int, perPage int) (logs []LogItem, err error) { + rows, err := store.getOffset.Query(offset, perPage) + if err != nil { + return logs, err + } + defer rows.Close() + return buildLogList(rows) +} + +type SQLAdminLogStore struct { + create *sql.Stmt + count *sql.Stmt + getOffset *sql.Stmt +} + +func NewAdminLogStore(acc *qgen.Accumulator) (*SQLAdminLogStore, error) { return &SQLAdminLogStore{ - create: acc.Insert("administration_logs").Columns("action, elementID, elementType, ipaddress, actorID, doneAt").Fields("?,?,?,?,?,UTC_TIMESTAMP()").Prepare(), - count: acc.Count("administration_logs").Prepare(), + create: acc.Insert("administration_logs").Columns("action, elementID, elementType, ipaddress, actorID, doneAt").Fields("?,?,?,?,?,UTC_TIMESTAMP()").Prepare(), + count: acc.Count("administration_logs").Prepare(), + getOffset: acc.Select("administration_logs").Columns("action, elementID, elementType, ipaddress, actorID, doneAt").Orderby("doneAt DESC").Limit("?,?").Prepare(), }, acc.FirstError() } @@ -67,3 +100,12 @@ func (store *SQLAdminLogStore) GlobalCount() (logCount int) { } return logCount } + +func (store *SQLAdminLogStore) GetOffset(offset int, perPage int) (logs []LogItem, err error) { + rows, err := store.getOffset.Query(offset, perPage) + if err != nil { + return logs, err + } + defer rows.Close() + return buildLogList(rows) +} diff --git a/common/common.go b/common/common.go index 81fd62d4..f19bd51a 100644 --- a/common/common.go +++ b/common/common.go @@ -8,16 +8,16 @@ import ( ) // nolint I don't want to write comments for each of these o.o -const Hour int64 = 60 * 60 -const Day int64 = Hour * 24 -const Week int64 = Day * 7 -const Month int64 = Day * 30 -const Year int64 = Day * 365 -const Kilobyte int64 = 1024 -const Megabyte int64 = Kilobyte * 1024 -const Gigabyte int64 = Megabyte * 1024 -const Terabyte int64 = Gigabyte * 1024 -const Petabyte int64 = Terabyte * 1024 +const Hour int = 60 * 60 +const Day int = Hour * 24 +const Week int = Day * 7 +const Month int = Day * 30 +const Year int = Day * 365 +const Kilobyte int = 1024 +const Megabyte int = Kilobyte * 1024 +const Gigabyte int = Megabyte * 1024 +const Terabyte int = Gigabyte * 1024 +const Petabyte int = Terabyte * 1024 const SaltLength int = 32 const SessionLength int = 80 diff --git a/common/misc_logs.go b/common/misc_logs.go new file mode 100644 index 00000000..290e9037 --- /dev/null +++ b/common/misc_logs.go @@ -0,0 +1,93 @@ +package common + +import "database/sql" +import "../query_gen/lib" + +var RegLogs RegLogStore + +type RegLogItem struct { + ID int + Username string + Email string + FailureReason string + Success bool + IPAddress string + DoneAt string +} + +type RegLogStmts struct { + update *sql.Stmt + create *sql.Stmt +} + +var regLogStmts RegLogStmts + +func init() { + DbInits.Add(func(acc *qgen.Accumulator) error { + regLogStmts = RegLogStmts{ + update: acc.Update("registration_logs").Set("username = ?, email = ?, failureReason = ?, success = ?").Where("rlid = ?").Prepare(), + create: acc.Insert("registration_logs").Columns("username, email, failureReason, success, ipaddress, doneAt").Fields("?,?,?,?,?,UTC_TIMESTAMP()").Prepare(), + } + return acc.FirstError() + }) +} + +// TODO: Reload this item in the store, probably doesn't matter right now, but it might when we start caching this stuff in memory +// ! Retroactive updates of date are not permitted for integrity reasons +func (log *RegLogItem) Commit() error { + _, err := regLogStmts.update.Exec(log.Username, log.Email, log.FailureReason, log.Success, log.ID) + return err +} + +func (log *RegLogItem) Create() (id int, err error) { + res, err := regLogStmts.create.Exec(log.Username, log.Email, log.FailureReason, log.Success, log.IPAddress) + if err != nil { + return 0, err + } + id64, err := res.LastInsertId() + log.ID = int(id64) + return log.ID, err +} + +type RegLogStore interface { + GlobalCount() (logCount int) + GetOffset(offset int, perPage int) (logs []RegLogItem, err error) +} + +type SQLRegLogStore struct { + count *sql.Stmt + getOffset *sql.Stmt +} + +func NewRegLogStore(acc *qgen.Accumulator) (*SQLRegLogStore, error) { + return &SQLRegLogStore{ + count: acc.Count("registration_logs").Prepare(), + getOffset: acc.Select("registration_logs").Columns("rlid, username, email, failureReason, success, ipaddress, doneAt").Orderby("doneAt DESC").Limit("?,?").Prepare(), + }, acc.FirstError() +} + +func (store *SQLRegLogStore) GlobalCount() (logCount int) { + err := store.count.QueryRow().Scan(&logCount) + if err != nil { + LogError(err) + } + return logCount +} + +func (store *SQLRegLogStore) GetOffset(offset int, perPage int) (logs []RegLogItem, err error) { + rows, err := store.getOffset.Query(offset, perPage) + if err != nil { + return logs, err + } + defer rows.Close() + + for rows.Next() { + var log RegLogItem + err := rows.Scan(&log.ID, &log.Username, &log.Email, &log.FailureReason, &log.Success, &log.IPAddress, &log.DoneAt) + if err != nil { + return logs, err + } + logs = append(logs, log) + } + return logs, rows.Err() +} diff --git a/common/pages.go b/common/pages.go index c464dc61..a86cce6c 100644 --- a/common/pages.go +++ b/common/pages.go @@ -383,7 +383,7 @@ type PanelBackupPage struct { Backups []BackupItem } -type LogItem struct { +type PageLogItem struct { Action template.HTML IPAddress string DoneAt string @@ -395,7 +395,22 @@ type PanelLogsPage struct { Header *Header Stats PanelStats Zone string - Logs []LogItem + Logs []PageLogItem + Paginator +} + +type PageRegLogItem struct { + RegLogItem + ParsedReason string +} + +type PanelRegLogsPage struct { + Title string + CurrentUser User + Header *Header + Stats PanelStats + Zone string + Logs []PageRegLogItem Paginator } diff --git a/common/routes_common.go b/common/routes_common.go index ccd6a7bd..923cc9df 100644 --- a/common/routes_common.go +++ b/common/routes_common.go @@ -263,10 +263,6 @@ func preRoute(w http.ResponseWriter, r *http.Request) (User, bool) { if halt { return *user, false } - if user == &GuestUser { - return *user, true - } - var usercpy *User = BlankUser() *usercpy = *user @@ -276,6 +272,11 @@ func preRoute(w http.ResponseWriter, r *http.Request) (User, bool) { PreError("Bad IP", w, r) return *usercpy, false } + if user == &GuestUser { + usercpy.LastIP = host + return *usercpy, true + } + if host != usercpy.LastIP { err = usercpy.UpdateIP(host) if err != nil { diff --git a/common/site.go b/common/site.go index 3b2ddb5d..22b237c5 100644 --- a/common/site.go +++ b/common/site.go @@ -52,7 +52,7 @@ type config struct { SslPrivkey string SslFullchain string - MaxRequestSize int64 + MaxRequestSize int CacheTopicUser int UserCacheCapacity int TopicCacheCapacity int diff --git a/common/utils.go b/common/utils.go index 8071d2d6..50fd7ab6 100644 --- a/common/utils.go +++ b/common/utils.go @@ -151,8 +151,8 @@ func ConvertByteInUnit(bytes float64, unit string) (count float64) { // TODO: Re-add T as int64 func ConvertUnit(num int) (int, string) { switch { - //case num >= 1000000000000: - // return num / 1000000000000, "T" + case num >= 1000000000000: + return num / 1000000000000, "T" case num >= 1000000000: return num / 1000000000, "B" case num >= 1000000: @@ -169,10 +169,10 @@ func ConvertUnit(num int) (int, string) { // TODO: Re-add trillion as int64 func ConvertFriendlyUnit(num int) (int, string) { switch { - //case num >= 1000000000000000: - // return 0, " quadrillion" - //case num >= 1000000000000: - // return 0, " trillion" + case num >= 1000000000000000: + return 0, " quadrillion" + case num >= 1000000000000: + return 0, " trillion" case num >= 1000000000: return num / 1000000000, " billion" case num >= 1000000: diff --git a/gen_mssql.go b/gen_mssql.go index a4439713..3d9996c1 100644 --- a/gen_mssql.go +++ b/gen_mssql.go @@ -12,11 +12,6 @@ type Stmts struct { isPluginActive *sql.Stmt getUsersOffset *sql.Stmt isThemeDefault *sql.Stmt - getModlogs *sql.Stmt - getModlogsOffset *sql.Stmt - getAdminlogsOffset *sql.Stmt - getTopicFID *sql.Stmt - getUserName *sql.Stmt getEmailsByUser *sql.Stmt getTopicBasic *sql.Stmt forumEntryExists *sql.Stmt @@ -27,7 +22,6 @@ type Stmts struct { addPlugin *sql.Stmt addTheme *sql.Stmt createWordFilter *sql.Stmt - editReply *sql.Stmt updatePlugin *sql.Stmt updatePluginInstall *sql.Stmt updateTheme *sql.Stmt @@ -81,46 +75,6 @@ func _gen_mssql() (err error) { return err } - common.DebugLog("Preparing getModlogs statement.") - stmts.getModlogs, err = db.Prepare("SELECT [action],[elementID],[elementType],[ipaddress],[actorID],[doneAt] FROM [moderation_logs]") - if err != nil { - log.Print("Error in getModlogs statement.") - log.Print("Bad Query: ","SELECT [action],[elementID],[elementType],[ipaddress],[actorID],[doneAt] FROM [moderation_logs]") - return err - } - - common.DebugLog("Preparing getModlogsOffset statement.") - stmts.getModlogsOffset, err = db.Prepare("SELECT [action],[elementID],[elementType],[ipaddress],[actorID],[doneAt] FROM [moderation_logs] ORDER BY doneAt DESC OFFSET ?1 ROWS FETCH NEXT ?2 ROWS ONLY") - if err != nil { - log.Print("Error in getModlogsOffset statement.") - log.Print("Bad Query: ","SELECT [action],[elementID],[elementType],[ipaddress],[actorID],[doneAt] FROM [moderation_logs] ORDER BY doneAt DESC OFFSET ?1 ROWS FETCH NEXT ?2 ROWS ONLY") - return err - } - - common.DebugLog("Preparing getAdminlogsOffset statement.") - stmts.getAdminlogsOffset, err = db.Prepare("SELECT [action],[elementID],[elementType],[ipaddress],[actorID],[doneAt] FROM [administration_logs] ORDER BY doneAt DESC OFFSET ?1 ROWS FETCH NEXT ?2 ROWS ONLY") - if err != nil { - log.Print("Error in getAdminlogsOffset statement.") - log.Print("Bad Query: ","SELECT [action],[elementID],[elementType],[ipaddress],[actorID],[doneAt] FROM [administration_logs] ORDER BY doneAt DESC OFFSET ?1 ROWS FETCH NEXT ?2 ROWS ONLY") - return err - } - - common.DebugLog("Preparing getTopicFID statement.") - stmts.getTopicFID, err = db.Prepare("SELECT [parentID] FROM [topics] WHERE [tid] = ?1") - if err != nil { - log.Print("Error in getTopicFID statement.") - log.Print("Bad Query: ","SELECT [parentID] FROM [topics] WHERE [tid] = ?1") - return err - } - - common.DebugLog("Preparing getUserName statement.") - stmts.getUserName, err = db.Prepare("SELECT [name] FROM [users] WHERE [uid] = ?1") - if err != nil { - log.Print("Error in getUserName statement.") - log.Print("Bad Query: ","SELECT [name] FROM [users] WHERE [uid] = ?1") - return err - } - common.DebugLog("Preparing getEmailsByUser statement.") stmts.getEmailsByUser, err = db.Prepare("SELECT [email],[validated],[token] FROM [emails] WHERE [uid] = ?1") if err != nil { @@ -201,14 +155,6 @@ func _gen_mssql() (err error) { return err } - common.DebugLog("Preparing editReply statement.") - stmts.editReply, err = db.Prepare("UPDATE [replies] SET [content] = ?,[parsed_content] = ? WHERE [rid] = ?") - if err != nil { - log.Print("Error in editReply statement.") - log.Print("Bad Query: ","UPDATE [replies] SET [content] = ?,[parsed_content] = ? WHERE [rid] = ?") - return err - } - common.DebugLog("Preparing updatePlugin statement.") stmts.updatePlugin, err = db.Prepare("UPDATE [plugins] SET [active] = ? WHERE [uname] = ?") if err != nil { diff --git a/gen_mysql.go b/gen_mysql.go index f40d843a..6c298656 100644 --- a/gen_mysql.go +++ b/gen_mysql.go @@ -14,11 +14,6 @@ type Stmts struct { isPluginActive *sql.Stmt getUsersOffset *sql.Stmt isThemeDefault *sql.Stmt - getModlogs *sql.Stmt - getModlogsOffset *sql.Stmt - getAdminlogsOffset *sql.Stmt - getTopicFID *sql.Stmt - getUserName *sql.Stmt getEmailsByUser *sql.Stmt getTopicBasic *sql.Stmt forumEntryExists *sql.Stmt @@ -29,7 +24,6 @@ type Stmts struct { addPlugin *sql.Stmt addTheme *sql.Stmt createWordFilter *sql.Stmt - editReply *sql.Stmt updatePlugin *sql.Stmt updatePluginInstall *sql.Stmt updateTheme *sql.Stmt @@ -80,41 +74,6 @@ func _gen_mysql() (err error) { return err } - common.DebugLog("Preparing getModlogs statement.") - stmts.getModlogs, err = db.Prepare("SELECT `action`,`elementID`,`elementType`,`ipaddress`,`actorID`,`doneAt` FROM `moderation_logs`") - if err != nil { - log.Print("Error in getModlogs statement.") - return err - } - - common.DebugLog("Preparing getModlogsOffset statement.") - stmts.getModlogsOffset, err = db.Prepare("SELECT `action`,`elementID`,`elementType`,`ipaddress`,`actorID`,`doneAt` FROM `moderation_logs` ORDER BY `doneAt` DESC LIMIT ?,?") - if err != nil { - log.Print("Error in getModlogsOffset statement.") - return err - } - - common.DebugLog("Preparing getAdminlogsOffset statement.") - stmts.getAdminlogsOffset, err = db.Prepare("SELECT `action`,`elementID`,`elementType`,`ipaddress`,`actorID`,`doneAt` FROM `administration_logs` ORDER BY `doneAt` DESC LIMIT ?,?") - if err != nil { - log.Print("Error in getAdminlogsOffset statement.") - return err - } - - common.DebugLog("Preparing getTopicFID statement.") - stmts.getTopicFID, err = db.Prepare("SELECT `parentID` FROM `topics` WHERE `tid` = ?") - if err != nil { - log.Print("Error in getTopicFID statement.") - return err - } - - common.DebugLog("Preparing getUserName statement.") - stmts.getUserName, err = db.Prepare("SELECT `name` FROM `users` WHERE `uid` = ?") - if err != nil { - log.Print("Error in getUserName statement.") - return err - } - common.DebugLog("Preparing getEmailsByUser statement.") stmts.getEmailsByUser, err = db.Prepare("SELECT `email`,`validated`,`token` FROM `emails` WHERE `uid` = ?") if err != nil { @@ -185,13 +144,6 @@ func _gen_mysql() (err error) { return err } - common.DebugLog("Preparing editReply statement.") - stmts.editReply, err = db.Prepare("UPDATE `replies` SET `content` = ?,`parsed_content` = ? WHERE `rid` = ?") - if err != nil { - log.Print("Error in editReply statement.") - return err - } - common.DebugLog("Preparing updatePlugin statement.") stmts.updatePlugin, err = db.Prepare("UPDATE `plugins` SET `active` = ? WHERE `uname` = ?") if err != nil { diff --git a/gen_pgsql.go b/gen_pgsql.go index 2d228b47..3f09bc61 100644 --- a/gen_pgsql.go +++ b/gen_pgsql.go @@ -9,7 +9,6 @@ import "./common" // nolint type Stmts struct { - editReply *sql.Stmt updatePlugin *sql.Stmt updatePluginInstall *sql.Stmt updateTheme *sql.Stmt @@ -36,13 +35,6 @@ type Stmts struct { func _gen_pgsql() (err error) { common.DebugLog("Building the generated statements") - common.DebugLog("Preparing editReply statement.") - stmts.editReply, err = db.Prepare("UPDATE `replies` SET `content` = ?,`parsed_content` = ? WHERE `rid` = ?") - if err != nil { - log.Print("Error in editReply statement.") - return err - } - common.DebugLog("Preparing updatePlugin statement.") stmts.updatePlugin, err = db.Prepare("UPDATE `plugins` SET `active` = ? WHERE `uname` = ?") if err != nil { diff --git a/gen_router.go b/gen_router.go index bff1313d..b73e0216 100644 --- a/gen_router.go +++ b/gen_router.go @@ -85,6 +85,7 @@ var RouteMap = map[string]interface{}{ "routePanelGroupsEditPermsSubmit": routePanelGroupsEditPermsSubmit, "routePanelGroupsCreateSubmit": routePanelGroupsCreateSubmit, "routePanelBackups": routePanelBackups, + "routePanelLogsRegs": routePanelLogsRegs, "routePanelLogsMod": routePanelLogsMod, "routePanelDebug": routePanelDebug, "routePanelDashboard": routePanelDashboard, @@ -201,52 +202,53 @@ var routeMapEnum = map[string]int{ "routePanelGroupsEditPermsSubmit": 63, "routePanelGroupsCreateSubmit": 64, "routePanelBackups": 65, - "routePanelLogsMod": 66, - "routePanelDebug": 67, - "routePanelDashboard": 68, - "routes.AccountEditCritical": 69, - "routes.AccountEditCriticalSubmit": 70, - "routes.AccountEditAvatar": 71, - "routes.AccountEditAvatarSubmit": 72, - "routes.AccountEditUsername": 73, - "routes.AccountEditUsernameSubmit": 74, - "routeAccountEditEmail": 75, - "routeAccountEditEmailTokenSubmit": 76, - "routes.ViewProfile": 77, - "routes.BanUserSubmit": 78, - "routes.UnbanUser": 79, - "routes.ActivateUser": 80, - "routes.IPSearch": 81, - "routes.CreateTopicSubmit": 82, - "routes.EditTopicSubmit": 83, - "routes.DeleteTopicSubmit": 84, - "routes.StickTopicSubmit": 85, - "routes.UnstickTopicSubmit": 86, - "routes.LockTopicSubmit": 87, - "routes.UnlockTopicSubmit": 88, - "routes.MoveTopicSubmit": 89, - "routes.LikeTopicSubmit": 90, - "routes.ViewTopic": 91, - "routes.CreateReplySubmit": 92, - "routes.ReplyEditSubmit": 93, - "routes.ReplyDeleteSubmit": 94, - "routes.ReplyLikeSubmit": 95, - "routes.ProfileReplyCreateSubmit": 96, - "routes.ProfileReplyEditSubmit": 97, - "routes.ProfileReplyDeleteSubmit": 98, - "routes.PollVote": 99, - "routes.PollResults": 100, - "routes.AccountLogin": 101, - "routes.AccountRegister": 102, - "routes.AccountLogout": 103, - "routes.AccountLoginSubmit": 104, - "routes.AccountRegisterSubmit": 105, - "routes.DynamicRoute": 106, - "routes.UploadedFile": 107, - "routes.StaticFile": 108, - "routes.RobotsTxt": 109, - "routes.SitemapXml": 110, - "routes.BadRoute": 111, + "routePanelLogsRegs": 66, + "routePanelLogsMod": 67, + "routePanelDebug": 68, + "routePanelDashboard": 69, + "routes.AccountEditCritical": 70, + "routes.AccountEditCriticalSubmit": 71, + "routes.AccountEditAvatar": 72, + "routes.AccountEditAvatarSubmit": 73, + "routes.AccountEditUsername": 74, + "routes.AccountEditUsernameSubmit": 75, + "routeAccountEditEmail": 76, + "routeAccountEditEmailTokenSubmit": 77, + "routes.ViewProfile": 78, + "routes.BanUserSubmit": 79, + "routes.UnbanUser": 80, + "routes.ActivateUser": 81, + "routes.IPSearch": 82, + "routes.CreateTopicSubmit": 83, + "routes.EditTopicSubmit": 84, + "routes.DeleteTopicSubmit": 85, + "routes.StickTopicSubmit": 86, + "routes.UnstickTopicSubmit": 87, + "routes.LockTopicSubmit": 88, + "routes.UnlockTopicSubmit": 89, + "routes.MoveTopicSubmit": 90, + "routes.LikeTopicSubmit": 91, + "routes.ViewTopic": 92, + "routes.CreateReplySubmit": 93, + "routes.ReplyEditSubmit": 94, + "routes.ReplyDeleteSubmit": 95, + "routes.ReplyLikeSubmit": 96, + "routes.ProfileReplyCreateSubmit": 97, + "routes.ProfileReplyEditSubmit": 98, + "routes.ProfileReplyDeleteSubmit": 99, + "routes.PollVote": 100, + "routes.PollResults": 101, + "routes.AccountLogin": 102, + "routes.AccountRegister": 103, + "routes.AccountLogout": 104, + "routes.AccountLoginSubmit": 105, + "routes.AccountRegisterSubmit": 106, + "routes.DynamicRoute": 107, + "routes.UploadedFile": 108, + "routes.StaticFile": 109, + "routes.RobotsTxt": 110, + "routes.SitemapXml": 111, + "routes.BadRoute": 112, } var reverseRouteMapEnum = map[int]string{ 0: "routeAPI", @@ -315,52 +317,53 @@ var reverseRouteMapEnum = map[int]string{ 63: "routePanelGroupsEditPermsSubmit", 64: "routePanelGroupsCreateSubmit", 65: "routePanelBackups", - 66: "routePanelLogsMod", - 67: "routePanelDebug", - 68: "routePanelDashboard", - 69: "routes.AccountEditCritical", - 70: "routes.AccountEditCriticalSubmit", - 71: "routes.AccountEditAvatar", - 72: "routes.AccountEditAvatarSubmit", - 73: "routes.AccountEditUsername", - 74: "routes.AccountEditUsernameSubmit", - 75: "routeAccountEditEmail", - 76: "routeAccountEditEmailTokenSubmit", - 77: "routes.ViewProfile", - 78: "routes.BanUserSubmit", - 79: "routes.UnbanUser", - 80: "routes.ActivateUser", - 81: "routes.IPSearch", - 82: "routes.CreateTopicSubmit", - 83: "routes.EditTopicSubmit", - 84: "routes.DeleteTopicSubmit", - 85: "routes.StickTopicSubmit", - 86: "routes.UnstickTopicSubmit", - 87: "routes.LockTopicSubmit", - 88: "routes.UnlockTopicSubmit", - 89: "routes.MoveTopicSubmit", - 90: "routes.LikeTopicSubmit", - 91: "routes.ViewTopic", - 92: "routes.CreateReplySubmit", - 93: "routes.ReplyEditSubmit", - 94: "routes.ReplyDeleteSubmit", - 95: "routes.ReplyLikeSubmit", - 96: "routes.ProfileReplyCreateSubmit", - 97: "routes.ProfileReplyEditSubmit", - 98: "routes.ProfileReplyDeleteSubmit", - 99: "routes.PollVote", - 100: "routes.PollResults", - 101: "routes.AccountLogin", - 102: "routes.AccountRegister", - 103: "routes.AccountLogout", - 104: "routes.AccountLoginSubmit", - 105: "routes.AccountRegisterSubmit", - 106: "routes.DynamicRoute", - 107: "routes.UploadedFile", - 108: "routes.StaticFile", - 109: "routes.RobotsTxt", - 110: "routes.SitemapXml", - 111: "routes.BadRoute", + 66: "routePanelLogsRegs", + 67: "routePanelLogsMod", + 68: "routePanelDebug", + 69: "routePanelDashboard", + 70: "routes.AccountEditCritical", + 71: "routes.AccountEditCriticalSubmit", + 72: "routes.AccountEditAvatar", + 73: "routes.AccountEditAvatarSubmit", + 74: "routes.AccountEditUsername", + 75: "routes.AccountEditUsernameSubmit", + 76: "routeAccountEditEmail", + 77: "routeAccountEditEmailTokenSubmit", + 78: "routes.ViewProfile", + 79: "routes.BanUserSubmit", + 80: "routes.UnbanUser", + 81: "routes.ActivateUser", + 82: "routes.IPSearch", + 83: "routes.CreateTopicSubmit", + 84: "routes.EditTopicSubmit", + 85: "routes.DeleteTopicSubmit", + 86: "routes.StickTopicSubmit", + 87: "routes.UnstickTopicSubmit", + 88: "routes.LockTopicSubmit", + 89: "routes.UnlockTopicSubmit", + 90: "routes.MoveTopicSubmit", + 91: "routes.LikeTopicSubmit", + 92: "routes.ViewTopic", + 93: "routes.CreateReplySubmit", + 94: "routes.ReplyEditSubmit", + 95: "routes.ReplyDeleteSubmit", + 96: "routes.ReplyLikeSubmit", + 97: "routes.ProfileReplyCreateSubmit", + 98: "routes.ProfileReplyEditSubmit", + 99: "routes.ProfileReplyDeleteSubmit", + 100: "routes.PollVote", + 101: "routes.PollResults", + 102: "routes.AccountLogin", + 103: "routes.AccountRegister", + 104: "routes.AccountLogout", + 105: "routes.AccountLoginSubmit", + 106: "routes.AccountRegisterSubmit", + 107: "routes.DynamicRoute", + 108: "routes.UploadedFile", + 109: "routes.StaticFile", + 110: "routes.RobotsTxt", + 111: "routes.SitemapXml", + 112: "routes.BadRoute", } var osMapEnum = map[string]int{ "unknown": 0, @@ -656,7 +659,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { counters.GlobalViewCounter.Bump() if prefix == "/static" { - counters.RouteViewCounter.Bump(108) + counters.RouteViewCounter.Bump(109) req.URL.Path += extraData routes.StaticFile(w, req) return @@ -1293,8 +1296,11 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { counters.RouteViewCounter.Bump(65) err = routePanelBackups(w,req,user,extraData) - case "/panel/logs/mod/": + case "/panel/logs/regs/": counters.RouteViewCounter.Bump(66) + err = routePanelLogsRegs(w,req,user) + case "/panel/logs/mod/": + counters.RouteViewCounter.Bump(67) err = routePanelLogsMod(w,req,user) case "/panel/debug/": err = common.AdminOnly(w,req,user) @@ -1303,10 +1309,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(67) + counters.RouteViewCounter.Bump(68) err = routePanelDebug(w,req,user) default: - counters.RouteViewCounter.Bump(68) + counters.RouteViewCounter.Bump(69) err = routePanelDashboard(w,req,user) } if err != nil { @@ -1321,7 +1327,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(69) + counters.RouteViewCounter.Bump(70) err = routes.AccountEditCritical(w,req,user) case "/user/edit/critical/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1336,7 +1342,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(70) + counters.RouteViewCounter.Bump(71) err = routes.AccountEditCriticalSubmit(w,req,user) case "/user/edit/avatar/": err = common.MemberOnly(w,req,user) @@ -1345,7 +1351,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(71) + counters.RouteViewCounter.Bump(72) err = routes.AccountEditAvatar(w,req,user) case "/user/edit/avatar/submit/": err = common.MemberOnly(w,req,user) @@ -1365,7 +1371,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(72) + counters.RouteViewCounter.Bump(73) err = routes.AccountEditAvatarSubmit(w,req,user) case "/user/edit/username/": err = common.MemberOnly(w,req,user) @@ -1374,7 +1380,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(73) + counters.RouteViewCounter.Bump(74) err = routes.AccountEditUsername(w,req,user) case "/user/edit/username/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1389,7 +1395,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(74) + counters.RouteViewCounter.Bump(75) err = routes.AccountEditUsernameSubmit(w,req,user) case "/user/edit/email/": err = common.MemberOnly(w,req,user) @@ -1398,7 +1404,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(75) + counters.RouteViewCounter.Bump(76) err = routeAccountEditEmail(w,req,user) case "/user/edit/token/": err = common.NoSessionMismatch(w,req,user) @@ -1413,11 +1419,11 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(76) + counters.RouteViewCounter.Bump(77) err = routeAccountEditEmailTokenSubmit(w,req,user,extraData) default: req.URL.Path += extraData - counters.RouteViewCounter.Bump(77) + counters.RouteViewCounter.Bump(78) err = routes.ViewProfile(w,req,user) } if err != nil { @@ -1438,7 +1444,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(78) + counters.RouteViewCounter.Bump(79) err = routes.BanUserSubmit(w,req,user,extraData) case "/users/unban/": err = common.NoSessionMismatch(w,req,user) @@ -1453,7 +1459,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(79) + counters.RouteViewCounter.Bump(80) err = routes.UnbanUser(w,req,user,extraData) case "/users/activate/": err = common.NoSessionMismatch(w,req,user) @@ -1468,7 +1474,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(80) + counters.RouteViewCounter.Bump(81) err = routes.ActivateUser(w,req,user,extraData) case "/users/ips/": err = common.MemberOnly(w,req,user) @@ -1477,7 +1483,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(81) + counters.RouteViewCounter.Bump(82) err = routes.IPSearch(w,req,user) } if err != nil { @@ -1503,7 +1509,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(82) + counters.RouteViewCounter.Bump(83) err = routes.CreateTopicSubmit(w,req,user) case "/topic/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1518,7 +1524,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(83) + counters.RouteViewCounter.Bump(84) err = routes.EditTopicSubmit(w,req,user,extraData) case "/topic/delete/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1534,7 +1540,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { } req.URL.Path += extraData - counters.RouteViewCounter.Bump(84) + counters.RouteViewCounter.Bump(85) err = routes.DeleteTopicSubmit(w,req,user) case "/topic/stick/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1549,7 +1555,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(85) + counters.RouteViewCounter.Bump(86) err = routes.StickTopicSubmit(w,req,user,extraData) case "/topic/unstick/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1564,7 +1570,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(86) + counters.RouteViewCounter.Bump(87) err = routes.UnstickTopicSubmit(w,req,user,extraData) case "/topic/lock/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1580,7 +1586,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { } req.URL.Path += extraData - counters.RouteViewCounter.Bump(87) + counters.RouteViewCounter.Bump(88) err = routes.LockTopicSubmit(w,req,user) case "/topic/unlock/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1595,7 +1601,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(88) + counters.RouteViewCounter.Bump(89) err = routes.UnlockTopicSubmit(w,req,user,extraData) case "/topic/move/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1610,7 +1616,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(89) + counters.RouteViewCounter.Bump(90) err = routes.MoveTopicSubmit(w,req,user,extraData) case "/topic/like/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1631,10 +1637,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(90) + counters.RouteViewCounter.Bump(91) err = routes.LikeTopicSubmit(w,req,user,extraData) default: - counters.RouteViewCounter.Bump(91) + counters.RouteViewCounter.Bump(92) err = routes.ViewTopic(w,req,user, extraData) } if err != nil { @@ -1660,7 +1666,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(92) + counters.RouteViewCounter.Bump(93) err = routes.CreateReplySubmit(w,req,user) case "/reply/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1675,7 +1681,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(93) + counters.RouteViewCounter.Bump(94) err = routes.ReplyEditSubmit(w,req,user,extraData) case "/reply/delete/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1690,7 +1696,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(94) + counters.RouteViewCounter.Bump(95) err = routes.ReplyDeleteSubmit(w,req,user,extraData) case "/reply/like/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1711,7 +1717,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(95) + counters.RouteViewCounter.Bump(96) err = routes.ReplyLikeSubmit(w,req,user,extraData) } if err != nil { @@ -1732,7 +1738,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(96) + counters.RouteViewCounter.Bump(97) err = routes.ProfileReplyCreateSubmit(w,req,user) case "/profile/reply/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1747,7 +1753,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(97) + counters.RouteViewCounter.Bump(98) err = routes.ProfileReplyEditSubmit(w,req,user,extraData) case "/profile/reply/delete/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1762,7 +1768,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(98) + counters.RouteViewCounter.Bump(99) err = routes.ProfileReplyDeleteSubmit(w,req,user,extraData) } if err != nil { @@ -1783,10 +1789,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(99) + counters.RouteViewCounter.Bump(100) err = routes.PollVote(w,req,user,extraData) case "/poll/results/": - counters.RouteViewCounter.Bump(100) + counters.RouteViewCounter.Bump(101) err = routes.PollResults(w,req,user,extraData) } if err != nil { @@ -1795,10 +1801,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { case "/accounts": switch(req.URL.Path) { case "/accounts/login/": - counters.RouteViewCounter.Bump(101) + counters.RouteViewCounter.Bump(102) err = routes.AccountLogin(w,req,user) case "/accounts/create/": - counters.RouteViewCounter.Bump(102) + counters.RouteViewCounter.Bump(103) err = routes.AccountRegister(w,req,user) case "/accounts/logout/": err = common.NoSessionMismatch(w,req,user) @@ -1813,7 +1819,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(103) + counters.RouteViewCounter.Bump(104) err = routes.AccountLogout(w,req,user) case "/accounts/login/submit/": err = common.ParseForm(w,req,user) @@ -1822,7 +1828,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(104) + counters.RouteViewCounter.Bump(105) err = routes.AccountLoginSubmit(w,req,user) case "/accounts/create/submit/": err = common.ParseForm(w,req,user) @@ -1831,7 +1837,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(105) + counters.RouteViewCounter.Bump(106) err = routes.AccountRegisterSubmit(w,req,user) } if err != nil { @@ -1848,7 +1854,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { common.NotFound(w,req,nil) return } - counters.RouteViewCounter.Bump(107) + counters.RouteViewCounter.Bump(108) req.URL.Path += extraData // TODO: Find a way to propagate errors up from this? router.UploadHandler(w,req) // TODO: Count these views @@ -1857,14 +1863,14 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { // TODO: Add support for favicons and robots.txt files switch(extraData) { case "robots.txt": - counters.RouteViewCounter.Bump(109) + counters.RouteViewCounter.Bump(110) err = routes.RobotsTxt(w,req) if err != nil { router.handleError(err,w,req,user) } return /*case "sitemap.xml": - counters.RouteViewCounter.Bump(110) + counters.RouteViewCounter.Bump(111) err = routes.SitemapXml(w,req) if err != nil { router.handleError(err,w,req,user) @@ -1893,7 +1899,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { router.RUnlock() if ok { - counters.RouteViewCounter.Bump(106) // TODO: Be more specific about *which* dynamic route it is + counters.RouteViewCounter.Bump(107) // TODO: Be more specific about *which* dynamic route it is req.URL.Path += extraData err = handle(w,req,user) if err != nil { @@ -1908,7 +1914,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { } else { router.DumpRequest(req,"Bad Route") } - counters.RouteViewCounter.Bump(111) + counters.RouteViewCounter.Bump(112) common.NotFound(w,req,nil) } } diff --git a/langs/english.json b/langs/english.json index ff7dc157..241b6394 100644 --- a/langs/english.json +++ b/langs/english.json @@ -96,8 +96,9 @@ "panel_themes_menus":"Menu Manager", "panel_themes_menus_edit":"Menu Editor", "panel_backups":"Backups", - "panel_mod_logs":"Moderation Logs", - "panel_admin_logs":"Administration Logs", + "panel_registration_logs":"Registration Logs", + "panel_mod_logs":"Mod Action Logs", + "panel_admin_logs":"Admin Action Logs", "panel_debug":"Debug" }, @@ -547,8 +548,9 @@ "panel_menu_statistics_referrers":"Referrers", "panel_menu_reports":"Reports", "panel_menu_logs":"Logs", - "panel_menu_logs_moderators":"Moderators", - "panel_menu_logs_administrators":"Administrators", + "panel_menu_logs_registrations":"Registrations", + "panel_menu_logs_moderators":"Mod Actions", + "panel_menu_logs_administrators":"Admin Actions", "panel_menu_system":"System", "panel_menu_plugins":"Plugins", "panel_menu_backups":"Backups", @@ -680,10 +682,12 @@ "panel_statistics_operating_systems_no_operating_systems":"No operating systems could be found in the selected time range", "panel_logs_menu_head":"Logs", - "panel_logs_menu_moderation":"Moderation Logs", - "panel_logs_menu_administration":"Administration Logs", - "panel_logs_moderation_head":"Moderation Logs", - "panel_logs_administration_head":"Administration Logs", + "panel_logs_registration_head":"Registrations", + "panel_logs_registration_attempt":"Attempt", + "panel_logs_registration_email":"email", + "panel_logs_registration_reason":"reason", + "panel_logs_moderation_head":"Mod Action Logs", + "panel_logs_administration_head":"Admin Action Logs", "panel_plugins_head":"Plugins", "panel_plugins_author_prefix":"Author: ", diff --git a/main.go b/main.go index aceeed77..863f4f8c 100644 --- a/main.go +++ b/main.go @@ -107,11 +107,15 @@ func afterDBInit() (err error) { } log.Print("Initialising the stores") - common.ModLogs, err = common.NewModLogStore() + common.RegLogs, err = common.NewRegLogStore(acc) if err != nil { return err } - common.AdminLogs, err = common.NewAdminLogStore() + common.ModLogs, err = common.NewModLogStore(acc) + if err != nil { + return err + } + common.AdminLogs, err = common.NewAdminLogStore(acc) if err != nil { return err } diff --git a/member_routes.go b/member_routes.go index dc9d6c6e..175c01d1 100644 --- a/member_routes.go +++ b/member_routes.go @@ -42,13 +42,13 @@ func routeReportSubmit(w http.ResponseWriter, r *http.Request, user common.User, return common.InternalError(err, w, r) } - err = stmts.getUserName.QueryRow(userReply.ParentID).Scan(&title) + profileOwner, err := common.Users.Get(userReply.ParentID) if err == ErrNoRows { return common.LocalError("We weren't able to find the profile the reported post is supposed to be on", w, r, user) } else if err != nil { return common.InternalError(err, w, r) } - title = "Profile: " + title + title = "Profile: " + profileOwner.Name content = userReply.Content + "\n\nOriginal Post: @" + strconv.Itoa(userReply.ParentID) } else if itemType == "topic" { err = stmts.getTopicBasic.QueryRow(itemID).Scan(&title, &content) diff --git a/panel_routes.go b/panel_routes.go index adc6704e..77575f94 100644 --- a/panel_routes.go +++ b/panel_routes.go @@ -2701,6 +2701,31 @@ func routePanelBackups(w http.ResponseWriter, r *http.Request, user common.User, return panelRenderTemplate("panel_backups", w, r, user, &pi) } +func routePanelLogsRegs(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError { + headerVars, stats, ferr := common.PanelUserCheck(w, r, &user) + if ferr != nil { + return ferr + } + + logCount := common.RegLogs.GlobalCount() + page, _ := strconv.Atoi(r.FormValue("page")) + perPage := 10 + offset, page, lastPage := common.PageOffset(logCount, page, perPage) + + logs, err := common.RegLogs.GetOffset(offset, perPage) + if err != nil { + return common.InternalError(err, w, r) + } + var llist = make([]common.PageRegLogItem, len(logs)) + for index, log := range logs { + llist[index] = common.PageRegLogItem{log, strings.Replace(strings.TrimSuffix(log.FailureReason,"|"), "|", " | ", -1)} + } + + pageList := common.Paginate(logCount, perPage, 5) + pi := common.PanelRegLogsPage{common.GetTitlePhrase("panel_registration_logs"), user, headerVars, stats, "logs", llist, common.Paginator{pageList, page, lastPage}} + return panelRenderTemplate("panel_reglogs", w, r, user, &pi) +} + // TODO: Log errors when something really screwy is going on? func handleUnknownUser(user *common.User, err error) *common.User { if err != nil { @@ -2720,7 +2745,6 @@ func topicElementTypeAction(action string, elementType string, elementID int, ac if action == "delete" { return fmt.Sprintf("Topic #%d was deleted by %s", elementID, actor.Link, actor.Name) } - switch action { case "lock": out = "%s was locked by %s" @@ -2778,32 +2802,19 @@ func routePanelLogsMod(w http.ResponseWriter, r *http.Request, user common.User) perPage := 10 offset, page, lastPage := common.PageOffset(logCount, page, perPage) - rows, err := stmts.getModlogsOffset.Query(offset, perPage) + logs, err := common.ModLogs.GetOffset(offset, perPage) if err != nil { return common.InternalError(err, w, r) } - defer rows.Close() - - var logs []common.LogItem - var action, elementType, ipaddress, doneAt string - var elementID, actorID int - for rows.Next() { - err := rows.Scan(&action, &elementID, &elementType, &ipaddress, &actorID, &doneAt) - if err != nil { - return common.InternalError(err, w, r) - } - - actor := handleUnknownUser(common.Users.Get(actorID)) - action = modlogsElementType(action, elementType, elementID, actor) - logs = append(logs, common.LogItem{Action: template.HTML(action), IPAddress: ipaddress, DoneAt: doneAt}) - } - err = rows.Err() - if err != nil { - return common.InternalError(err, w, r) + var llist = make([]common.PageLogItem, len(logs)) + for index, log := range logs { + actor := handleUnknownUser(common.Users.Get(log.ActorID)) + action := modlogsElementType(log.Action, log.ElementType, log.ElementID, actor) + llist[index] = common.PageLogItem{Action: template.HTML(action), IPAddress: log.IPAddress, DoneAt: log.DoneAt} } pageList := common.Paginate(logCount, perPage, 5) - pi := common.PanelLogsPage{common.GetTitlePhrase("panel_mod_logs"), user, headerVars, stats, "logs", logs, common.Paginator{pageList, page, lastPage}} + pi := common.PanelLogsPage{common.GetTitlePhrase("panel_mod_logs"), user, headerVars, stats, "logs", llist, common.Paginator{pageList, page, lastPage}} return panelRenderTemplate("panel_modlogs", w, r, user, &pi) } @@ -2818,32 +2829,19 @@ func routePanelLogsAdmin(w http.ResponseWriter, r *http.Request, user common.Use perPage := 10 offset, page, lastPage := common.PageOffset(logCount, page, perPage) - rows, err := stmts.getAdminlogsOffset.Query(offset, perPage) + logs, err := common.AdminLogs.GetOffset(offset, perPage) if err != nil { return common.InternalError(err, w, r) } - defer rows.Close() - - var logs []common.LogItem - var action, elementType, ipaddress, doneAt string - var elementID, actorID int - for rows.Next() { - err := rows.Scan(&action, &elementID, &elementType, &ipaddress, &actorID, &doneAt) - if err != nil { - return common.InternalError(err, w, r) - } - - actor := handleUnknownUser(common.Users.Get(actorID)) - action = modlogsElementType(action, elementType, elementID, actor) - logs = append(logs, common.LogItem{Action: template.HTML(action), IPAddress: ipaddress, DoneAt: doneAt}) - } - err = rows.Err() - if err != nil { - return common.InternalError(err, w, r) + var llist = make([]common.PageLogItem, len(logs)) + for index, log := range logs { + actor := handleUnknownUser(common.Users.Get(log.ActorID)) + action := modlogsElementType(log.Action, log.ElementType, log.ElementID, actor) + llist[index] = common.PageLogItem{Action: template.HTML(action), IPAddress: log.IPAddress, DoneAt: log.DoneAt} } pageList := common.Paginate(logCount, perPage, 5) - pi := common.PanelLogsPage{common.GetTitlePhrase("panel_admin_logs"), user, headerVars, stats, "logs", logs, common.Paginator{pageList, page, lastPage}} + pi := common.PanelLogsPage{common.GetTitlePhrase("panel_admin_logs"), user, headerVars, stats, "logs", llist, common.Paginator{pageList, page, lastPage}} return panelRenderTemplate("panel_adminlogs", w, r, user, &pi) } diff --git a/patcher/main.go b/patcher/main.go index a87ce9aa..00ba46b0 100644 --- a/patcher/main.go +++ b/patcher/main.go @@ -2,7 +2,6 @@ package main import ( "bufio" - "database/sql" "encoding/json" "fmt" "io/ioutil" @@ -17,6 +16,12 @@ import ( _ "github.com/go-sql-driver/mysql" ) +var patches = make(map[int]func(*bufio.Scanner) error) + +func addPatch(index int, handle func(*bufio.Scanner) error) { + patches[index] = handle +} + func main() { scanner := bufio.NewScanner(os.Stdin) @@ -92,55 +97,21 @@ func patcher(scanner *bufio.Scanner) error { } fmt.Println("Applying the patches") - if dbVersion < 2 { - if dbVersion < 1 { - err := patch0(scanner) - if err != nil { - return err - } + var pslice = make([]func(*bufio.Scanner) error, len(patches)) + for i := 0; i < len(patches); i++ { + pslice[i] = patches[i] + } + + // Run the queued up patches + for index, patch := range pslice { + if dbVersion > index { + continue } - return patch1(scanner) - } - return patch2(scanner) -} - -func execStmt(stmt *sql.Stmt, err error) error { - if err != nil { - return err - } - _, err = stmt.Exec() - return err -} - -/*func eachUserQuick(handle func(int)) error { - stmt, err := qgen.Builder.Select("users").Orderby("uid desc").Limit(1).Prepare() - if err != nil { - return err - } - - var topID int - err := stmt.QueryRow(topID) - if err != nil { - return err - } - - for i := 1; i <= topID; i++ { - err = handle(i) + err := patch(scanner) if err != nil { return err } } -}*/ -func eachUser(handle func(int) error) error { - acc := qgen.Builder.Accumulator() - err := acc.Select("users").Each(func(rows *sql.Rows) error { - var uid int - err := rows.Scan(&uid) - if err != nil { - return err - } - return handle(uid) - }) - return err + return nil } diff --git a/patcher/patches.go b/patcher/patches.go index 42ce668c..e90419fc 100644 --- a/patcher/patches.go +++ b/patcher/patches.go @@ -7,6 +7,13 @@ import ( "../query_gen/lib" ) +func init() { + addPatch(0, patch0) + addPatch(1, patch1) + addPatch(2, patch2) + addPatch(3, patch3) +} + func patch0(scanner *bufio.Scanner) (err error) { err = execStmt(qgen.Builder.DropTable("menus")) if err != nil { @@ -206,3 +213,25 @@ func patch2(scanner *bufio.Scanner) error { return nil } + +func patch3(scanner *bufio.Scanner) error { + err := execStmt(qgen.Builder.CreateTable("registration_logs", "", "", + []qgen.DBTableColumn{ + qgen.DBTableColumn{"rlid", "int", 0, false, true, ""}, + qgen.DBTableColumn{"username", "varchar", 100, false, false, ""}, + qgen.DBTableColumn{"email", "varchar", 100, false, false, ""}, + qgen.DBTableColumn{"failureReason", "varchar", 100, false, false, ""}, + qgen.DBTableColumn{"success", "bool", 0, false, false, "0"}, // Did this attempt succeed? + qgen.DBTableColumn{"ipaddress", "varchar", 200, false, false, ""}, + qgen.DBTableColumn{"doneAt", "createdAt", 0, false, false, ""}, + }, + []qgen.DBTableKey{ + qgen.DBTableKey{"rlid", "primary"}, + }, + )) + if err != nil { + return err + } + + return nil +} diff --git a/patcher/utils.go b/patcher/utils.go new file mode 100644 index 00000000..c34aca1b --- /dev/null +++ b/patcher/utils.go @@ -0,0 +1,45 @@ +package main + +import "database/sql" +import "../query_gen/lib" + +func execStmt(stmt *sql.Stmt, err error) error { + if err != nil { + return err + } + _, err = stmt.Exec() + return err +} + +/*func eachUserQuick(handle func(int)) error { + stmt, err := qgen.Builder.Select("users").Orderby("uid desc").Limit(1).Prepare() + if err != nil { + return err + } + + var topID int + err := stmt.QueryRow(topID) + if err != nil { + return err + } + + for i := 1; i <= topID; i++ { + err = handle(i) + if err != nil { + return err + } + } +}*/ + +func eachUser(handle func(int) error) error { + acc := qgen.Builder.Accumulator() + err := acc.Select("users").Each(func(rows *sql.Rows) error { + var uid int + err := rows.Scan(&uid) + if err != nil { + return err + } + return handle(uid) + }) + return err +} diff --git a/query_gen/main.go b/query_gen/main.go index eed0036b..e8386b48 100644 --- a/query_gen/main.go +++ b/query_gen/main.go @@ -265,19 +265,9 @@ func writeSelects(adapter qgen.Adapter) error { build.Select("isThemeDefault").Table("themes").Columns("default").Where("uname = ?").Parse() - build.Select("getModlogs").Table("moderation_logs").Columns("action, elementID, elementType, ipaddress, actorID, doneAt").Parse() - - build.Select("getModlogsOffset").Table("moderation_logs").Columns("action, elementID, elementType, ipaddress, actorID, doneAt").Orderby("doneAt DESC").Limit("?,?").Parse() - - build.Select("getAdminlogsOffset").Table("administration_logs").Columns("action, elementID, elementType, ipaddress, actorID, doneAt").Orderby("doneAt DESC").Limit("?,?").Parse() - - build.Select("getTopicFID").Table("topics").Columns("parentID").Where("tid = ?").Parse() - - build.Select("getUserName").Table("users").Columns("name").Where("uid = ?").Parse() - build.Select("getEmailsByUser").Table("emails").Columns("email, validated, token").Where("uid = ?").Parse() - build.Select("getTopicBasic").Table("topics").Columns("title, content").Where("tid = ?").Parse() + build.Select("getTopicBasic").Table("topics").Columns("title, content").Where("tid = ?").Parse() // TODO: Comment this out and see if anything breaks build.Select("forumEntryExists").Table("forums").Columns("fid").Where("name = ''").Orderby("fid ASC").Limit("0,1").Parse() @@ -315,8 +305,6 @@ func writeInserts(adapter qgen.Adapter) error { func writeUpdates(adapter qgen.Adapter) error { build := adapter.Builder() - build.Update("editReply").Table("replies").Set("content = ?, parsed_content = ?").Where("rid = ?").Parse() - build.Update("updatePlugin").Table("plugins").Set("active = ?").Where("uname = ?").Parse() build.Update("updatePluginInstall").Table("plugins").Set("installed = ?").Where("uname = ?").Parse() diff --git a/query_gen/tables.go b/query_gen/tables.go index dfcac590..01f9a0b8 100644 --- a/query_gen/tables.go +++ b/query_gen/tables.go @@ -411,18 +411,20 @@ func createTables(adapter qgen.Adapter) error { }, ) - /* - qgen.Install.CreateTable("registration_logs", "", "", - []qgen.DBTableColumn{ - qgen.DBTableColumn{"username", "varchar", 100, false, false, ""}, - qgen.DBTableColumn{"email", "varchar", 100, false, false, ""}, - qgen.DBTableColumn{"failureReason", "varchar", 100, false, false, ""}, - qgen.DBTableColumn{"success", "int", 0, false, false, "0"}, // Did this attempt succeed? - qgen.DBTableColumn{"doneAt", "createdAt", 0, false, false, ""}, - }, - []qgen.DBTableKey{}, - ) - */ + qgen.Install.CreateTable("registration_logs", "", "", + []qgen.DBTableColumn{ + qgen.DBTableColumn{"rlid", "int", 0, false, true, ""}, + qgen.DBTableColumn{"username", "varchar", 100, false, false, ""}, + qgen.DBTableColumn{"email", "varchar", 100, false, false, ""}, + qgen.DBTableColumn{"failureReason", "varchar", 100, false, false, ""}, + qgen.DBTableColumn{"success", "bool", 0, false, false, "0"}, // Did this attempt succeed? + qgen.DBTableColumn{"ipaddress", "varchar", 200, false, false, ""}, + qgen.DBTableColumn{"doneAt", "createdAt", 0, false, false, ""}, + }, + []qgen.DBTableKey{ + qgen.DBTableKey{"rlid", "primary"}, + }, + ) qgen.Install.CreateTable("moderation_logs", "", "", []qgen.DBTableColumn{ diff --git a/router_gen/routes.go b/router_gen/routes.go index a7bf715b..8bc6ad63 100644 --- a/router_gen/routes.go +++ b/router_gen/routes.go @@ -194,6 +194,7 @@ func buildPanelRoutes() { Action("routePanelGroupsCreateSubmit", "/panel/groups/create/"), View("routePanelBackups", "/panel/backups/", "extraData").Before("SuperAdminOnly"), // TODO: Test + View("routePanelLogsRegs", "/panel/logs/regs/"), View("routePanelLogsMod", "/panel/logs/mod/"), View("routePanelDebug", "/panel/debug/").Before("AdminOnly"), ) diff --git a/routes/account.go b/routes/account.go index 2f6b45a3..9127014c 100644 --- a/routes/account.go +++ b/routes/account.go @@ -108,28 +108,47 @@ func AccountRegister(w http.ResponseWriter, r *http.Request, user common.User) c func AccountRegisterSubmit(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError { headerLite, _ := common.SimpleUserCheck(w, r, &user) - username := html.EscapeString(strings.Replace(r.PostFormValue("username"), "\n", "", -1)) - if username == "" { - return common.LocalError("You didn't put in a username.", w, r, user) + // TODO: Should we push multiple validation errors to the user instead of just one? + var regSuccess = true + var regErrMsg = "" + var regErrReason = "" + var regError = func(userMsg string, reason string) { + regSuccess = false + if regErrMsg == "" { + regErrMsg = userMsg + } + regErrReason += reason + "|" } + + username := html.EscapeString(strings.Replace(r.PostFormValue("username"), "\n", "", -1)) email := html.EscapeString(strings.Replace(r.PostFormValue("email"), "\n", "", -1)) + if username == "" { + regError("You didn't put in a username.", "no-username") + } if email == "" { - return common.LocalError("You didn't put in an email.", w, r, user) + regError("You didn't put in an email.", "no-email") } password := r.PostFormValue("password") // ? Move this into Create()? What if we want to programatically set weak passwords for tests? err := common.WeakPassword(password, username, email) if err != nil { - return common.LocalError(err.Error(), w, r, user) + regError(err.Error(), "weak-password") + } else { + // Do the two inputted passwords match..? + confirmPassword := r.PostFormValue("confirm_password") + if password != confirmPassword { + regError("The two passwords don't match.", "password-mismatch") + } } - confirmPassword := r.PostFormValue("confirm_password") - common.DebugLog("Registration Attempt! Username: " + username) // TODO: Add more controls over what is logged when? - - // Do the two inputted passwords match..? - if password != confirmPassword { - return common.LocalError("The two passwords don't match.", w, r, user) + regLog := common.RegLogItem{Username: username, Email: email, FailureReason: regErrReason, Success: regSuccess, IPAddress: user.LastIP} + _, err = regLog.Create() + if err != nil { + return common.InternalError(err, w, r) + } + if !regSuccess { + return common.LocalError(regErrMsg, w, r, user) } var active bool @@ -142,12 +161,30 @@ func AccountRegisterSubmit(w http.ResponseWriter, r *http.Request, user common.U group = common.Config.ActivationGroup } + // TODO: Do the registration attempt logging a little less messily (without having to amend the result after the insert) uid, err := common.Users.Create(username, password, email, group, active) - if err == common.ErrAccountExists { - return common.LocalError("This username isn't available. Try another.", w, r, user) - } else if err == common.ErrLongUsername { - return common.LocalError("The username is too long, max: "+strconv.Itoa(common.Config.MaxUsernameLength), w, r, user) - } else if err != nil { + if err != nil { + regLog.Success = false + if err == common.ErrAccountExists { + regLog.FailureReason += "username-exists" + err = regLog.Commit() + if err != nil { + return common.InternalError(err, w, r) + } + return common.LocalError("This username isn't available. Try another.", w, r, user) + } else if err == common.ErrLongUsername { + regLog.FailureReason += "username-too-long" + err = regLog.Commit() + if err != nil { + return common.InternalError(err, w, r) + } + return common.LocalError("The username is too long, max: "+strconv.Itoa(common.Config.MaxUsernameLength), w, r, user) + } + regLog.FailureReason += "internal-error" + err2 := regLog.Commit() + if err2 != nil { + return common.InternalError(err2, w, r) + } return common.InternalError(err, w, r) } @@ -161,7 +198,6 @@ func AccountRegisterSubmit(w http.ResponseWriter, r *http.Request, user common.U // TODO: Add an EmailStore and move this there acc := qgen.Builder.Accumulator() _, err = acc.Insert("emails").Columns("email, uid, validated, token").Fields("?,?,?,?").Exec(email, uid, 0, token) - //_, err = stmts.addEmail.Exec(email, uid, 0, token) if err != nil { return common.InternalError(err, w, r) } diff --git a/schema/mssql/query_registration_logs.sql b/schema/mssql/query_registration_logs.sql new file mode 100644 index 00000000..95726a86 --- /dev/null +++ b/schema/mssql/query_registration_logs.sql @@ -0,0 +1,10 @@ +CREATE TABLE [registration_logs] ( + [rlid] int not null IDENTITY, + [username] nvarchar (100) not null, + [email] nvarchar (100) not null, + [failureReason] nvarchar (100) not null, + [success] bool DEFAULT 0 not null, + [ipaddress] nvarchar (200) not null, + [doneAt] datetime not null, + primary key([rlid]) +); \ No newline at end of file diff --git a/schema/mysql/query_registration_logs.sql b/schema/mysql/query_registration_logs.sql new file mode 100644 index 00000000..4ff25633 --- /dev/null +++ b/schema/mysql/query_registration_logs.sql @@ -0,0 +1,10 @@ +CREATE TABLE `registration_logs` ( + `rlid` int not null AUTO_INCREMENT, + `username` varchar(100) not null, + `email` varchar(100) not null, + `failureReason` varchar(100) not null, + `success` bool DEFAULT 0 not null, + `ipaddress` varchar(200) not null, + `doneAt` datetime not null, + primary key(`rlid`) +); \ No newline at end of file diff --git a/schema/pgsql/query_registration_logs.sql b/schema/pgsql/query_registration_logs.sql new file mode 100644 index 00000000..59970699 --- /dev/null +++ b/schema/pgsql/query_registration_logs.sql @@ -0,0 +1,10 @@ +CREATE TABLE `registration_logs` ( + `rlid` serial not null, + `username` varchar (100) not null, + `email` varchar (100) not null, + `failureReason` varchar (100) not null, + `success` bool DEFAULT 0 not null, + `ipaddress` varchar (200) not null, + `doneAt` timestamp not null, + primary key(`rlid`) +); \ No newline at end of file diff --git a/schema/schema.json b/schema/schema.json index 1e592ab3..79cd1f5a 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -1,5 +1,5 @@ { - "DBVersion":"3", + "DBVersion":"4", "DynamicFileVersion":"0", "MinGoVersion":"1.10", "MinVersion":"" diff --git a/template_error.go b/template_error.go deleted file mode 100644 index d7e96522..00000000 --- a/template_error.go +++ /dev/null @@ -1,121 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "io" -import "./common" - -var error_tmpl_phrase_id int - -// nolint -func init() { - common.Template_error_handle = Template_error - common.Ctemplates = append(common.Ctemplates,"error") - common.TmplPtrMap["error"] = &common.Template_error_handle - common.TmplPtrMap["o_error"] = Template_error - error_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "error_head", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_error(tmpl_error_vars common.Page, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(error_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_error_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_error_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_error_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_error_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_error_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_error_vars.Header.Scripts) != 0 { -for _, item := range tmpl_error_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_error_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_error_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_error_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_error_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_error_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_error_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_error_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_error_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_error_vars.Header))) -w.Write(header_frags[21]) -if tmpl_error_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_error_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_error_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -w.Write(error_frags[0]) -w.Write(phrases[1]) -w.Write(error_frags[1]) -w.Write([]byte(tmpl_error_vars.Something.(string))) -w.Write(error_frags[2]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_error_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[2]) -w.Write(footer_frags[2]) -w.Write(phrases[3]) -w.Write(footer_frags[3]) -w.Write(phrases[4]) -w.Write(footer_frags[4]) -if len(tmpl_error_vars.Header.Themes) != 0 { -for _, item := range tmpl_error_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_error_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_error_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/template_forum.go b/template_forum.go deleted file mode 100644 index 1cb1b047..00000000 --- a/template_forum.go +++ /dev/null @@ -1,370 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "strconv" -import "io" -import "./common" - -var forum_tmpl_phrase_id int - -// nolint -func init() { - common.Template_forum_handle = Template_forum - common.Ctemplates = append(common.Ctemplates,"forum") - common.TmplPtrMap["forum"] = &common.Template_forum_handle - common.TmplPtrMap["o_forum"] = Template_forum - forum_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "paginator_prev_page_aria", - "paginator_less_than", - "paginator_next_page_aria", - "paginator_greater_than", - "topic_list_create_topic_tooltip", - "topic_list_create_topic_aria", - "topic_list_moderate_tooltip", - "topic_list_moderate_aria", - "forum_locked_tooltip", - "forum_locked_aria", - "topic_list_what_to_do", - "topic_list_moderate_delete", - "topic_list_moderate_lock", - "topic_list_moderate_move", - "topic_list_moderate_run", - "quick_topic_aria", - "quick_topic_avatar_alt", - "quick_topic_avatar_tooltip", - "quick_topic_whatsup", - "quick_topic_content_placeholder", - "quick_topic_create_topic_button", - "quick_topic_add_poll_button", - "quick_topic_add_file_button", - "quick_topic_cancel_button", - "forum_list_aria", - "status_closed_tooltip", - "status_pinned_tooltip", - "forum_no_topics", - "forum_start_one", - "paginator_prev_page_aria", - "paginator_prev_page", - "paginator_next_page_aria", - "paginator_next_page", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_forum(tmpl_forum_vars common.ForumPage, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(forum_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_forum_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_forum_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_forum_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_forum_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_forum_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_forum_vars.Header.Scripts) != 0 { -for _, item := range tmpl_forum_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_forum_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_forum_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_forum_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_forum_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_forum_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_forum_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_forum_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_forum_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_forum_vars.Header))) -w.Write(header_frags[21]) -if tmpl_forum_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_forum_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_forum_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -if tmpl_forum_vars.Page > 1 { -w.Write(forum_frags[0]) -w.Write(phrases[1]) -w.Write(forum_frags[1]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) -w.Write(forum_frags[2]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1))) -w.Write(forum_frags[3]) -w.Write(phrases[2]) -w.Write(forum_frags[4]) -} -if tmpl_forum_vars.LastPage != tmpl_forum_vars.Page { -w.Write(forum_frags[5]) -w.Write(phrases[3]) -w.Write(forum_frags[6]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) -w.Write(forum_frags[7]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1))) -w.Write(forum_frags[8]) -w.Write(phrases[4]) -w.Write(forum_frags[9]) -} -w.Write(forum_frags[10]) -if tmpl_forum_vars.CurrentUser.ID != 0 { -w.Write(forum_frags[11]) -} -w.Write(forum_frags[12]) -w.Write([]byte(tmpl_forum_vars.Title)) -w.Write(forum_frags[13]) -if tmpl_forum_vars.CurrentUser.ID != 0 { -w.Write(forum_frags[14]) -if tmpl_forum_vars.CurrentUser.Perms.CreateTopic { -w.Write(forum_frags[15]) -w.Write(phrases[5]) -w.Write(forum_frags[16]) -w.Write(phrases[6]) -w.Write(forum_frags[17]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) -w.Write(forum_frags[18]) -w.Write(forum_frags[19]) -w.Write(phrases[7]) -w.Write(forum_frags[20]) -w.Write(phrases[8]) -w.Write(forum_frags[21]) -} else { -w.Write(forum_frags[22]) -w.Write(phrases[9]) -w.Write(forum_frags[23]) -w.Write(phrases[10]) -w.Write(forum_frags[24]) -} -w.Write(forum_frags[25]) -} -w.Write(forum_frags[26]) -if tmpl_forum_vars.CurrentUser.ID != 0 { -w.Write(forum_frags[27]) -w.Write(phrases[11]) -w.Write(forum_frags[28]) -w.Write(phrases[12]) -w.Write(forum_frags[29]) -w.Write(phrases[13]) -w.Write(forum_frags[30]) -w.Write(phrases[14]) -w.Write(forum_frags[31]) -w.Write(phrases[15]) -w.Write(forum_frags[32]) -if tmpl_forum_vars.CurrentUser.Perms.CreateTopic { -w.Write(forum_frags[33]) -w.Write(phrases[16]) -w.Write(forum_frags[34]) -w.Write([]byte(tmpl_forum_vars.CurrentUser.Avatar)) -w.Write(forum_frags[35]) -w.Write(phrases[17]) -w.Write(forum_frags[36]) -w.Write(phrases[18]) -w.Write(forum_frags[37]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) -w.Write(forum_frags[38]) -w.Write(phrases[19]) -w.Write(forum_frags[39]) -w.Write(phrases[20]) -w.Write(forum_frags[40]) -w.Write(phrases[21]) -w.Write(forum_frags[41]) -w.Write(phrases[22]) -w.Write(forum_frags[42]) -if tmpl_forum_vars.CurrentUser.Perms.UploadFiles { -w.Write(forum_frags[43]) -w.Write(phrases[23]) -w.Write(forum_frags[44]) -} -w.Write(forum_frags[45]) -w.Write(phrases[24]) -w.Write(forum_frags[46]) -} -} -w.Write(forum_frags[47]) -w.Write(phrases[25]) -w.Write(forum_frags[48]) -if len(tmpl_forum_vars.ItemList) != 0 { -for _, item := range tmpl_forum_vars.ItemList { -w.Write(forum_frags[49]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(forum_frags[50]) -if item.Sticky { -w.Write(forum_frags[51]) -} else { -if item.IsClosed { -w.Write(forum_frags[52]) -} -} -w.Write(forum_frags[53]) -w.Write([]byte(item.Creator.Link)) -w.Write(forum_frags[54]) -w.Write([]byte(item.Creator.Avatar)) -w.Write(forum_frags[55]) -w.Write([]byte(item.Creator.Name)) -w.Write(forum_frags[56]) -w.Write([]byte(item.Creator.Name)) -w.Write(forum_frags[57]) -w.Write([]byte(item.Link)) -w.Write(forum_frags[58]) -w.Write([]byte(item.Title)) -w.Write(forum_frags[59]) -w.Write([]byte(item.Title)) -w.Write(forum_frags[60]) -w.Write([]byte(item.Creator.Link)) -w.Write(forum_frags[61]) -w.Write([]byte(item.Creator.Name)) -w.Write(forum_frags[62]) -w.Write([]byte(item.Creator.Name)) -w.Write(forum_frags[63]) -if item.IsClosed { -w.Write(forum_frags[64]) -w.Write(phrases[26]) -w.Write(forum_frags[65]) -} -if item.Sticky { -w.Write(forum_frags[66]) -w.Write(phrases[27]) -w.Write(forum_frags[67]) -} -w.Write(forum_frags[68]) -w.Write([]byte(strconv.Itoa(item.PostCount))) -w.Write(forum_frags[69]) -w.Write([]byte(strconv.Itoa(item.LikeCount))) -w.Write(forum_frags[70]) -if item.Sticky { -w.Write(forum_frags[71]) -} else { -if item.IsClosed { -w.Write(forum_frags[72]) -} -} -w.Write(forum_frags[73]) -w.Write([]byte(item.LastUser.Link)) -w.Write(forum_frags[74]) -w.Write([]byte(item.LastUser.Avatar)) -w.Write(forum_frags[75]) -w.Write([]byte(item.LastUser.Name)) -w.Write(forum_frags[76]) -w.Write([]byte(item.LastUser.Name)) -w.Write(forum_frags[77]) -w.Write([]byte(item.LastUser.Link)) -w.Write(forum_frags[78]) -w.Write([]byte(item.LastUser.Name)) -w.Write(forum_frags[79]) -w.Write([]byte(item.LastUser.Name)) -w.Write(forum_frags[80]) -w.Write([]byte(item.RelativeLastReplyAt)) -w.Write(forum_frags[81]) -} -} else { -w.Write(forum_frags[82]) -w.Write(phrases[28]) -if tmpl_forum_vars.CurrentUser.Perms.CreateTopic { -w.Write(forum_frags[83]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) -w.Write(forum_frags[84]) -w.Write(phrases[29]) -w.Write(forum_frags[85]) -} -w.Write(forum_frags[86]) -} -w.Write(forum_frags[87]) -if tmpl_forum_vars.LastPage > 1 { -w.Write(paginator_frags[0]) -if tmpl_forum_vars.Page > 1 { -w.Write(paginator_frags[1]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1))) -w.Write(paginator_frags[2]) -w.Write(phrases[30]) -w.Write(paginator_frags[3]) -w.Write(phrases[31]) -w.Write(paginator_frags[4]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1))) -w.Write(paginator_frags[5]) -} -if len(tmpl_forum_vars.PageList) != 0 { -for _, item := range tmpl_forum_vars.PageList { -w.Write(paginator_frags[6]) -w.Write([]byte(strconv.Itoa(item))) -w.Write(paginator_frags[7]) -w.Write([]byte(strconv.Itoa(item))) -w.Write(paginator_frags[8]) -} -} -if tmpl_forum_vars.LastPage != tmpl_forum_vars.Page { -w.Write(paginator_frags[9]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1))) -w.Write(paginator_frags[10]) -w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1))) -w.Write(paginator_frags[11]) -w.Write(phrases[32]) -w.Write(paginator_frags[12]) -w.Write(phrases[33]) -w.Write(paginator_frags[13]) -} -w.Write(paginator_frags[14]) -} -w.Write(forum_frags[88]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_forum_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[34]) -w.Write(footer_frags[2]) -w.Write(phrases[35]) -w.Write(footer_frags[3]) -w.Write(phrases[36]) -w.Write(footer_frags[4]) -if len(tmpl_forum_vars.Header.Themes) != 0 { -for _, item := range tmpl_forum_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_forum_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_forum_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/template_forums.go b/template_forums.go deleted file mode 100644 index c1b4b2ce..00000000 --- a/template_forums.go +++ /dev/null @@ -1,174 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "./common" -import "io" - -var forums_tmpl_phrase_id int - -// nolint -func init() { - common.Template_forums_handle = Template_forums - common.Ctemplates = append(common.Ctemplates,"forums") - common.TmplPtrMap["forums"] = &common.Template_forums_handle - common.TmplPtrMap["o_forums"] = Template_forums - forums_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "forums_head", - "forums_no_description", - "forums_none", - "forums_no_forums", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_forums(tmpl_forums_vars common.ForumsPage, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(forums_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_forums_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_forums_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_forums_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_forums_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_forums_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_forums_vars.Header.Scripts) != 0 { -for _, item := range tmpl_forums_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_forums_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_forums_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_forums_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_forums_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_forums_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_forums_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_forums_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_forums_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_forums_vars.Header))) -w.Write(header_frags[21]) -if tmpl_forums_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_forums_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_forums_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -w.Write(forums_frags[0]) -w.Write(phrases[1]) -w.Write(forums_frags[1]) -if len(tmpl_forums_vars.ItemList) != 0 { -for _, item := range tmpl_forums_vars.ItemList { -w.Write(forums_frags[2]) -if item.Desc != "" || item.LastTopic.Title != "" { -w.Write(forums_frags[3]) -} -w.Write(forums_frags[4]) -w.Write([]byte(item.Link)) -w.Write(forums_frags[5]) -w.Write([]byte(item.Name)) -w.Write(forums_frags[6]) -if item.Desc != "" { -w.Write(forums_frags[7]) -w.Write([]byte(item.Desc)) -w.Write(forums_frags[8]) -} else { -w.Write(forums_frags[9]) -w.Write(phrases[2]) -w.Write(forums_frags[10]) -} -w.Write(forums_frags[11]) -if item.LastReplyer.Avatar != "" { -w.Write(forums_frags[12]) -w.Write([]byte(item.LastReplyer.Avatar)) -w.Write(forums_frags[13]) -w.Write([]byte(item.LastReplyer.Name)) -w.Write(forums_frags[14]) -w.Write([]byte(item.LastReplyer.Name)) -w.Write(forums_frags[15]) -} -w.Write(forums_frags[16]) -w.Write([]byte(item.LastTopic.Link)) -w.Write(forums_frags[17]) -if item.LastTopic.Title != "" { -w.Write([]byte(item.LastTopic.Title)) -} else { -w.Write(phrases[3]) -} -w.Write(forums_frags[18]) -if item.LastTopicTime != "" { -w.Write(forums_frags[19]) -w.Write([]byte(item.LastTopicTime)) -w.Write(forums_frags[20]) -} -w.Write(forums_frags[21]) -} -} else { -w.Write(forums_frags[22]) -w.Write(phrases[4]) -w.Write(forums_frags[23]) -} -w.Write(forums_frags[24]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_forums_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[5]) -w.Write(footer_frags[2]) -w.Write(phrases[6]) -w.Write(footer_frags[3]) -w.Write(phrases[7]) -w.Write(footer_frags[4]) -if len(tmpl_forums_vars.Header.Themes) != 0 { -for _, item := range tmpl_forums_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_forums_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_forums_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/template_guilds_guild_list.go b/template_guilds_guild_list.go deleted file mode 100644 index 0bda17c4..00000000 --- a/template_guilds_guild_list.go +++ /dev/null @@ -1,133 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "io" -import "./common" -import "./extend/guilds/lib" -import "strconv" - -var guilds_guild_list_tmpl_phrase_id int - -// nolint -func init() { - common.TmplPtrMap["o_guilds_guild_list"] = Template_guilds_guild_list - guilds_guild_list_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_guilds_guild_list(tmpl_guilds_guild_list_vars guilds.ListPage, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(guilds_guild_list_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_guilds_guild_list_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_guilds_guild_list_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_guilds_guild_list_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_guilds_guild_list_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_guilds_guild_list_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_guilds_guild_list_vars.Header.Scripts) != 0 { -for _, item := range tmpl_guilds_guild_list_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_guilds_guild_list_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_guilds_guild_list_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_guilds_guild_list_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_guilds_guild_list_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_guilds_guild_list_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_guilds_guild_list_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_guilds_guild_list_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_guilds_guild_list_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_guilds_guild_list_vars.Header))) -w.Write(header_frags[21]) -if tmpl_guilds_guild_list_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_guilds_guild_list_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_guilds_guild_list_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -w.Write(guilds_guild_list_frags[0]) -if len(tmpl_guilds_guild_list_vars.GuildList) != 0 { -for _, item := range tmpl_guilds_guild_list_vars.GuildList { -w.Write(guilds_guild_list_frags[1]) -w.Write([]byte(item.Link)) -w.Write(guilds_guild_list_frags[2]) -w.Write([]byte(item.Name)) -w.Write(guilds_guild_list_frags[3]) -w.Write([]byte(item.Desc)) -w.Write(guilds_guild_list_frags[4]) -w.Write([]byte(strconv.Itoa(item.MemberCount))) -w.Write(guilds_guild_list_frags[5]) -w.Write([]byte(item.LastUpdateTime)) -w.Write(guilds_guild_list_frags[6]) -} -} else { -w.Write(guilds_guild_list_frags[7]) -} -w.Write(guilds_guild_list_frags[8]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_guilds_guild_list_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[1]) -w.Write(footer_frags[2]) -w.Write(phrases[2]) -w.Write(footer_frags[3]) -w.Write(phrases[3]) -w.Write(footer_frags[4]) -if len(tmpl_guilds_guild_list_vars.Header.Themes) != 0 { -for _, item := range tmpl_guilds_guild_list_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_guilds_guild_list_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_guilds_guild_list_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/template_ip_search.go b/template_ip_search.go deleted file mode 100644 index 8225da60..00000000 --- a/template_ip_search.go +++ /dev/null @@ -1,154 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "io" -import "./common" - -var ip_search_tmpl_phrase_id int - -// nolint -func init() { - common.Template_ip_search_handle = Template_ip_search - common.Ctemplates = append(common.Ctemplates,"ip_search") - common.TmplPtrMap["ip_search"] = &common.Template_ip_search_handle - common.TmplPtrMap["o_ip_search"] = Template_ip_search - ip_search_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "ip_search_head", - "ip_search_search_button", - "ip_search_no_users", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_ip_search(tmpl_ip_search_vars common.IPSearchPage, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(ip_search_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_ip_search_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_ip_search_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_ip_search_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_ip_search_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_ip_search_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_ip_search_vars.Header.Scripts) != 0 { -for _, item := range tmpl_ip_search_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_ip_search_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_ip_search_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_ip_search_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_ip_search_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_ip_search_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_ip_search_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_ip_search_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_ip_search_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_ip_search_vars.Header))) -w.Write(header_frags[21]) -if tmpl_ip_search_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_ip_search_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_ip_search_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -w.Write(ip_search_frags[0]) -w.Write(phrases[1]) -w.Write(ip_search_frags[1]) -if tmpl_ip_search_vars.IP != "" { -w.Write(ip_search_frags[2]) -w.Write([]byte(tmpl_ip_search_vars.IP)) -w.Write(ip_search_frags[3]) -} -w.Write(ip_search_frags[4]) -w.Write(phrases[2]) -w.Write(ip_search_frags[5]) -if tmpl_ip_search_vars.IP != "" { -w.Write(ip_search_frags[6]) -if len(tmpl_ip_search_vars.ItemList) != 0 { -for _, item := range tmpl_ip_search_vars.ItemList { -w.Write(ip_search_frags[7]) -w.Write([]byte(item.Avatar)) -w.Write(ip_search_frags[8]) -w.Write([]byte(item.Avatar)) -w.Write(ip_search_frags[9]) -w.Write([]byte(item.Name)) -w.Write(ip_search_frags[10]) -w.Write([]byte(item.Link)) -w.Write(ip_search_frags[11]) -w.Write([]byte(item.Name)) -w.Write(ip_search_frags[12]) -} -} else { -w.Write(ip_search_frags[13]) -w.Write(phrases[3]) -w.Write(ip_search_frags[14]) -} - -w.Write(ip_search_frags[15]) -} -w.Write(ip_search_frags[16]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_ip_search_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[4]) -w.Write(footer_frags[2]) -w.Write(phrases[5]) -w.Write(footer_frags[3]) -w.Write(phrases[6]) -w.Write(footer_frags[4]) -if len(tmpl_ip_search_vars.Header.Themes) != 0 { -for _, item := range tmpl_ip_search_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_ip_search_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_ip_search_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/template_list.go b/template_list.go deleted file mode 100644 index f442e444..00000000 --- a/template_list.go +++ /dev/null @@ -1,1720 +0,0 @@ -package main - -var login_frags = make([][]byte,8) -var notice_frags = make([][]byte,3) -var forums_frags = make([][]byte,26) -var paginator_frags = make([][]byte,16) -var forum_frags = make([][]byte,90) -var guilds_guild_list_frags = make([][]byte,10) -var header_frags = make([][]byte,26) -var topic_alt_frags = make([][]byte,200) -var topics_frags = make([][]byte,98) -var topic_frags = make([][]byte,199) -var profile_comments_row_frags = make([][]byte,51) -var register_frags = make([][]byte,9) -var ip_search_frags = make([][]byte,18) -var footer_frags = make([][]byte,13) -var profile_frags = make([][]byte,50) -var error_frags = make([][]byte,4) - -// nolint -func init() { -header_frags[0] = []byte(` - - - `) -header_frags[1] = []byte(` | `) -header_frags[2] = []byte(` - - `) -header_frags[4] = []byte(` - - `) -header_frags[6] = []byte(` - - - `) -header_frags[7] = []byte(` - - `) -header_frags[9] = []byte(` - - - - `) -header_frags[12] = []byte(``) -header_frags[14] = []byte(` - - - `) -header_frags[15] = []byte(``) -header_frags[16] = []byte(` -
-
`) -header_frags[17] = []byte(`
- -
`) -header_frags[21] = []byte(`
-
-
`) -notice_frags[0] = []byte(`
`) -notice_frags[1] = []byte(`
`) -header_frags[24] = []byte(` -
-`) -topic_frags[0] = []byte(` - -
-`) -topic_frags[3] = []byte(` -`) -topic_frags[10] = []byte(` -`) -topic_frags[17] = []byte(` - -
- -
-
-

`) -topic_frags[24] = []byte(`

- `) -topic_frags[25] = []byte(`🔒︎`) -topic_frags[28] = []byte(` - - - `) -topic_frags[32] = []byte(` -
-
-`) -topic_frags[33] = []byte(` -
-
-
- `) -topic_frags[40] = []byte(` -
- - - `) -topic_frags[46] = []byte(` -
- `) -topic_frags[47] = []byte(` -
- - - -
-
-
-
-
-
-
-`) -topic_frags[54] = []byte(` - -
-
-

`) -topic_frags[62] = []byte(`

- - - - -    - `) -topic_frags[69] = []byte(` - `) -topic_frags[82] = []byte(``) -topic_frags[86] = []byte(``) -topic_frags[91] = []byte(``) -topic_frags[96] = []byte(``) -topic_frags[101] = []byte(``) -topic_frags[106] = []byte(``) -topic_frags[111] = []byte(``) -topic_frags[115] = []byte(` - - - - - `) -topic_frags[123] = []byte(``) -topic_frags[124] = []byte(``) -topic_frags[125] = []byte(``) -topic_frags[127] = []byte(``) -topic_frags[129] = []byte(` - - -
-
- -
`) -topic_frags[131] = []byte(` -
- `) -topic_frags[132] = []byte(` - `) -topic_frags[133] = []byte(` -
-`) -topic_frags[134] = []byte(` -
- `) -topic_frags[141] = []byte(` -

`) -topic_frags[142] = []byte(`

- - - -    - `) -topic_frags[147] = []byte(``) -topic_frags[152] = []byte(``) -topic_frags[157] = []byte(``) -topic_frags[162] = []byte(``) -topic_frags[167] = []byte(``) -topic_frags[171] = []byte(` - - - - - `) -topic_frags[178] = []byte(``) -topic_frags[179] = []byte(``) -topic_frags[180] = []byte(``) -topic_frags[182] = []byte(``) -topic_frags[184] = []byte(` - - -
-`) -topic_frags[185] = []byte(`
- -`) -topic_frags[186] = []byte(` -
-
- - -
-
- -
-
-
-
-
- - - -
-
-
-
-
- - - `) -topic_frags[194] = []byte(` - - -
`) -topic_frags[196] = []byte(` -
-
-
-`) -topic_frags[197] = []byte(` - -
- -`) -footer_frags[0] = []byte(` -
- -
-
-
- - -`) -topic_alt_frags[0] = []byte(` -
`) -topic_alt_frags[7] = []byte(` -
`) -topic_alt_frags[14] = []byte(` - -
- -
-
-
-

`) -topic_alt_frags[23] = []byte(`

- `) -topic_alt_frags[24] = []byte(`🔒︎`) -topic_alt_frags[27] = []byte(` - - - `) -topic_alt_frags[31] = []byte(` -
-
-
- -
- `) -topic_alt_frags[32] = []byte(` -
-
-
-
 
- - `) -topic_alt_frags[40] = []byte(`
`) -topic_alt_frags[42] = []byte(`
`) -topic_alt_frags[44] = []byte(` -
-
-
- `) -topic_alt_frags[46] = []byte(` -
- - - `) -topic_alt_frags[52] = []byte(` -
- `) -topic_alt_frags[53] = []byte(` -
- - - -
-
-
-
-
-
-
- `) -topic_alt_frags[60] = []byte(` -
-
-
 
- - `) -topic_alt_frags[67] = []byte(`
`) -topic_alt_frags[69] = []byte(`
`) -topic_alt_frags[71] = []byte(` -
-
-
`) -topic_alt_frags[72] = []byte(`
- -
- `) -topic_alt_frags[76] = []byte(``) -topic_alt_frags[83] = []byte(``) -topic_alt_frags[86] = []byte(``) -topic_alt_frags[90] = []byte(``) -topic_alt_frags[94] = []byte(``) -topic_alt_frags[98] = []byte(``) -topic_alt_frags[102] = []byte(``) -topic_alt_frags[106] = []byte(``) -topic_alt_frags[110] = []byte(` - - - `) -topic_alt_frags[114] = []byte(` -
- - `) -topic_alt_frags[117] = []byte(` - `) -topic_alt_frags[118] = []byte(``) -topic_alt_frags[122] = []byte(` -
-
-
-
- - `) -topic_alt_frags[123] = []byte(` -
-
-
 
- - `) -topic_alt_frags[131] = []byte(`
`) -topic_alt_frags[133] = []byte(`
`) -topic_alt_frags[135] = []byte(` -
-
- `) -topic_alt_frags[138] = []byte(` - - `) -topic_alt_frags[140] = []byte(` - `) -topic_alt_frags[141] = []byte(` -
`) -topic_alt_frags[142] = []byte(`
-
- `) -topic_alt_frags[145] = []byte(``) -topic_alt_frags[152] = []byte(``) -topic_alt_frags[156] = []byte(``) -topic_alt_frags[160] = []byte(``) -topic_alt_frags[164] = []byte(` - - - `) -topic_alt_frags[168] = []byte(` -
- - `) -topic_alt_frags[171] = []byte(` - `) -topic_alt_frags[172] = []byte(``) -topic_alt_frags[175] = []byte(` -
-
- `) -topic_alt_frags[176] = []byte(` -
-
-
-`) -topic_alt_frags[177] = []byte(`
- -`) -topic_alt_frags[178] = []byte(` -
-
-
 
- - `) -topic_alt_frags[183] = []byte(`
`) -topic_alt_frags[185] = []byte(`
`) -topic_alt_frags[187] = []byte(` -
-
-
- - -
-
- -
-
-
-
-
- - - -
-
-
-
-
- - - `) -topic_alt_frags[195] = []byte(` - - -
`) -topic_alt_frags[197] = []byte(` -
-
-
-
-`) -topic_alt_frags[198] = []byte(` - -
- -`) -profile_frags[0] = []byte(` - -
- -
-
-
-
- `)
-profile_frags[2] = []byte(`'s Avatar -
-
- `) -profile_frags[5] = []byte(``) -profile_frags[6] = []byte(``) -profile_frags[8] = []byte(``) -profile_frags[9] = []byte(` -
-
-
- `) -profile_frags[10] = []byte(``) -profile_frags[12] = []byte(` - - `) -profile_frags[14] = []byte(`
- `) -profile_frags[15] = []byte(``) -profile_frags[18] = []byte(` - `) -profile_frags[19] = []byte(``) -profile_frags[20] = []byte(``) -profile_frags[21] = []byte(` -
`) -profile_frags[22] = []byte(` -
- -
- `) -profile_frags[27] = []byte(` -
-
-
- -
- `) -profile_frags[28] = []byte(` - - - - `) -profile_frags[39] = []byte(` - - -
`) -profile_comments_row_frags[0] = []byte(` -
- `) -profile_comments_row_frags[5] = []byte(` - - `) -profile_comments_row_frags[7] = []byte(`   - - `) -profile_comments_row_frags[8] = []byte(` - - `) -profile_comments_row_frags[17] = []byte(` - - - - `) -profile_comments_row_frags[22] = []byte(``) -profile_comments_row_frags[23] = []byte(``) -profile_comments_row_frags[24] = []byte(` - -
- `) -profile_comments_row_frags[25] = []byte(` -
-
-
- `)
-profile_comments_row_frags[28] = []byte(`'s Avatar - - `) -profile_comments_row_frags[31] = []byte(` - `) -profile_comments_row_frags[32] = []byte(``) -profile_comments_row_frags[33] = []byte(``) -profile_comments_row_frags[34] = []byte(` - -
- - `) -profile_comments_row_frags[35] = []byte(` - - - `) -profile_comments_row_frags[44] = []byte(` - - -
-
- `) -profile_comments_row_frags[49] = []byte(` -
-
-
- `) -profile_frags[41] = []byte(`
- -`) -profile_frags[42] = []byte(` -
- -
-
-
-
-
-
-
-
-
-`) -profile_frags[47] = []byte(` -
- -
- -`) -profile_frags[48] = []byte(` - - -`) -forums_frags[0] = []byte(` -
- -
-

`) -forums_frags[1] = []byte(`

-
-
- `) -forums_frags[2] = []byte(`
- - `) -forums_frags[6] = []byte(` - `) -forums_frags[7] = []byte(` -
`) -forums_frags[8] = []byte(` - `) -forums_frags[9] = []byte(` -
`) -forums_frags[10] = []byte(` - `) -forums_frags[11] = []byte(` -
- - - `) -forums_frags[12] = []byte(``)
-forums_frags[14] = []byte(`'s Avatar`) -forums_frags[16] = []byte(` - - `) -forums_frags[18] = []byte(` - `) -forums_frags[19] = []byte(`
`) -forums_frags[20] = []byte(``) -forums_frags[21] = []byte(` -
-
-
-
- `) -forums_frags[22] = []byte(`
`) -forums_frags[23] = []byte(`
`) -forums_frags[24] = []byte(` -
- -
-`) -topics_frags[0] = []byte(` -
- -
-

`) -topics_frags[3] = []byte(`

- `) -topics_frags[4] = []byte(` -
- `) -topics_frags[5] = []byte(` -
-
- `) -topics_frags[8] = []byte(` -
- -
- `) -topics_frags[11] = []byte(`
`) -topics_frags[14] = []byte(` -
-
- `) -topics_frags[15] = []byte(` -
- -`) -topics_frags[16] = []byte(` -
-
-
- `) -topics_frags[17] = []byte(` -
-
- - -
-
-
- -`) -topics_frags[22] = []byte(` - - - `) -topics_frags[51] = []byte(` -
- `) -topics_frags[53] = []byte(`
-
- - `)
-topics_frags[60] = []byte(`'s Avatar - - `) -topics_frags[64] = []byte(` `) -topics_frags[65] = []byte(``) -topics_frags[68] = []byte(``) -topics_frags[69] = []byte(` -
`) -topics_frags[72] = []byte(` - `) -topics_frags[73] = []byte(` | 🔒︎`) -topics_frags[75] = []byte(` | 📍︎`) -topics_frags[77] = []byte(` -
- - `) -topics_frags[78] = []byte(`
- `) -topics_frags[79] = []byte(` -
-
-
- `)
-topics_frags[85] = []byte(`'s Avatar - - `) -topics_frags[89] = []byte(`
- `) -topics_frags[90] = []byte(` -
-
-
`) -topics_frags[91] = []byte(`
`) -topics_frags[92] = []byte(` `) -topics_frags[93] = []byte(``) -topics_frags[94] = []byte(`
`) -topics_frags[95] = []byte(` -
- -`) -paginator_frags[0] = []byte(`
- `) -paginator_frags[1] = []byte(` - `) -paginator_frags[6] = []byte(` - - `) -paginator_frags[9] = []byte(` - - `) -paginator_frags[14] = []byte(` -
`) -topics_frags[96] = []byte(` - -
-`) -forum_frags[0] = []byte(`
`) -forum_frags[5] = []byte(`
`) -forum_frags[10] = []byte(` - -
-
-
-

`) -forum_frags[13] = []byte(`

-
- `) -forum_frags[14] = []byte(` -
- `) -forum_frags[15] = []byte(` -
-
- `) -forum_frags[19] = []byte(` -
- -
- `) -forum_frags[22] = []byte(`
`) -forum_frags[25] = []byte(` -
-
- `) -forum_frags[26] = []byte(` -
- `) -forum_frags[27] = []byte(` -
-
-
- `) -forum_frags[28] = []byte(` -
-
- - -
-
-
- `) -forum_frags[33] = []byte(` - - `) -forum_frags[47] = []byte(` -
- `) -forum_frags[49] = []byte(`
-
- - `)
-forum_frags[56] = []byte(`'s Avatar - - `) -forum_frags[60] = []byte(` -
`) -forum_frags[63] = []byte(` - `) -forum_frags[64] = []byte(` | 🔒︎`) -forum_frags[66] = []byte(` | 📍︎`) -forum_frags[68] = []byte(` -
- - `) -forum_frags[69] = []byte(`
- `) -forum_frags[70] = []byte(` -
-
-
- `)
-forum_frags[76] = []byte(`'s Avatar - - `) -forum_frags[80] = []byte(`
- `) -forum_frags[81] = []byte(` -
-
-
`) -forum_frags[82] = []byte(`
`) -forum_frags[83] = []byte(` `) -forum_frags[85] = []byte(``) -forum_frags[86] = []byte(`
`) -forum_frags[87] = []byte(` -
- -`) -forum_frags[88] = []byte(` - -
-`) -login_frags[0] = []byte(` -
-
-

`) -login_frags[1] = []byte(`

-
-
-
- - - -
-
-
-`) -register_frags[0] = []byte(` -
-
-

`) -register_frags[1] = []byte(`

-
- -
-`) -error_frags[0] = []byte(` -
-
-

`) -error_frags[1] = []byte(`

-
-
-
`) -error_frags[2] = []byte(`
-
-
-`) -ip_search_frags[0] = []byte(` -
-
-
-

`) -ip_search_frags[1] = []byte(`

-
-
-
-
-
- - -
-
- `) -ip_search_frags[6] = []byte(` -
- `) -ip_search_frags[7] = []byte(` - `) -ip_search_frags[13] = []byte(`
`) -ip_search_frags[14] = []byte(`
`) -ip_search_frags[15] = []byte(` -
- `) -ip_search_frags[16] = []byte(` -
-`) -guilds_guild_list_frags[0] = []byte(` -
- -
- `) -guilds_guild_list_frags[1] = []byte(`
- - `) -guilds_guild_list_frags[3] = []byte(` -
`) -guilds_guild_list_frags[4] = []byte(` -
- - `) -guilds_guild_list_frags[5] = []byte(` members -
`) -guilds_guild_list_frags[6] = []byte(` -
-
-
- `) -guilds_guild_list_frags[7] = []byte(`
There aren't any visible guilds.
`) -guilds_guild_list_frags[8] = []byte(` -
-
-`) - - -// nolint -GetFrag = func(name string) [][]byte { -switch(name) { - case "login": - return login_frags - case "notice": - return notice_frags - case "forums": - return forums_frags - case "paginator": - return paginator_frags - case "forum": - return forum_frags - case "guilds_guild_list": - return guilds_guild_list_frags - case "header": - return header_frags - case "topic_alt": - return topic_alt_frags - case "topics": - return topics_frags - case "topic": - return topic_frags - case "profile_comments_row": - return profile_comments_row_frags - case "register": - return register_frags - case "ip_search": - return ip_search_frags - case "footer": - return footer_frags - case "profile": - return profile_frags - case "error": - return error_frags -} -return nil -} -} diff --git a/template_login.go b/template_login.go deleted file mode 100644 index 14a42fab..00000000 --- a/template_login.go +++ /dev/null @@ -1,134 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "io" -import "./common" - -var login_tmpl_phrase_id int - -// nolint -func init() { - common.Template_login_handle = Template_login - common.Ctemplates = append(common.Ctemplates,"login") - common.TmplPtrMap["login"] = &common.Template_login_handle - common.TmplPtrMap["o_login"] = Template_login - login_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "login_head", - "login_account_name", - "login_account_name", - "login_account_password", - "login_submit_button", - "login_no_account", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_login(tmpl_login_vars common.Page, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(login_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_login_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_login_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_login_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_login_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_login_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_login_vars.Header.Scripts) != 0 { -for _, item := range tmpl_login_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_login_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_login_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_login_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_login_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_login_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_login_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_login_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_login_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_login_vars.Header))) -w.Write(header_frags[21]) -if tmpl_login_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_login_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_login_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -w.Write(login_frags[0]) -w.Write(phrases[1]) -w.Write(login_frags[1]) -w.Write(phrases[2]) -w.Write(login_frags[2]) -w.Write(phrases[3]) -w.Write(login_frags[3]) -w.Write(phrases[4]) -w.Write(login_frags[4]) -w.Write(phrases[5]) -w.Write(login_frags[5]) -w.Write(phrases[6]) -w.Write(login_frags[6]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_login_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[7]) -w.Write(footer_frags[2]) -w.Write(phrases[8]) -w.Write(footer_frags[3]) -w.Write(phrases[9]) -w.Write(footer_frags[4]) -if len(tmpl_login_vars.Header.Themes) != 0 { -for _, item := range tmpl_login_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_login_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_login_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/template_profile.go b/template_profile.go deleted file mode 100644 index 3cdeebc8..00000000 --- a/template_profile.go +++ /dev/null @@ -1,347 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "strconv" -import "io" -import "./common" - -var profile_tmpl_phrase_id int - -// nolint -func init() { - common.Template_profile_handle = Template_profile - common.Ctemplates = append(common.Ctemplates,"profile") - common.TmplPtrMap["profile"] = &common.Template_profile_handle - common.TmplPtrMap["o_profile"] = Template_profile - profile_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "profile_login_for_options", - "profile_add_friend", - "profile_unban", - "profile_ban", - "profile_report_user_aria", - "profile_report_user_tooltip", - "profile_ban_user_head", - "profile_ban_user_notice", - "profile_ban_user_days", - "profile_ban_user_weeks", - "profile_ban_user_months", - "profile_ban_user_reason", - "profile_ban_user_button", - "profile_comments_head", - "profile_comments_edit_tooltip", - "profile_comments_edit_aria", - "profile_comments_delete_tooltip", - "profile_comments_delete_aria", - "profile_comments_report_tooltip", - "profile_comments_report_aria", - "profile_comments_edit_tooltip", - "profile_comments_edit_aria", - "profile_comments_delete_tooltip", - "profile_comments_delete_aria", - "profile_comments_report_tooltip", - "profile_comments_report_aria", - "profile_comments_form_content", - "profile_comments_form_button", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_profile(tmpl_profile_vars common.ProfilePage, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(profile_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_profile_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_profile_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_profile_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_profile_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_profile_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_profile_vars.Header.Scripts) != 0 { -for _, item := range tmpl_profile_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_profile_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_profile_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_profile_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_profile_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_profile_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_profile_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_profile_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_profile_vars.Header))) -w.Write(header_frags[21]) -if tmpl_profile_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_profile_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_profile_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -w.Write(profile_frags[0]) -w.Write([]byte(tmpl_profile_vars.ProfileOwner.Avatar)) -w.Write(profile_frags[1]) -w.Write([]byte(tmpl_profile_vars.ProfileOwner.Name)) -w.Write(profile_frags[2]) -w.Write([]byte(tmpl_profile_vars.ProfileOwner.Name)) -w.Write(profile_frags[3]) -w.Write([]byte(tmpl_profile_vars.ProfileOwner.Name)) -w.Write(profile_frags[4]) -w.Write([]byte(tmpl_profile_vars.ProfileOwner.Name)) -w.Write(profile_frags[5]) -if tmpl_profile_vars.ProfileOwner.Tag != "" { -w.Write(profile_frags[6]) -w.Write([]byte(tmpl_profile_vars.ProfileOwner.Tag)) -w.Write(profile_frags[7]) -w.Write([]byte(tmpl_profile_vars.ProfileOwner.Tag)) -w.Write(profile_frags[8]) -} -w.Write(profile_frags[9]) -if !tmpl_profile_vars.CurrentUser.Loggedin { -w.Write(profile_frags[10]) -w.Write(phrases[1]) -w.Write(profile_frags[11]) -} else { -w.Write(profile_frags[12]) -w.Write(phrases[2]) -w.Write(profile_frags[13]) -if tmpl_profile_vars.CurrentUser.IsSuperMod && !tmpl_profile_vars.ProfileOwner.IsSuperMod { -w.Write(profile_frags[14]) -if tmpl_profile_vars.ProfileOwner.IsBanned { -w.Write(profile_frags[15]) -w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) -w.Write(profile_frags[16]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_frags[17]) -w.Write(phrases[3]) -w.Write(profile_frags[18]) -} else { -w.Write(profile_frags[19]) -w.Write(phrases[4]) -w.Write(profile_frags[20]) -} -w.Write(profile_frags[21]) -} -w.Write(profile_frags[22]) -w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) -w.Write(profile_frags[23]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_frags[24]) -w.Write(phrases[5]) -w.Write(profile_frags[25]) -w.Write(phrases[6]) -w.Write(profile_frags[26]) -} -w.Write(profile_frags[27]) -if tmpl_profile_vars.CurrentUser.Perms.BanUsers { -w.Write(profile_frags[28]) -w.Write(phrases[7]) -w.Write(profile_frags[29]) -w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) -w.Write(profile_frags[30]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_frags[31]) -w.Write(profile_frags[32]) -w.Write(phrases[8]) -w.Write(profile_frags[33]) -w.Write(phrases[9]) -w.Write(profile_frags[34]) -w.Write(phrases[10]) -w.Write(profile_frags[35]) -w.Write(phrases[11]) -w.Write(profile_frags[36]) -w.Write(phrases[12]) -w.Write(profile_frags[37]) -w.Write(phrases[13]) -w.Write(profile_frags[38]) -} -w.Write(profile_frags[39]) -w.Write(phrases[14]) -w.Write(profile_frags[40]) -if tmpl_profile_vars.Header.Theme.BgAvatars { -if len(tmpl_profile_vars.ItemList) != 0 { -for _, item := range tmpl_profile_vars.ItemList { -w.Write(profile_comments_row_frags[0]) -w.Write([]byte(item.ClassName)) -w.Write(profile_comments_row_frags[1]) -w.Write([]byte(item.Avatar)) -w.Write(profile_comments_row_frags[2]) -if item.ContentLines <= 5 { -w.Write(profile_comments_row_frags[3]) -} -w.Write(profile_comments_row_frags[4]) -w.Write([]byte(item.ContentHtml)) -w.Write(profile_comments_row_frags[5]) -w.Write([]byte(item.UserLink)) -w.Write(profile_comments_row_frags[6]) -w.Write([]byte(item.CreatedByName)) -w.Write(profile_comments_row_frags[7]) -if tmpl_profile_vars.CurrentUser.IsMod { -w.Write(profile_comments_row_frags[8]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(profile_comments_row_frags[9]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_comments_row_frags[10]) -w.Write(phrases[15]) -w.Write(profile_comments_row_frags[11]) -w.Write(phrases[16]) -w.Write(profile_comments_row_frags[12]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(profile_comments_row_frags[13]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_comments_row_frags[14]) -w.Write(phrases[17]) -w.Write(profile_comments_row_frags[15]) -w.Write(phrases[18]) -w.Write(profile_comments_row_frags[16]) -} -w.Write(profile_comments_row_frags[17]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(profile_comments_row_frags[18]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_comments_row_frags[19]) -w.Write(phrases[19]) -w.Write(profile_comments_row_frags[20]) -w.Write(phrases[20]) -w.Write(profile_comments_row_frags[21]) -if item.Tag != "" { -w.Write(profile_comments_row_frags[22]) -w.Write([]byte(item.Tag)) -w.Write(profile_comments_row_frags[23]) -} -w.Write(profile_comments_row_frags[24]) -} -} -} else { -if len(tmpl_profile_vars.ItemList) != 0 { -for _, item := range tmpl_profile_vars.ItemList { -w.Write(profile_comments_row_frags[25]) -w.Write([]byte(item.ClassName)) -w.Write(profile_comments_row_frags[26]) -w.Write([]byte(item.Avatar)) -w.Write(profile_comments_row_frags[27]) -w.Write([]byte(item.CreatedByName)) -w.Write(profile_comments_row_frags[28]) -w.Write([]byte(item.CreatedByName)) -w.Write(profile_comments_row_frags[29]) -w.Write([]byte(item.UserLink)) -w.Write(profile_comments_row_frags[30]) -w.Write([]byte(item.CreatedByName)) -w.Write(profile_comments_row_frags[31]) -if item.Tag != "" { -w.Write(profile_comments_row_frags[32]) -w.Write([]byte(item.Tag)) -w.Write(profile_comments_row_frags[33]) -} -w.Write(profile_comments_row_frags[34]) -if tmpl_profile_vars.CurrentUser.IsMod { -w.Write(profile_comments_row_frags[35]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(profile_comments_row_frags[36]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_comments_row_frags[37]) -w.Write(phrases[21]) -w.Write(profile_comments_row_frags[38]) -w.Write(phrases[22]) -w.Write(profile_comments_row_frags[39]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(profile_comments_row_frags[40]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_comments_row_frags[41]) -w.Write(phrases[23]) -w.Write(profile_comments_row_frags[42]) -w.Write(phrases[24]) -w.Write(profile_comments_row_frags[43]) -} -w.Write(profile_comments_row_frags[44]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(profile_comments_row_frags[45]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_comments_row_frags[46]) -w.Write(phrases[25]) -w.Write(profile_comments_row_frags[47]) -w.Write(phrases[26]) -w.Write(profile_comments_row_frags[48]) -w.Write([]byte(item.ContentHtml)) -w.Write(profile_comments_row_frags[49]) -} -} -} -w.Write(profile_frags[41]) -if !tmpl_profile_vars.CurrentUser.IsBanned { -w.Write(profile_frags[42]) -w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) -w.Write(profile_frags[43]) -w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) -w.Write(profile_frags[44]) -w.Write(phrases[27]) -w.Write(profile_frags[45]) -w.Write(phrases[28]) -w.Write(profile_frags[46]) -} -w.Write(profile_frags[47]) -w.Write(profile_frags[48]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_profile_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[29]) -w.Write(footer_frags[2]) -w.Write(phrases[30]) -w.Write(footer_frags[3]) -w.Write(phrases[31]) -w.Write(footer_frags[4]) -if len(tmpl_profile_vars.Header.Themes) != 0 { -for _, item := range tmpl_profile_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_profile_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_profile_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/template_register.go b/template_register.go deleted file mode 100644 index 24129fdf..00000000 --- a/template_register.go +++ /dev/null @@ -1,137 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "io" -import "./common" - -var register_tmpl_phrase_id int - -// nolint -func init() { - common.Template_register_handle = Template_register - common.Ctemplates = append(common.Ctemplates,"register") - common.TmplPtrMap["register"] = &common.Template_register_handle - common.TmplPtrMap["o_register"] = Template_register - register_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "register_head", - "register_account_name", - "register_account_name", - "register_account_email", - "register_account_password", - "register_account_confirm_password", - "register_submit_button", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_register(tmpl_register_vars common.Page, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(register_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_register_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_register_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_register_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_register_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_register_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_register_vars.Header.Scripts) != 0 { -for _, item := range tmpl_register_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_register_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_register_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_register_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_register_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_register_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_register_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_register_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_register_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_register_vars.Header))) -w.Write(header_frags[21]) -if tmpl_register_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_register_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_register_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -w.Write(register_frags[0]) -w.Write(phrases[1]) -w.Write(register_frags[1]) -w.Write(phrases[2]) -w.Write(register_frags[2]) -w.Write(phrases[3]) -w.Write(register_frags[3]) -w.Write(phrases[4]) -w.Write(register_frags[4]) -w.Write(phrases[5]) -w.Write(register_frags[5]) -w.Write(phrases[6]) -w.Write(register_frags[6]) -w.Write(phrases[7]) -w.Write(register_frags[7]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_register_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[8]) -w.Write(footer_frags[2]) -w.Write(phrases[9]) -w.Write(footer_frags[3]) -w.Write(phrases[10]) -w.Write(footer_frags[4]) -if len(tmpl_register_vars.Header.Themes) != 0 { -for _, item := range tmpl_register_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_register_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_register_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/template_topic.go b/template_topic.go deleted file mode 100644 index 8e526213..00000000 --- a/template_topic.go +++ /dev/null @@ -1,590 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "strconv" -import "io" -import "./common" - -var topic_tmpl_phrase_id int - -// nolint -func init() { - common.Template_topic_handle = Template_topic - common.Ctemplates = append(common.Ctemplates,"topic") - common.TmplPtrMap["topic"] = &common.Template_topic_handle - common.TmplPtrMap["o_topic"] = Template_topic - topic_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "paginator_prev_page_aria", - "paginator_less_than", - "paginator_next_page_aria", - "paginator_greater_than", - "topic_opening_post_aria", - "status_closed_tooltip", - "topic_status_closed_aria", - "topic_title_input_aria", - "topic_update_button", - "topic_poll_aria", - "topic_poll_vote", - "topic_poll_results", - "topic_poll_cancel", - "topic_opening_post_aria", - "topic_post_controls_aria", - "topic_unlike_tooltip", - "topic_unlike_aria", - "topic_like_tooltip", - "topic_like_aria", - "topic_edit_tooltip", - "topic_edit_aria", - "topic_delete_tooltip", - "topic_delete_aria", - "topic_unlock_tooltip", - "topic_unlock_aria", - "topic_lock_tooltip", - "topic_lock_aria", - "topic_unpin_tooltip", - "topic_unpin_aria", - "topic_pin_tooltip", - "topic_pin_aria", - "topic_ip_tooltip", - "topic_flag_tooltip", - "topic_flag_aria", - "topic_like_count_aria", - "topic_like_count_tooltip", - "topic_level_aria", - "topic_level_tooltip", - "topic_current_page_aria", - "topic_post_like_tooltip", - "topic_post_like_aria", - "topic_post_unlike_tooltip", - "topic_post_unlike_aria", - "topic_post_edit_tooltip", - "topic_post_edit_aria", - "topic_post_delete_tooltip", - "topic_post_delete_aria", - "topic_post_ip_tooltip", - "topic_post_flag_tooltip", - "topic_post_flag_aria", - "topic_post_like_count_tooltip", - "topic_post_level_aria", - "topic_post_level_tooltip", - "topic_reply_aria", - "topic_reply_content", - "topic_reply_add_poll_option", - "topic_reply_button", - "topic_reply_add_poll_button", - "topic_reply_add_file_button", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_topic(tmpl_topic_vars common.TopicPage, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(topic_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_topic_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_topic_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_topic_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_topic_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_topic_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_topic_vars.Header.Scripts) != 0 { -for _, item := range tmpl_topic_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_topic_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_topic_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_topic_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_topic_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_topic_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_topic_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_topic_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_topic_vars.Header))) -w.Write(header_frags[21]) -if tmpl_topic_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_topic_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_topic_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -w.Write(topic_frags[0]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[1]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[2]) -if tmpl_topic_vars.Page > 1 { -w.Write(topic_frags[3]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[4]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page - 1))) -w.Write(topic_frags[5]) -w.Write(phrases[1]) -w.Write(topic_frags[6]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[7]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page - 1))) -w.Write(topic_frags[8]) -w.Write(phrases[2]) -w.Write(topic_frags[9]) -} -if tmpl_topic_vars.LastPage != tmpl_topic_vars.Page { -w.Write(topic_frags[10]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[11]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1))) -w.Write(topic_frags[12]) -w.Write(phrases[3]) -w.Write(topic_frags[13]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[14]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1))) -w.Write(topic_frags[15]) -w.Write(phrases[4]) -w.Write(topic_frags[16]) -} -w.Write(topic_frags[17]) -w.Write(topic_frags[18]) -w.Write(phrases[5]) -w.Write(topic_frags[19]) -if tmpl_topic_vars.Topic.Sticky { -w.Write(topic_frags[20]) -} else { -if tmpl_topic_vars.Topic.IsClosed { -w.Write(topic_frags[21]) -} -} -w.Write(topic_frags[22]) -w.Write([]byte(tmpl_topic_vars.Topic.Title)) -w.Write(topic_frags[23]) -w.Write([]byte(tmpl_topic_vars.Topic.Title)) -w.Write(topic_frags[24]) -if tmpl_topic_vars.Topic.IsClosed { -w.Write(topic_frags[25]) -w.Write(phrases[6]) -w.Write(topic_frags[26]) -w.Write(phrases[7]) -w.Write(topic_frags[27]) -} -if tmpl_topic_vars.CurrentUser.Perms.EditTopic { -w.Write(topic_frags[28]) -w.Write([]byte(tmpl_topic_vars.Topic.Title)) -w.Write(topic_frags[29]) -w.Write(phrases[8]) -w.Write(topic_frags[30]) -w.Write(phrases[9]) -w.Write(topic_frags[31]) -} -w.Write(topic_frags[32]) -if tmpl_topic_vars.Poll.ID > 0 { -w.Write(topic_frags[33]) -w.Write(phrases[10]) -w.Write(topic_frags[34]) -w.Write([]byte(tmpl_topic_vars.Topic.ClassName)) -w.Write(topic_frags[35]) -w.Write([]byte(tmpl_topic_vars.Topic.Avatar)) -w.Write(topic_frags[36]) -w.Write([]byte(tmpl_topic_vars.Header.Theme.Name)) -w.Write(topic_frags[37]) -if tmpl_topic_vars.Topic.ContentLines <= 5 { -w.Write(topic_frags[38]) -} -w.Write(topic_frags[39]) -if len(tmpl_topic_vars.Poll.QuickOptions) != 0 { -for _, item := range tmpl_topic_vars.Poll.QuickOptions { -w.Write(topic_frags[40]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Poll.ID))) -w.Write(topic_frags[41]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_frags[42]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_frags[43]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_frags[44]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_frags[45]) -w.Write([]byte(item.Value)) -w.Write(topic_frags[46]) -} -} -w.Write(topic_frags[47]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Poll.ID))) -w.Write(topic_frags[48]) -w.Write(phrases[11]) -w.Write(topic_frags[49]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Poll.ID))) -w.Write(topic_frags[50]) -w.Write(phrases[12]) -w.Write(topic_frags[51]) -w.Write(phrases[13]) -w.Write(topic_frags[52]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Poll.ID))) -w.Write(topic_frags[53]) -} -w.Write(topic_frags[54]) -w.Write(topic_frags[55]) -w.Write(phrases[14]) -w.Write(topic_frags[56]) -w.Write([]byte(tmpl_topic_vars.Topic.ClassName)) -w.Write(topic_frags[57]) -w.Write([]byte(tmpl_topic_vars.Topic.Avatar)) -w.Write(topic_frags[58]) -w.Write([]byte(tmpl_topic_vars.Header.Theme.Name)) -w.Write(topic_frags[59]) -if tmpl_topic_vars.Topic.ContentLines <= 5 { -w.Write(topic_frags[60]) -} -w.Write(topic_frags[61]) -w.Write([]byte(tmpl_topic_vars.Topic.ContentHTML)) -w.Write(topic_frags[62]) -w.Write([]byte(tmpl_topic_vars.Topic.Content)) -w.Write(topic_frags[63]) -if tmpl_topic_vars.Topic.LikeCount > 0 { -w.Write(topic_frags[64]) -} -w.Write(topic_frags[65]) -w.Write(phrases[15]) -w.Write(topic_frags[66]) -w.Write([]byte(tmpl_topic_vars.Topic.UserLink)) -w.Write(topic_frags[67]) -w.Write([]byte(tmpl_topic_vars.Topic.CreatedByName)) -w.Write(topic_frags[68]) -if tmpl_topic_vars.CurrentUser.Perms.LikeItem { -w.Write(topic_frags[69]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[70]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[71]) -if tmpl_topic_vars.Topic.Liked { -w.Write(topic_frags[72]) -w.Write(phrases[16]) -w.Write(topic_frags[73]) -w.Write(phrases[17]) -w.Write(topic_frags[74]) -} else { -w.Write(topic_frags[75]) -w.Write(phrases[18]) -w.Write(topic_frags[76]) -w.Write(phrases[19]) -w.Write(topic_frags[77]) -} -w.Write(topic_frags[78]) -if tmpl_topic_vars.Topic.Liked { -w.Write(topic_frags[79]) -} else { -w.Write(topic_frags[80]) -} -w.Write(topic_frags[81]) -} -if tmpl_topic_vars.CurrentUser.Perms.EditTopic { -w.Write(topic_frags[82]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[83]) -w.Write(phrases[20]) -w.Write(topic_frags[84]) -w.Write(phrases[21]) -w.Write(topic_frags[85]) -} -if tmpl_topic_vars.CurrentUser.Perms.DeleteTopic { -w.Write(topic_frags[86]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[87]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[88]) -w.Write(phrases[22]) -w.Write(topic_frags[89]) -w.Write(phrases[23]) -w.Write(topic_frags[90]) -} -if tmpl_topic_vars.CurrentUser.Perms.CloseTopic { -if tmpl_topic_vars.Topic.IsClosed { -w.Write(topic_frags[91]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[92]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[93]) -w.Write(phrases[24]) -w.Write(topic_frags[94]) -w.Write(phrases[25]) -w.Write(topic_frags[95]) -} else { -w.Write(topic_frags[96]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[97]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[98]) -w.Write(phrases[26]) -w.Write(topic_frags[99]) -w.Write(phrases[27]) -w.Write(topic_frags[100]) -} -} -if tmpl_topic_vars.CurrentUser.Perms.PinTopic { -if tmpl_topic_vars.Topic.Sticky { -w.Write(topic_frags[101]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[102]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[103]) -w.Write(phrases[28]) -w.Write(topic_frags[104]) -w.Write(phrases[29]) -w.Write(topic_frags[105]) -} else { -w.Write(topic_frags[106]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[107]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[108]) -w.Write(phrases[30]) -w.Write(topic_frags[109]) -w.Write(phrases[31]) -w.Write(topic_frags[110]) -} -} -if tmpl_topic_vars.CurrentUser.Perms.ViewIPs { -w.Write(topic_frags[111]) -w.Write([]byte(tmpl_topic_vars.Topic.IPAddress)) -w.Write(topic_frags[112]) -w.Write(phrases[32]) -w.Write(topic_frags[113]) -w.Write([]byte(tmpl_topic_vars.Topic.IPAddress)) -w.Write(topic_frags[114]) -} -w.Write(topic_frags[115]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[116]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[117]) -w.Write(phrases[33]) -w.Write(topic_frags[118]) -w.Write(phrases[34]) -w.Write(topic_frags[119]) -w.Write(phrases[35]) -w.Write(topic_frags[120]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.LikeCount))) -w.Write(topic_frags[121]) -w.Write(phrases[36]) -w.Write(topic_frags[122]) -if tmpl_topic_vars.Topic.Tag != "" { -w.Write(topic_frags[123]) -w.Write([]byte(tmpl_topic_vars.Topic.Tag)) -w.Write(topic_frags[124]) -} else { -w.Write(topic_frags[125]) -w.Write(phrases[37]) -w.Write(topic_frags[126]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level))) -w.Write(topic_frags[127]) -w.Write(phrases[38]) -w.Write(topic_frags[128]) -} -w.Write(topic_frags[129]) -w.Write(phrases[39]) -w.Write(topic_frags[130]) -if len(tmpl_topic_vars.ItemList) != 0 { -for _, item := range tmpl_topic_vars.ItemList { -if item.ActionType != "" { -w.Write(topic_frags[131]) -w.Write([]byte(item.ActionIcon)) -w.Write(topic_frags[132]) -w.Write([]byte(item.ActionType)) -w.Write(topic_frags[133]) -} else { -w.Write(topic_frags[134]) -w.Write(topic_frags[135]) -w.Write([]byte(item.ClassName)) -w.Write(topic_frags[136]) -w.Write([]byte(item.Avatar)) -w.Write(topic_frags[137]) -w.Write([]byte(tmpl_topic_vars.Header.Theme.Name)) -w.Write(topic_frags[138]) -if item.ContentLines <= 5 { -w.Write(topic_frags[139]) -} -w.Write(topic_frags[140]) -w.Write(topic_frags[141]) -w.Write([]byte(item.ContentHtml)) -w.Write(topic_frags[142]) -if item.LikeCount > 0 { -w.Write(topic_frags[143]) -} -w.Write(topic_frags[144]) -w.Write([]byte(item.UserLink)) -w.Write(topic_frags[145]) -w.Write([]byte(item.CreatedByName)) -w.Write(topic_frags[146]) -if tmpl_topic_vars.CurrentUser.Perms.LikeItem { -if item.Liked { -w.Write(topic_frags[147]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_frags[148]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[149]) -w.Write(phrases[40]) -w.Write(topic_frags[150]) -w.Write(phrases[41]) -w.Write(topic_frags[151]) -} else { -w.Write(topic_frags[152]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_frags[153]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[154]) -w.Write(phrases[42]) -w.Write(topic_frags[155]) -w.Write(phrases[43]) -w.Write(topic_frags[156]) -} -} -if tmpl_topic_vars.CurrentUser.Perms.EditReply { -w.Write(topic_frags[157]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_frags[158]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[159]) -w.Write(phrases[44]) -w.Write(topic_frags[160]) -w.Write(phrases[45]) -w.Write(topic_frags[161]) -} -if tmpl_topic_vars.CurrentUser.Perms.DeleteReply { -w.Write(topic_frags[162]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_frags[163]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[164]) -w.Write(phrases[46]) -w.Write(topic_frags[165]) -w.Write(phrases[47]) -w.Write(topic_frags[166]) -} -if tmpl_topic_vars.CurrentUser.Perms.ViewIPs { -w.Write(topic_frags[167]) -w.Write([]byte(item.IPAddress)) -w.Write(topic_frags[168]) -w.Write(phrases[48]) -w.Write(topic_frags[169]) -w.Write([]byte(item.IPAddress)) -w.Write(topic_frags[170]) -} -w.Write(topic_frags[171]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_frags[172]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[173]) -w.Write(phrases[49]) -w.Write(topic_frags[174]) -w.Write(phrases[50]) -w.Write(topic_frags[175]) -w.Write([]byte(strconv.Itoa(item.LikeCount))) -w.Write(topic_frags[176]) -w.Write(phrases[51]) -w.Write(topic_frags[177]) -if item.Tag != "" { -w.Write(topic_frags[178]) -w.Write([]byte(item.Tag)) -w.Write(topic_frags[179]) -} else { -w.Write(topic_frags[180]) -w.Write(phrases[52]) -w.Write(topic_frags[181]) -w.Write([]byte(strconv.Itoa(item.Level))) -w.Write(topic_frags[182]) -w.Write(phrases[53]) -w.Write(topic_frags[183]) -} -w.Write(topic_frags[184]) -} -} -} -w.Write(topic_frags[185]) -if tmpl_topic_vars.CurrentUser.Perms.CreateReply { -w.Write(topic_frags[186]) -w.Write(phrases[54]) -w.Write(topic_frags[187]) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) -w.Write(topic_frags[188]) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_frags[189]) -w.Write(phrases[55]) -w.Write(topic_frags[190]) -w.Write(phrases[56]) -w.Write(topic_frags[191]) -w.Write(phrases[57]) -w.Write(topic_frags[192]) -w.Write(phrases[58]) -w.Write(topic_frags[193]) -if tmpl_topic_vars.CurrentUser.Perms.UploadFiles { -w.Write(topic_frags[194]) -w.Write(phrases[59]) -w.Write(topic_frags[195]) -} -w.Write(topic_frags[196]) -} -w.Write(topic_frags[197]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_topic_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[60]) -w.Write(footer_frags[2]) -w.Write(phrases[61]) -w.Write(footer_frags[3]) -w.Write(phrases[62]) -w.Write(footer_frags[4]) -if len(tmpl_topic_vars.Header.Themes) != 0 { -for _, item := range tmpl_topic_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_topic_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_topic_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/template_topic_alt.go b/template_topic_alt.go deleted file mode 100644 index 90eaf452..00000000 --- a/template_topic_alt.go +++ /dev/null @@ -1,583 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "./common" -import "strconv" -import "io" - -var topic_alt_tmpl_phrase_id int - -// nolint -func init() { - common.Template_topic_alt_handle = Template_topic_alt - common.Ctemplates = append(common.Ctemplates,"topic_alt") - common.TmplPtrMap["topic_alt"] = &common.Template_topic_alt_handle - common.TmplPtrMap["o_topic_alt"] = Template_topic_alt - topic_alt_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "paginator_prev_page_aria", - "paginator_less_than", - "paginator_next_page_aria", - "paginator_greater_than", - "topic_opening_post_aria", - "status_closed_tooltip", - "topic_status_closed_aria", - "topic_title_input_aria", - "topic_update_button", - "topic_userinfo_aria", - "topic_level_prefix", - "topic_poll_vote", - "topic_poll_results", - "topic_poll_cancel", - "topic_opening_post_aria", - "topic_userinfo_aria", - "topic_level_prefix", - "topic_like_aria", - "topic_edit_aria", - "topic_delete_aria", - "topic_unlock_aria", - "topic_lock_aria", - "topic_unpin_aria", - "topic_pin_aria", - "topic_ip_full_tooltip", - "topic_ip_full_aria", - "topic_report_aria", - "topic_like_count_aria", - "topic_ip_full_tooltip", - "topic_userinfo_aria", - "topic_level_prefix", - "topic_post_like_aria", - "topic_post_edit_aria", - "topic_post_delete_aria", - "topic_ip_full_tooltip", - "topic_ip_full_aria", - "topic_report_aria", - "topic_post_like_count_tooltip", - "topic_your_information", - "topic_level_prefix", - "topic_reply_aria", - "topic_reply_content_alt", - "topic_reply_add_poll_option", - "topic_reply_button", - "topic_reply_add_poll_button", - "topic_reply_add_file_button", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_topic_alt(tmpl_topic_alt_vars common.TopicPage, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(topic_alt_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_topic_alt_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_topic_alt_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_topic_alt_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_topic_alt_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_topic_alt_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_topic_alt_vars.Header.Scripts) != 0 { -for _, item := range tmpl_topic_alt_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_topic_alt_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_topic_alt_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_topic_alt_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_topic_alt_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_topic_alt_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_topic_alt_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_topic_alt_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_topic_alt_vars.Header))) -w.Write(header_frags[21]) -if tmpl_topic_alt_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_topic_alt_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_topic_alt_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -if tmpl_topic_alt_vars.Page > 1 { -w.Write(topic_alt_frags[0]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[1]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page - 1))) -w.Write(topic_alt_frags[2]) -w.Write(phrases[1]) -w.Write(topic_alt_frags[3]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[4]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page - 1))) -w.Write(topic_alt_frags[5]) -w.Write(phrases[2]) -w.Write(topic_alt_frags[6]) -} -if tmpl_topic_alt_vars.LastPage != tmpl_topic_alt_vars.Page { -w.Write(topic_alt_frags[7]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[8]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page + 1))) -w.Write(topic_alt_frags[9]) -w.Write(phrases[3]) -w.Write(topic_alt_frags[10]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[11]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page + 1))) -w.Write(topic_alt_frags[12]) -w.Write(phrases[4]) -w.Write(topic_alt_frags[13]) -} -w.Write(topic_alt_frags[14]) -w.Write(topic_alt_frags[15]) -w.Write(phrases[5]) -w.Write(topic_alt_frags[16]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[17]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[18]) -if tmpl_topic_alt_vars.Topic.Sticky { -w.Write(topic_alt_frags[19]) -} else { -if tmpl_topic_alt_vars.Topic.IsClosed { -w.Write(topic_alt_frags[20]) -} -} -w.Write(topic_alt_frags[21]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Title)) -w.Write(topic_alt_frags[22]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Title)) -w.Write(topic_alt_frags[23]) -if tmpl_topic_alt_vars.Topic.IsClosed { -w.Write(topic_alt_frags[24]) -w.Write(phrases[6]) -w.Write(topic_alt_frags[25]) -w.Write(phrases[7]) -w.Write(topic_alt_frags[26]) -} -if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic { -w.Write(topic_alt_frags[27]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Title)) -w.Write(topic_alt_frags[28]) -w.Write(phrases[8]) -w.Write(topic_alt_frags[29]) -w.Write(phrases[9]) -w.Write(topic_alt_frags[30]) -} -w.Write(topic_alt_frags[31]) -if tmpl_topic_alt_vars.Poll.ID > 0 { -w.Write(topic_alt_frags[32]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID))) -w.Write(topic_alt_frags[33]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID))) -w.Write(topic_alt_frags[34]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[35]) -w.Write(phrases[10]) -w.Write(topic_alt_frags[36]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar)) -w.Write(topic_alt_frags[37]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.UserLink)) -w.Write(topic_alt_frags[38]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName)) -w.Write(topic_alt_frags[39]) -if tmpl_topic_alt_vars.Topic.Tag != "" { -w.Write(topic_alt_frags[40]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag)) -w.Write(topic_alt_frags[41]) -} else { -w.Write(topic_alt_frags[42]) -w.Write(phrases[11]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level))) -w.Write(topic_alt_frags[43]) -} -w.Write(topic_alt_frags[44]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID))) -w.Write(topic_alt_frags[45]) -if len(tmpl_topic_alt_vars.Poll.QuickOptions) != 0 { -for _, item := range tmpl_topic_alt_vars.Poll.QuickOptions { -w.Write(topic_alt_frags[46]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID))) -w.Write(topic_alt_frags[47]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_alt_frags[48]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_alt_frags[49]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_alt_frags[50]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_alt_frags[51]) -w.Write([]byte(item.Value)) -w.Write(topic_alt_frags[52]) -} -} -w.Write(topic_alt_frags[53]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID))) -w.Write(topic_alt_frags[54]) -w.Write(phrases[12]) -w.Write(topic_alt_frags[55]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID))) -w.Write(topic_alt_frags[56]) -w.Write(phrases[13]) -w.Write(topic_alt_frags[57]) -w.Write(phrases[14]) -w.Write(topic_alt_frags[58]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID))) -w.Write(topic_alt_frags[59]) -} -w.Write(topic_alt_frags[60]) -w.Write(topic_alt_frags[61]) -w.Write(phrases[15]) -w.Write(topic_alt_frags[62]) -w.Write(phrases[16]) -w.Write(topic_alt_frags[63]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar)) -w.Write(topic_alt_frags[64]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.UserLink)) -w.Write(topic_alt_frags[65]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName)) -w.Write(topic_alt_frags[66]) -if tmpl_topic_alt_vars.Topic.Tag != "" { -w.Write(topic_alt_frags[67]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag)) -w.Write(topic_alt_frags[68]) -} else { -w.Write(topic_alt_frags[69]) -w.Write(phrases[17]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level))) -w.Write(topic_alt_frags[70]) -} -w.Write(topic_alt_frags[71]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.ContentHTML)) -w.Write(topic_alt_frags[72]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.Content)) -w.Write(topic_alt_frags[73]) -if tmpl_topic_alt_vars.Topic.LikeCount > 0 { -w.Write(topic_alt_frags[74]) -} -w.Write(topic_alt_frags[75]) -if tmpl_topic_alt_vars.CurrentUser.Loggedin { -if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem { -w.Write(topic_alt_frags[76]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[77]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[78]) -if tmpl_topic_alt_vars.Topic.Liked { -w.Write(topic_alt_frags[79]) -} else { -w.Write(topic_alt_frags[80]) -} -w.Write(topic_alt_frags[81]) -w.Write(phrases[18]) -w.Write(topic_alt_frags[82]) -} -if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic { -w.Write(topic_alt_frags[83]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[84]) -w.Write(phrases[19]) -w.Write(topic_alt_frags[85]) -} -if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteTopic { -w.Write(topic_alt_frags[86]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[87]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[88]) -w.Write(phrases[20]) -w.Write(topic_alt_frags[89]) -} -if tmpl_topic_alt_vars.CurrentUser.Perms.CloseTopic { -if tmpl_topic_alt_vars.Topic.IsClosed { -w.Write(topic_alt_frags[90]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[91]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[92]) -w.Write(phrases[21]) -w.Write(topic_alt_frags[93]) -} else { -w.Write(topic_alt_frags[94]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[95]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[96]) -w.Write(phrases[22]) -w.Write(topic_alt_frags[97]) -} -} -if tmpl_topic_alt_vars.CurrentUser.Perms.PinTopic { -if tmpl_topic_alt_vars.Topic.Sticky { -w.Write(topic_alt_frags[98]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[99]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[100]) -w.Write(phrases[23]) -w.Write(topic_alt_frags[101]) -} else { -w.Write(topic_alt_frags[102]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[103]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[104]) -w.Write(phrases[24]) -w.Write(topic_alt_frags[105]) -} -} -if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { -w.Write(topic_alt_frags[106]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress)) -w.Write(topic_alt_frags[107]) -w.Write(phrases[25]) -w.Write(topic_alt_frags[108]) -w.Write(phrases[26]) -w.Write(topic_alt_frags[109]) -} -w.Write(topic_alt_frags[110]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[111]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[112]) -w.Write(phrases[27]) -w.Write(topic_alt_frags[113]) -} -w.Write(topic_alt_frags[114]) -w.Write(phrases[28]) -w.Write(topic_alt_frags[115]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.LikeCount))) -w.Write(topic_alt_frags[116]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.RelativeCreatedAt)) -w.Write(topic_alt_frags[117]) -if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { -w.Write(topic_alt_frags[118]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress)) -w.Write(topic_alt_frags[119]) -w.Write(phrases[29]) -w.Write(topic_alt_frags[120]) -w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress)) -w.Write(topic_alt_frags[121]) -} -w.Write(topic_alt_frags[122]) -if len(tmpl_topic_alt_vars.ItemList) != 0 { -for _, item := range tmpl_topic_alt_vars.ItemList { -w.Write(topic_alt_frags[123]) -w.Write(topic_alt_frags[124]) -if item.ActionType != "" { -w.Write(topic_alt_frags[125]) -} -w.Write(topic_alt_frags[126]) -w.Write(phrases[30]) -w.Write(topic_alt_frags[127]) -w.Write([]byte(item.Avatar)) -w.Write(topic_alt_frags[128]) -w.Write([]byte(item.UserLink)) -w.Write(topic_alt_frags[129]) -w.Write([]byte(item.CreatedByName)) -w.Write(topic_alt_frags[130]) -if item.Tag != "" { -w.Write(topic_alt_frags[131]) -w.Write([]byte(item.Tag)) -w.Write(topic_alt_frags[132]) -} else { -w.Write(topic_alt_frags[133]) -w.Write(phrases[31]) -w.Write([]byte(strconv.Itoa(item.Level))) -w.Write(topic_alt_frags[134]) -} -w.Write(topic_alt_frags[135]) -if item.ActionType != "" { -w.Write(topic_alt_frags[136]) -} -w.Write(topic_alt_frags[137]) -if item.ActionType != "" { -w.Write(topic_alt_frags[138]) -w.Write([]byte(item.ActionIcon)) -w.Write(topic_alt_frags[139]) -w.Write([]byte(item.ActionType)) -w.Write(topic_alt_frags[140]) -} else { -w.Write(topic_alt_frags[141]) -w.Write([]byte(item.ContentHtml)) -w.Write(topic_alt_frags[142]) -if item.LikeCount > 0 { -w.Write(topic_alt_frags[143]) -} -w.Write(topic_alt_frags[144]) -if tmpl_topic_alt_vars.CurrentUser.Loggedin { -if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem { -w.Write(topic_alt_frags[145]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_alt_frags[146]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[147]) -if item.Liked { -w.Write(topic_alt_frags[148]) -} else { -w.Write(topic_alt_frags[149]) -} -w.Write(topic_alt_frags[150]) -w.Write(phrases[32]) -w.Write(topic_alt_frags[151]) -} -if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply { -w.Write(topic_alt_frags[152]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_alt_frags[153]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[154]) -w.Write(phrases[33]) -w.Write(topic_alt_frags[155]) -} -if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply { -w.Write(topic_alt_frags[156]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_alt_frags[157]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[158]) -w.Write(phrases[34]) -w.Write(topic_alt_frags[159]) -} -if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { -w.Write(topic_alt_frags[160]) -w.Write([]byte(item.IPAddress)) -w.Write(topic_alt_frags[161]) -w.Write(phrases[35]) -w.Write(topic_alt_frags[162]) -w.Write(phrases[36]) -w.Write(topic_alt_frags[163]) -} -w.Write(topic_alt_frags[164]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_alt_frags[165]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[166]) -w.Write(phrases[37]) -w.Write(topic_alt_frags[167]) -} -w.Write(topic_alt_frags[168]) -w.Write(phrases[38]) -w.Write(topic_alt_frags[169]) -w.Write([]byte(strconv.Itoa(item.LikeCount))) -w.Write(topic_alt_frags[170]) -w.Write([]byte(item.RelativeCreatedAt)) -w.Write(topic_alt_frags[171]) -if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { -w.Write(topic_alt_frags[172]) -w.Write([]byte(item.IPAddress)) -w.Write(topic_alt_frags[173]) -w.Write([]byte(item.IPAddress)) -w.Write(topic_alt_frags[174]) -} -w.Write(topic_alt_frags[175]) -} -w.Write(topic_alt_frags[176]) -} -} -w.Write(topic_alt_frags[177]) -if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply { -w.Write(topic_alt_frags[178]) -w.Write(phrases[39]) -w.Write(topic_alt_frags[179]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Avatar)) -w.Write(topic_alt_frags[180]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Link)) -w.Write(topic_alt_frags[181]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Name)) -w.Write(topic_alt_frags[182]) -if tmpl_topic_alt_vars.CurrentUser.Tag != "" { -w.Write(topic_alt_frags[183]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Tag)) -w.Write(topic_alt_frags[184]) -} else { -w.Write(topic_alt_frags[185]) -w.Write(phrases[40]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.CurrentUser.Level))) -w.Write(topic_alt_frags[186]) -} -w.Write(topic_alt_frags[187]) -w.Write(phrases[41]) -w.Write(topic_alt_frags[188]) -w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) -w.Write(topic_alt_frags[189]) -w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) -w.Write(topic_alt_frags[190]) -w.Write(phrases[42]) -w.Write(topic_alt_frags[191]) -w.Write(phrases[43]) -w.Write(topic_alt_frags[192]) -w.Write(phrases[44]) -w.Write(topic_alt_frags[193]) -w.Write(phrases[45]) -w.Write(topic_alt_frags[194]) -if tmpl_topic_alt_vars.CurrentUser.Perms.UploadFiles { -w.Write(topic_alt_frags[195]) -w.Write(phrases[46]) -w.Write(topic_alt_frags[196]) -} -w.Write(topic_alt_frags[197]) -} -w.Write(topic_alt_frags[198]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_topic_alt_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[47]) -w.Write(footer_frags[2]) -w.Write(phrases[48]) -w.Write(footer_frags[3]) -w.Write(phrases[49]) -w.Write(footer_frags[4]) -if len(tmpl_topic_alt_vars.Header.Themes) != 0 { -for _, item := range tmpl_topic_alt_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_topic_alt_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_topic_alt_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/template_topics.go b/template_topics.go deleted file mode 100644 index eaa656e5..00000000 --- a/template_topics.go +++ /dev/null @@ -1,388 +0,0 @@ -// +build !no_templategen - -// Code generated by Gosora. More below: -/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ -package main -import "io" -import "./common" -import "strconv" - -var topics_tmpl_phrase_id int - -// nolint -func init() { - common.Template_topics_handle = Template_topics - common.Ctemplates = append(common.Ctemplates,"topics") - common.TmplPtrMap["topics"] = &common.Template_topics_handle - common.TmplPtrMap["o_topics"] = Template_topics - topics_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{ - "menu_hamburger_tooltip", - "topics_head", - "topic_list_create_topic_tooltip", - "topic_list_create_topic_aria", - "topic_list_moderate_tooltip", - "topic_list_moderate_aria", - "topics_locked_tooltip", - "topics_locked_aria", - "topic_list_what_to_do", - "topic_list_moderate_delete", - "topic_list_moderate_lock", - "topic_list_moderate_move", - "topic_list_moderate_run", - "topic_list_move_head", - "topic_list_move_button", - "quick_topic_aria", - "quick_topic_avatar_alt", - "quick_topic_avatar_tooltip", - "quick_topic_whatsup", - "quick_topic_content_placeholder", - "quick_topic_add_poll_option", - "quick_topic_create_topic_button", - "quick_topic_add_poll_button", - "quick_topic_add_file_button", - "quick_topic_cancel_button", - "topics_list_aria", - "status_closed_tooltip", - "status_pinned_tooltip", - "topics_no_topics", - "topics_start_one", - "paginator_prev_page_aria", - "paginator_prev_page", - "paginator_next_page_aria", - "paginator_next_page", - "footer_powered_by", - "footer_made_with_love", - "footer_theme_selector_aria", - }) -} - -// nolint -func Template_topics(tmpl_topics_vars common.TopicListPage, w io.Writer) error { -var phrases = common.GetTmplPhrasesBytes(topics_tmpl_phrase_id) -w.Write(header_frags[0]) -w.Write([]byte(tmpl_topics_vars.Title)) -w.Write(header_frags[1]) -w.Write([]byte(tmpl_topics_vars.Header.Site.Name)) -w.Write(header_frags[2]) -w.Write([]byte(tmpl_topics_vars.Header.Theme.Name)) -w.Write(header_frags[3]) -if len(tmpl_topics_vars.Header.Stylesheets) != 0 { -for _, item := range tmpl_topics_vars.Header.Stylesheets { -w.Write(header_frags[4]) -w.Write([]byte(item)) -w.Write(header_frags[5]) -} -} -w.Write(header_frags[6]) -if len(tmpl_topics_vars.Header.Scripts) != 0 { -for _, item := range tmpl_topics_vars.Header.Scripts { -w.Write(header_frags[7]) -w.Write([]byte(item)) -w.Write(header_frags[8]) -} -} -w.Write(header_frags[9]) -w.Write([]byte(tmpl_topics_vars.CurrentUser.Session)) -w.Write(header_frags[10]) -w.Write([]byte(tmpl_topics_vars.Header.Site.URL)) -w.Write(header_frags[11]) -if tmpl_topics_vars.Header.MetaDesc != "" { -w.Write(header_frags[12]) -w.Write([]byte(tmpl_topics_vars.Header.MetaDesc)) -w.Write(header_frags[13]) -} -w.Write(header_frags[14]) -if !tmpl_topics_vars.CurrentUser.IsSuperMod { -w.Write(header_frags[15]) -} -w.Write(header_frags[16]) -w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_topics_vars.Header))) -w.Write(header_frags[17]) -w.Write([]byte(tmpl_topics_vars.Header.Site.ShortName)) -w.Write(header_frags[18]) -w.Write([]byte(common.BuildWidget("topMenu",tmpl_topics_vars.Header))) -w.Write(header_frags[19]) -w.Write(phrases[0]) -w.Write(header_frags[20]) -w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_topics_vars.Header))) -w.Write(header_frags[21]) -if tmpl_topics_vars.Header.Widgets.RightSidebar != "" { -w.Write(header_frags[22]) -} -w.Write(header_frags[23]) -if len(tmpl_topics_vars.Header.NoticeList) != 0 { -for _, item := range tmpl_topics_vars.Header.NoticeList { -w.Write(notice_frags[0]) -w.Write([]byte(item)) -w.Write(notice_frags[1]) -} -} -w.Write(header_frags[24]) -w.Write(topics_frags[0]) -if tmpl_topics_vars.CurrentUser.ID != 0 { -w.Write(topics_frags[1]) -} -w.Write(topics_frags[2]) -w.Write(phrases[1]) -w.Write(topics_frags[3]) -if tmpl_topics_vars.CurrentUser.ID != 0 { -w.Write(topics_frags[4]) -if len(tmpl_topics_vars.ForumList) != 0 { -w.Write(topics_frags[5]) -w.Write(phrases[2]) -w.Write(topics_frags[6]) -w.Write(phrases[3]) -w.Write(topics_frags[7]) -w.Write(topics_frags[8]) -w.Write(phrases[4]) -w.Write(topics_frags[9]) -w.Write(phrases[5]) -w.Write(topics_frags[10]) -} else { -w.Write(topics_frags[11]) -w.Write(phrases[6]) -w.Write(topics_frags[12]) -w.Write(phrases[7]) -w.Write(topics_frags[13]) -} -w.Write(topics_frags[14]) -} -w.Write(topics_frags[15]) -if tmpl_topics_vars.CurrentUser.ID != 0 { -w.Write(topics_frags[16]) -w.Write(phrases[8]) -w.Write(topics_frags[17]) -w.Write(phrases[9]) -w.Write(topics_frags[18]) -w.Write(phrases[10]) -w.Write(topics_frags[19]) -w.Write(phrases[11]) -w.Write(topics_frags[20]) -w.Write(phrases[12]) -w.Write(topics_frags[21]) -if len(tmpl_topics_vars.ForumList) != 0 { -w.Write(topics_frags[22]) -w.Write([]byte(tmpl_topics_vars.CurrentUser.Session)) -w.Write(topics_frags[23]) -w.Write(phrases[13]) -w.Write(topics_frags[24]) -if len(tmpl_topics_vars.ForumList) != 0 { -for _, item := range tmpl_topics_vars.ForumList { -w.Write(topics_frags[25]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topics_frags[26]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topics_frags[27]) -w.Write([]byte(item.Name)) -w.Write(topics_frags[28]) -} -} -w.Write(topics_frags[29]) -w.Write(phrases[14]) -w.Write(topics_frags[30]) -w.Write(phrases[15]) -w.Write(topics_frags[31]) -w.Write([]byte(tmpl_topics_vars.CurrentUser.Session)) -w.Write(topics_frags[32]) -w.Write([]byte(tmpl_topics_vars.CurrentUser.Avatar)) -w.Write(topics_frags[33]) -w.Write(phrases[16]) -w.Write(topics_frags[34]) -w.Write(phrases[17]) -w.Write(topics_frags[35]) -if len(tmpl_topics_vars.ForumList) != 0 { -for _, item := range tmpl_topics_vars.ForumList { -w.Write(topics_frags[36]) -if item.ID == tmpl_topics_vars.DefaultForum { -w.Write(topics_frags[37]) -} -w.Write(topics_frags[38]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topics_frags[39]) -w.Write([]byte(item.Name)) -w.Write(topics_frags[40]) -} -} -w.Write(topics_frags[41]) -w.Write(phrases[18]) -w.Write(topics_frags[42]) -w.Write(phrases[19]) -w.Write(topics_frags[43]) -w.Write(phrases[20]) -w.Write(topics_frags[44]) -w.Write(phrases[21]) -w.Write(topics_frags[45]) -w.Write(phrases[22]) -w.Write(topics_frags[46]) -if tmpl_topics_vars.CurrentUser.Perms.UploadFiles { -w.Write(topics_frags[47]) -w.Write(phrases[23]) -w.Write(topics_frags[48]) -} -w.Write(topics_frags[49]) -w.Write(phrases[24]) -w.Write(topics_frags[50]) -} -} -w.Write(topics_frags[51]) -w.Write(phrases[25]) -w.Write(topics_frags[52]) -if len(tmpl_topics_vars.TopicList) != 0 { -for _, item := range tmpl_topics_vars.TopicList { -w.Write(topics_frags[53]) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topics_frags[54]) -if item.Sticky { -w.Write(topics_frags[55]) -} else { -if item.IsClosed { -w.Write(topics_frags[56]) -} -} -w.Write(topics_frags[57]) -w.Write([]byte(item.Creator.Link)) -w.Write(topics_frags[58]) -w.Write([]byte(item.Creator.Avatar)) -w.Write(topics_frags[59]) -w.Write([]byte(item.Creator.Name)) -w.Write(topics_frags[60]) -w.Write([]byte(item.Creator.Name)) -w.Write(topics_frags[61]) -w.Write([]byte(item.Link)) -w.Write(topics_frags[62]) -w.Write([]byte(item.Title)) -w.Write(topics_frags[63]) -w.Write([]byte(item.Title)) -w.Write(topics_frags[64]) -if item.ForumName != "" { -w.Write(topics_frags[65]) -w.Write([]byte(item.ForumLink)) -w.Write(topics_frags[66]) -w.Write([]byte(item.ForumName)) -w.Write(topics_frags[67]) -w.Write([]byte(item.ForumName)) -w.Write(topics_frags[68]) -} -w.Write(topics_frags[69]) -w.Write([]byte(item.Creator.Link)) -w.Write(topics_frags[70]) -w.Write([]byte(item.Creator.Name)) -w.Write(topics_frags[71]) -w.Write([]byte(item.Creator.Name)) -w.Write(topics_frags[72]) -if item.IsClosed { -w.Write(topics_frags[73]) -w.Write(phrases[26]) -w.Write(topics_frags[74]) -} -if item.Sticky { -w.Write(topics_frags[75]) -w.Write(phrases[27]) -w.Write(topics_frags[76]) -} -w.Write(topics_frags[77]) -w.Write([]byte(strconv.Itoa(item.PostCount))) -w.Write(topics_frags[78]) -w.Write([]byte(strconv.Itoa(item.LikeCount))) -w.Write(topics_frags[79]) -if item.Sticky { -w.Write(topics_frags[80]) -} else { -if item.IsClosed { -w.Write(topics_frags[81]) -} -} -w.Write(topics_frags[82]) -w.Write([]byte(item.LastUser.Link)) -w.Write(topics_frags[83]) -w.Write([]byte(item.LastUser.Avatar)) -w.Write(topics_frags[84]) -w.Write([]byte(item.LastUser.Name)) -w.Write(topics_frags[85]) -w.Write([]byte(item.LastUser.Name)) -w.Write(topics_frags[86]) -w.Write([]byte(item.LastUser.Link)) -w.Write(topics_frags[87]) -w.Write([]byte(item.LastUser.Name)) -w.Write(topics_frags[88]) -w.Write([]byte(item.LastUser.Name)) -w.Write(topics_frags[89]) -w.Write([]byte(item.RelativeLastReplyAt)) -w.Write(topics_frags[90]) -} -} else { -w.Write(topics_frags[91]) -w.Write(phrases[28]) -if tmpl_topics_vars.CurrentUser.Perms.CreateTopic { -w.Write(topics_frags[92]) -w.Write(phrases[29]) -w.Write(topics_frags[93]) -} -w.Write(topics_frags[94]) -} -w.Write(topics_frags[95]) -if tmpl_topics_vars.LastPage > 1 { -w.Write(paginator_frags[0]) -if tmpl_topics_vars.Page > 1 { -w.Write(paginator_frags[1]) -w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page - 1))) -w.Write(paginator_frags[2]) -w.Write(phrases[30]) -w.Write(paginator_frags[3]) -w.Write(phrases[31]) -w.Write(paginator_frags[4]) -w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page - 1))) -w.Write(paginator_frags[5]) -} -if len(tmpl_topics_vars.PageList) != 0 { -for _, item := range tmpl_topics_vars.PageList { -w.Write(paginator_frags[6]) -w.Write([]byte(strconv.Itoa(item))) -w.Write(paginator_frags[7]) -w.Write([]byte(strconv.Itoa(item))) -w.Write(paginator_frags[8]) -} -} -if tmpl_topics_vars.LastPage != tmpl_topics_vars.Page { -w.Write(paginator_frags[9]) -w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page + 1))) -w.Write(paginator_frags[10]) -w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page + 1))) -w.Write(paginator_frags[11]) -w.Write(phrases[32]) -w.Write(paginator_frags[12]) -w.Write(phrases[33]) -w.Write(paginator_frags[13]) -} -w.Write(paginator_frags[14]) -} -w.Write(topics_frags[96]) -w.Write(footer_frags[0]) -w.Write([]byte(common.BuildWidget("footer",tmpl_topics_vars.Header))) -w.Write(footer_frags[1]) -w.Write(phrases[34]) -w.Write(footer_frags[2]) -w.Write(phrases[35]) -w.Write(footer_frags[3]) -w.Write(phrases[36]) -w.Write(footer_frags[4]) -if len(tmpl_topics_vars.Header.Themes) != 0 { -for _, item := range tmpl_topics_vars.Header.Themes { -if !item.HideFromThemes { -w.Write(footer_frags[5]) -w.Write([]byte(item.Name)) -w.Write(footer_frags[6]) -if tmpl_topics_vars.Header.Theme.Name == item.Name { -w.Write(footer_frags[7]) -} -w.Write(footer_frags[8]) -w.Write([]byte(item.FriendlyName)) -w.Write(footer_frags[9]) -} -} -} -w.Write(footer_frags[10]) -w.Write([]byte(common.BuildWidget("rightSidebar",tmpl_topics_vars.Header))) -w.Write(footer_frags[11]) -return nil -} diff --git a/templates/account_menu.html b/templates/account_menu.html index c9a5526c..b440b88a 100644 --- a/templates/account_menu.html +++ b/templates/account_menu.html @@ -1,5 +1,5 @@