2017-04-05 14:15:22 +00:00
package main
2017-05-07 08:31:41 +00:00
import (
2017-09-03 04:50:31 +00:00
"encoding/json"
2017-05-07 08:31:41 +00:00
"errors"
2017-09-03 04:50:31 +00:00
"fmt"
2017-05-07 08:31:41 +00:00
"html"
"html/template"
2017-09-23 19:57:13 +00:00
"io/ioutil"
2017-09-03 04:50:31 +00:00
"log"
"net/http"
2017-09-23 19:57:13 +00:00
"os"
"path/filepath"
2017-09-03 04:50:31 +00:00
"strconv"
"strings"
2017-05-07 08:31:41 +00:00
2017-11-11 04:06:16 +00:00
"./common"
2017-07-17 10:23:42 +00:00
"github.com/Azareal/gopsutil/mem"
2017-06-28 12:05:26 +00:00
)
2017-04-05 14:15:22 +00:00
2017-11-11 04:06:16 +00:00
func routePanel ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-07-17 10:23:42 +00:00
// We won't calculate this on the spot anymore, as the system doesn't seem to like it if we do multiple fetches simultaneously. Should we constantly calculate this on a background thread? Perhaps, the watchdog to scale back heavy features under load? One plus side is that we'd get immediate CPU percentages here instead of waiting it to kick in with WebSockets
2017-09-03 04:50:31 +00:00
var cpustr = "Unknown"
2017-07-17 10:23:42 +00:00
var cpuColour string
2017-05-07 08:31:41 +00:00
var ramstr , ramColour string
memres , err := mem . VirtualMemory ( )
if err != nil {
ramstr = "Unknown"
} else {
2017-11-11 04:06:16 +00:00
totalCount , totalUnit := common . ConvertByteUnit ( float64 ( memres . Total ) )
usedCount := common . ConvertByteInUnit ( float64 ( memres . Total - memres . Available ) , totalUnit )
2017-05-29 14:52:37 +00:00
2017-05-07 08:31:41 +00:00
// Round totals with .9s up, it's how most people see it anyway. Floats are notoriously imprecise, so do it off 0.85
2017-08-13 11:22:34 +00:00
//log.Print("pre used_count",used_count)
2017-05-07 08:31:41 +00:00
var totstr string
2017-09-03 04:50:31 +00:00
if ( totalCount - float64 ( int ( totalCount ) ) ) > 0.85 {
usedCount += 1.0 - ( totalCount - float64 ( int ( totalCount ) ) )
totstr = strconv . Itoa ( int ( totalCount ) + 1 )
2017-05-07 08:31:41 +00:00
} else {
2017-09-03 04:50:31 +00:00
totstr = fmt . Sprintf ( "%.1f" , totalCount )
2017-05-07 08:31:41 +00:00
}
2017-08-13 11:22:34 +00:00
//log.Print("post used_count",used_count)
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if usedCount > totalCount {
usedCount = totalCount
2017-05-07 08:31:41 +00:00
}
2017-09-03 04:50:31 +00:00
ramstr = fmt . Sprintf ( "%.1f" , usedCount ) + " / " + totstr + totalUnit
2017-05-29 14:52:37 +00:00
2017-05-07 08:31:41 +00:00
ramperc := ( ( memres . Total - memres . Available ) * 100 ) / memres . Total
2017-08-13 11:22:34 +00:00
//log.Print("ramperc",ramperc)
2017-05-07 08:31:41 +00:00
if ramperc < 50 {
ramColour = "stat_green"
} else if ramperc < 75 {
ramColour = "stat_orange"
} else {
ramColour = "stat_red"
}
}
2017-05-29 14:52:37 +00:00
2017-05-07 08:31:41 +00:00
var postCount int
2017-11-05 09:55:34 +00:00
err = stmts . todaysPostCount . QueryRow ( ) . Scan ( & postCount )
2017-06-28 12:05:26 +00:00
if err != nil && err != ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-05-07 08:31:41 +00:00
}
2017-09-03 04:50:31 +00:00
var postInterval = "day"
2017-05-29 14:52:37 +00:00
2017-05-07 08:31:41 +00:00
var postColour string
2017-05-11 13:04:43 +00:00
if postCount > 25 {
2017-05-07 08:31:41 +00:00
postColour = "stat_green"
2017-05-11 13:04:43 +00:00
} else if postCount > 5 {
2017-05-07 08:31:41 +00:00
postColour = "stat_orange"
} else {
postColour = "stat_red"
}
2017-05-29 14:52:37 +00:00
2017-05-07 08:31:41 +00:00
var topicCount int
2017-11-05 09:55:34 +00:00
err = stmts . todaysTopicCount . QueryRow ( ) . Scan ( & topicCount )
2017-06-28 12:05:26 +00:00
if err != nil && err != ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-05-07 08:31:41 +00:00
}
2017-09-03 04:50:31 +00:00
var topicInterval = "day"
2017-05-29 14:52:37 +00:00
2017-05-07 08:31:41 +00:00
var topicColour string
2017-05-11 13:04:43 +00:00
if topicCount > 8 {
2017-05-07 08:31:41 +00:00
topicColour = "stat_green"
} else if topicCount > 0 {
topicColour = "stat_orange"
} else {
topicColour = "stat_red"
}
2017-05-29 14:52:37 +00:00
2017-05-07 08:31:41 +00:00
var reportCount int
2017-11-05 09:55:34 +00:00
err = stmts . todaysReportCount . QueryRow ( ) . Scan ( & reportCount )
2017-06-28 12:05:26 +00:00
if err != nil && err != ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-05-07 08:31:41 +00:00
}
2017-09-03 04:50:31 +00:00
var reportInterval = "week"
2017-05-29 14:52:37 +00:00
2017-05-07 08:31:41 +00:00
var newUserCount int
2017-11-05 09:55:34 +00:00
err = stmts . todaysNewUserCount . QueryRow ( ) . Scan ( & newUserCount )
2017-06-28 12:05:26 +00:00
if err != nil && err != ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-05-07 08:31:41 +00:00
}
2017-09-03 04:50:31 +00:00
var newUserInterval = "week"
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
var gridElements = [ ] common . GridElement {
common . GridElement { "dash-version" , "v" + version . String ( ) , 0 , "grid_istat stat_green" , "" , "" , "Gosora is up-to-date :)" } ,
common . GridElement { "dash-cpu" , "CPU: " + cpustr , 1 , "grid_istat " + cpuColour , "" , "" , "The global CPU usage of this server" } ,
common . GridElement { "dash-ram" , "RAM: " + ramstr , 2 , "grid_istat " + ramColour , "" , "" , "The global RAM usage of this server" } ,
2017-05-11 13:04:43 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if enableWebsockets {
uonline := wsHub . userCount ( )
gonline := wsHub . guestCount ( )
2017-05-11 13:04:43 +00:00
totonline := uonline + gonline
2017-05-29 14:52:37 +00:00
2017-05-11 13:04:43 +00:00
var onlineColour string
if totonline > 10 {
onlineColour = "stat_green"
} else if totonline > 3 {
onlineColour = "stat_orange"
} else {
onlineColour = "stat_red"
}
2017-05-29 14:52:37 +00:00
2017-05-11 13:04:43 +00:00
var onlineGuestsColour string
if gonline > 10 {
onlineGuestsColour = "stat_green"
} else if gonline > 1 {
onlineGuestsColour = "stat_orange"
} else {
onlineGuestsColour = "stat_red"
}
2017-05-29 14:52:37 +00:00
2017-05-11 13:04:43 +00:00
var onlineUsersColour string
if uonline > 5 {
onlineUsersColour = "stat_green"
} else if uonline > 1 {
onlineUsersColour = "stat_orange"
} else {
onlineUsersColour = "stat_red"
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
totonline , totunit := common . ConvertFriendlyUnit ( totonline )
uonline , uunit := common . ConvertFriendlyUnit ( uonline )
gonline , gunit := common . ConvertFriendlyUnit ( gonline )
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
gridElements = append ( gridElements , common . GridElement { "dash-totonline" , strconv . Itoa ( totonline ) + totunit + " online" , 3 , "grid_stat " + onlineColour , "" , "" , "The number of people who are currently online" } )
gridElements = append ( gridElements , common . GridElement { "dash-gonline" , strconv . Itoa ( gonline ) + gunit + " guests online" , 4 , "grid_stat " + onlineGuestsColour , "" , "" , "The number of guests who are currently online" } )
gridElements = append ( gridElements , common . GridElement { "dash-uonline" , strconv . Itoa ( uonline ) + uunit + " users online" , 5 , "grid_stat " + onlineUsersColour , "" , "" , "The number of logged-in users who are currently online" } )
2017-05-07 08:31:41 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
gridElements = append ( gridElements , common . GridElement { "dash-postsperday" , strconv . Itoa ( postCount ) + " posts / " + postInterval , 6 , "grid_stat " + postColour , "" , "" , "The number of new posts over the last 24 hours" } )
gridElements = append ( gridElements , common . GridElement { "dash-topicsperday" , strconv . Itoa ( topicCount ) + " topics / " + topicInterval , 7 , "grid_stat " + topicColour , "" , "" , "The number of new topics over the last 24 hours" } )
gridElements = append ( gridElements , common . GridElement { "dash-totonlineperday" , "20 online / day" , 8 , "grid_stat stat_disabled" , "" , "" , "Coming Soon!" /*"The people online over the last 24 hours"*/ } )
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
gridElements = append ( gridElements , common . GridElement { "dash-searches" , "8 searches / week" , 9 , "grid_stat stat_disabled" , "" , "" , "Coming Soon!" /*"The number of searches over the last 7 days"*/ } )
gridElements = append ( gridElements , common . GridElement { "dash-newusers" , strconv . Itoa ( newUserCount ) + " new users / " + newUserInterval , 10 , "grid_stat" , "" , "" , "The number of new users over the last 7 days" } )
gridElements = append ( gridElements , common . GridElement { "dash-reports" , strconv . Itoa ( reportCount ) + " reports / " + reportInterval , 11 , "grid_stat" , "" , "" , "The number of reports over the last 7 days" } )
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
gridElements = append ( gridElements , common . GridElement { "dash-minperuser" , "2 minutes / user / week" , 12 , "grid_stat stat_disabled" , "" , "" , "Coming Soon!" /*"The average number of number of minutes spent by each active user over the last 7 days"*/ } )
gridElements = append ( gridElements , common . GridElement { "dash-visitorsperweek" , "2 visitors / week" , 13 , "grid_stat stat_disabled" , "" , "" , "Coming Soon!" /*"The number of unique visitors we've had over the last 7 days"*/ } )
gridElements = append ( gridElements , common . GridElement { "dash-postsperuser" , "5 posts / user / week" , 14 , "grid_stat stat_disabled" , "" , "" , "Coming Soon!" /*"The average number of posts made by each active user over the past week"*/ } )
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pi := common . PanelDashboardPage { "Control Panel Dashboard" , user , headerVars , stats , gridElements }
if common . PreRenderHooks [ "pre_render_panel_dashboard" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_dashboard" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "panel-dashboard.html" , pi )
2017-07-17 10:23:42 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-07-17 10:23:42 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelForums ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManageForums {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-23 19:57:13 +00:00
// TODO: Paginate this?
2017-04-05 14:15:22 +00:00
var forumList [ ] interface { }
2017-11-11 04:06:16 +00:00
forums , err := common . Fstore . GetAll ( )
2017-06-28 12:05:26 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-06-28 12:05:26 +00:00
}
2017-09-23 19:57:13 +00:00
// ? - Should we generate something similar to the forumView? It might be a little overkill for a page which is rarely loaded in comparison to /forums/
2017-04-05 14:15:22 +00:00
for _ , forum := range forums {
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if forum . Name != "" && forum . ParentID == 0 {
2017-11-11 04:06:16 +00:00
fadmin := common . ForumAdmin { forum . ID , forum . Name , forum . Desc , forum . Active , forum . Preset , forum . TopicCount , common . PresetToLang ( forum . Preset ) }
2017-05-29 14:52:37 +00:00
if fadmin . Preset == "" {
fadmin . Preset = "custom"
}
2017-09-03 04:50:31 +00:00
forumList = append ( forumList , fadmin )
2017-04-05 14:15:22 +00:00
}
}
2017-11-11 04:06:16 +00:00
pi := common . PanelPage { "Forum Manager" , user , headerVars , stats , forumList , nil }
if common . PreRenderHooks [ "pre_render_panel_forums" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_forums" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "panel-forums.html" , pi )
2017-05-29 14:52:37 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-05-29 14:52:37 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelForumsCreateSubmit ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManageForums {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
fname := r . PostFormValue ( "forum-name" )
2017-06-05 11:57:27 +00:00
fdesc := r . PostFormValue ( "forum-desc" )
2017-11-11 04:06:16 +00:00
fpreset := common . StripInvalidPreset ( r . PostFormValue ( "forum-preset" ) )
2017-04-05 14:15:22 +00:00
factive := r . PostFormValue ( "forum-name" )
2017-09-03 04:50:31 +00:00
active := ( factive == "on" || factive == "1" )
2017-05-29 14:52:37 +00:00
2017-11-11 23:34:27 +00:00
_ , err := common . Fstore . Create ( fname , fdesc , active , fpreset )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/forums/" , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-09-10 16:57:22 +00:00
// TODO: Revamp this
2017-11-11 04:06:16 +00:00
func routePanelForumsDelete ( w http . ResponseWriter , r * http . Request , user common . User , sfid string ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManageForums {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-13 10:55:51 +00:00
fid , err := strconv . Atoi ( sfid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The provided Forum ID is not a valid number." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
forum , err := common . Fstore . Get ( fid )
2017-06-28 12:05:26 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The forum you're trying to delete doesn't exist." , w , r , user )
2017-06-28 12:05:26 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-10 16:57:22 +00:00
confirmMsg := "Are you sure you want to delete the '" + forum . Name + "' forum?"
2017-11-11 04:06:16 +00:00
yousure := common . AreYouSure { "/panel/forums/delete/submit/" + strconv . Itoa ( fid ) , confirmMsg }
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pi := common . PanelPage { "Delete Forum" , user , headerVars , stats , tList , yousure }
if common . PreRenderHooks [ "pre_render_panel_delete_forum" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_delete_forum" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "areyousure.html" , pi )
2017-08-13 11:22:34 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-08-13 11:22:34 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelForumsDeleteSubmit ( w http . ResponseWriter , r * http . Request , user common . User , sfid string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManageForums {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-13 10:55:51 +00:00
fid , err := strconv . Atoi ( sfid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The provided Forum ID is not a valid number." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
err = common . Fstore . Delete ( fid )
2017-07-12 11:05:18 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The forum you're trying to delete doesn't exist." , w , r , user )
2017-07-12 11:05:18 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-07-17 10:23:42 +00:00
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/forums/" , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelForumsEdit ( w http . ResponseWriter , r * http . Request , user common . User , sfid string ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManageForums {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-13 10:55:51 +00:00
fid , err := strconv . Atoi ( sfid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The provided Forum ID is not a valid number." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-06-28 12:05:26 +00:00
2017-11-11 04:06:16 +00:00
forum , err := common . Fstore . Get ( fid )
2017-06-28 12:05:26 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The forum you're trying to edit doesn't exist." , w , r , user )
2017-06-28 12:05:26 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-06-05 11:57:27 +00:00
if forum . Preset == "" {
forum . Preset = "custom"
}
2017-11-11 04:06:16 +00:00
glist , err := common . Gstore . GetAll ( )
2017-09-15 22:20:01 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-09-15 22:20:01 +00:00
}
2017-11-11 04:06:16 +00:00
var gplist [ ] common . GroupForumPermPreset
2017-06-05 11:57:27 +00:00
for gid , group := range glist {
if gid == 0 {
continue
}
2017-11-11 04:06:16 +00:00
gplist = append ( gplist , common . GroupForumPermPreset { group , common . ForumPermsToGroupForumPreset ( group . Forums [ fid ] ) } )
2017-06-05 11:57:27 +00:00
}
2017-11-11 04:06:16 +00:00
pi := common . PanelEditForumPage { "Forum Editor" , user , headerVars , stats , forum . ID , forum . Name , forum . Desc , forum . Active , forum . Preset , gplist }
if common . PreRenderHooks [ "pre_render_panel_edit_forum" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_edit_forum" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "panel-forum-edit.html" , pi )
2017-06-05 11:57:27 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-06-05 11:57:27 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelForumsEditSubmit ( w http . ResponseWriter , r * http . Request , user common . User , sfid string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManageForums {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-09-03 04:50:31 +00:00
isJs := ( r . PostFormValue ( "js" ) == "1" )
2017-05-29 14:52:37 +00:00
2017-04-13 10:55:51 +00:00
fid , err := strconv . Atoi ( sfid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalErrorJSQ ( "The provided Forum ID is not a valid number." , w , r , user , isJs )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
forum , err := common . Fstore . Get ( fid )
2017-06-28 12:05:26 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalErrorJSQ ( "The forum you're trying to edit doesn't exist." , w , r , user , isJs )
2017-06-28 12:05:26 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalErrorJSQ ( err , w , r , isJs )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-25 00:48:35 +00:00
forumName := r . PostFormValue ( "forum_name" )
forumDesc := r . PostFormValue ( "forum_desc" )
2017-11-11 04:06:16 +00:00
forumPreset := common . StripInvalidPreset ( r . PostFormValue ( "forum_preset" ) )
2017-09-25 00:48:35 +00:00
forumActive := r . PostFormValue ( "forum_active" )
2017-05-29 14:52:37 +00:00
2017-09-25 00:48:35 +00:00
var active = false
2017-09-10 16:57:22 +00:00
if forumActive == "" {
2017-06-28 12:05:26 +00:00
active = forum . Active
2017-09-10 16:57:22 +00:00
} else if forumActive == "1" || forumActive == "Show" {
2017-04-05 14:15:22 +00:00
active = true
}
2017-05-29 14:52:37 +00:00
2017-09-25 00:48:35 +00:00
err = forum . Update ( forumName , forumDesc , active , forumPreset )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalErrorJSQ ( err , w , r , isJs )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if ! isJs {
http . Redirect ( w , r , "/panel/forums/" , http . StatusSeeOther )
2017-04-05 14:15:22 +00:00
} else {
2017-09-03 04:50:31 +00:00
w . Write ( successJSONBytes )
2017-04-05 14:15:22 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelForumsEditPermsSubmit ( w http . ResponseWriter , r * http . Request , user common . User , sfid string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-06-05 11:57:27 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManageForums {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-06-05 11:57:27 +00:00
}
2017-09-03 04:50:31 +00:00
isJs := ( r . PostFormValue ( "js" ) == "1" )
2017-06-05 11:57:27 +00:00
fid , err := strconv . Atoi ( sfid )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalErrorJSQ ( "The provided Forum ID is not a valid number." , w , r , user , isJs )
2017-06-05 11:57:27 +00:00
}
2017-06-06 08:47:33 +00:00
gid , err := strconv . Atoi ( r . PostFormValue ( "gid" ) )
2017-06-05 11:57:27 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalErrorJSQ ( "Invalid Group ID" , w , r , user , isJs )
2017-06-05 11:57:27 +00:00
}
2017-11-11 04:06:16 +00:00
forum , err := common . Fstore . Get ( fid )
2017-06-28 12:05:26 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalErrorJSQ ( "This forum doesn't exist" , w , r , user , isJs )
2017-06-28 12:05:26 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalErrorJSQ ( err , w , r , isJs )
2017-06-28 12:05:26 +00:00
}
2017-11-13 05:22:37 +00:00
permPreset := common . StripInvalidGroupForumPreset ( r . PostFormValue ( "perm_preset" ) )
err = forum . SetPreset ( permPreset , gid )
if err != nil {
return common . LocalErrorJSQ ( err . Error ( ) , w , r , user , isJs )
2017-06-05 11:57:27 +00:00
}
2017-09-03 04:50:31 +00:00
if ! isJs {
http . Redirect ( w , r , "/panel/forums/edit/" + strconv . Itoa ( fid ) , http . StatusSeeOther )
2017-06-05 11:57:27 +00:00
} else {
2017-09-03 04:50:31 +00:00
w . Write ( successJSONBytes )
2017-06-05 11:57:27 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-06-05 11:57:27 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelSettings ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . EditSettings {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-10 16:57:22 +00:00
var settingList = make ( map [ string ] interface { } )
2017-11-05 09:55:34 +00:00
rows , err := stmts . getSettings . Query ( )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
defer rows . Close ( )
2017-05-29 14:52:37 +00:00
2017-09-10 16:57:22 +00:00
// nolint need the type so people viewing this file understand what it returns without visiting setting.go
2017-11-11 04:06:16 +00:00
var settingLabels map [ string ] string = common . GetAllSettingLabels ( )
2017-04-13 15:01:30 +00:00
var sname , scontent , stype string
2017-04-05 14:15:22 +00:00
for rows . Next ( ) {
2017-09-03 04:50:31 +00:00
err := rows . Scan ( & sname , & scontent , & stype )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
if stype == "list" {
llist := settingLabels [ sname ]
2017-09-03 04:50:31 +00:00
labels := strings . Split ( llist , "," )
2017-04-05 14:15:22 +00:00
conv , err := strconv . Atoi ( scontent )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The setting '" + sname + "' can't be converted to an integer" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-09-03 04:50:31 +00:00
scontent = labels [ conv - 1 ]
2017-04-05 14:15:22 +00:00
} else if stype == "bool" {
if scontent == "1" {
scontent = "Yes"
} else {
scontent = "No"
}
}
settingList [ sname ] = scontent
}
err = rows . Err ( )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pi := common . PanelPage { "Setting Manager" , user , headerVars , stats , tList , settingList }
if common . PreRenderHooks [ "pre_render_panel_settings" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_settings" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "panel-settings.html" , pi )
2017-08-13 11:22:34 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-08-13 11:22:34 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelSetting ( w http . ResponseWriter , r * http . Request , user common . User , sname string ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . EditSettings {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-13 09:23:43 +00:00
setting , err := headerVars . Settings . BypassGet ( sname )
2017-06-28 12:05:26 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The setting you want to edit doesn't exist." , w , r , user )
2017-04-05 14:15:22 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
var itemList [ ] interface { }
if setting . Type == "list" {
2017-11-11 04:06:16 +00:00
llist := common . GetSettingLabel ( setting . Name )
2017-04-05 14:15:22 +00:00
conv , err := strconv . Atoi ( setting . Content )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The value of this setting couldn't be converted to an integer" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-13 09:23:43 +00:00
for index , label := range strings . Split ( llist , "," ) {
2017-11-11 04:06:16 +00:00
itemList = append ( itemList , common . OptionLabel {
2017-09-03 04:50:31 +00:00
Label : label ,
Value : index + 1 ,
2017-04-05 14:15:22 +00:00
Selected : conv == ( index + 1 ) ,
} )
}
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pi := common . PanelPage { "Edit Setting" , user , headerVars , stats , itemList , setting }
if common . PreRenderHooks [ "pre_render_panel_setting" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_setting" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "panel-setting.html" , pi )
2017-08-13 11:22:34 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-08-13 11:22:34 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelSettingEdit ( w http . ResponseWriter , r * http . Request , user common . User , sname string ) common . RouteError {
headerLite , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . EditSettings {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
scontent := r . PostFormValue ( "setting-value" )
2017-11-13 09:23:43 +00:00
setting , err := headerLite . Settings . BypassGet ( sname )
2017-06-28 12:05:26 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The setting you want to edit doesn't exist." , w , r , user )
2017-04-05 14:15:22 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-13 09:23:43 +00:00
if setting . Type == "bool" {
2017-04-05 14:15:22 +00:00
if scontent == "on" || scontent == "1" {
scontent = "1"
} else {
scontent = "0"
}
}
2017-05-29 14:52:37 +00:00
2017-09-18 17:03:52 +00:00
// TODO: Make this a method or function?
2017-11-05 09:55:34 +00:00
_ , err = stmts . updateSetting . Exec ( scontent , sname )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-13 09:23:43 +00:00
errmsg := headerLite . Settings . ParseSetting ( sname , scontent , setting . Type , setting . Constraint )
2017-04-05 14:15:22 +00:00
if errmsg != "" {
2017-11-11 04:06:16 +00:00
return common . LocalError ( errmsg , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-11-13 09:23:43 +00:00
// TODO: Do a reload instead?
2017-11-11 04:06:16 +00:00
common . SettingBox . Store ( headerLite . Settings )
2017-08-20 09:39:02 +00:00
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/settings/" , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelWordFilters ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
2017-11-11 23:34:27 +00:00
return ferr
2017-08-27 09:33:45 +00:00
}
if ! user . Perms . EditSettings {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-08-27 09:33:45 +00:00
}
2017-11-11 04:06:16 +00:00
var filterList = common . WordFilterBox . Load ( ) . ( common . WordFilterMap )
pi := common . PanelPage { "Word Filter Manager" , user , headerVars , stats , tList , filterList }
if common . PreRenderHooks [ "pre_render_panel_word_filters" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_word_filters" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
2017-08-27 09:33:45 +00:00
}
}
2017-11-11 04:06:16 +00:00
err := common . Templates . ExecuteTemplate ( w , "panel-word-filters.html" , pi )
2017-08-27 09:33:45 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-08-27 09:33:45 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-08-27 09:33:45 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelWordFiltersCreate ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-08-27 09:33:45 +00:00
}
if ! user . Perms . EditSettings {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-08-27 09:33:45 +00:00
}
2017-09-03 04:50:31 +00:00
isJs := ( r . PostFormValue ( "js" ) == "1" )
2017-08-27 09:33:45 +00:00
find := strings . TrimSpace ( r . PostFormValue ( "find" ) )
if find == "" {
2017-11-11 04:06:16 +00:00
return common . LocalErrorJSQ ( "You need to specify what word you want to match" , w , r , user , isJs )
2017-08-27 09:33:45 +00:00
}
// Unlike with find, it's okay if we leave this blank, as this means that the admin wants to remove the word entirely with no replacement
replacement := strings . TrimSpace ( r . PostFormValue ( "replacement" ) )
2017-11-05 09:55:34 +00:00
res , err := stmts . createWordFilter . Exec ( find , replacement )
2017-08-27 09:33:45 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalErrorJSQ ( err , w , r , isJs )
2017-08-27 09:33:45 +00:00
}
2017-09-10 16:57:22 +00:00
lastID , err := res . LastInsertId ( )
2017-08-27 09:33:45 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalErrorJSQ ( err , w , r , isJs )
2017-08-27 09:33:45 +00:00
}
2017-11-11 04:06:16 +00:00
common . AddWordFilter ( int ( lastID ) , find , replacement )
2017-11-13 09:23:43 +00:00
2017-10-30 09:57:08 +00:00
if ! isJs {
http . Redirect ( w , r , "/panel/settings/word-filters/" , http . StatusSeeOther )
} else {
w . Write ( successJSONBytes )
}
return nil
2017-08-27 09:33:45 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelWordFiltersEdit ( w http . ResponseWriter , r * http . Request , user common . User , wfid string ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-08-27 09:33:45 +00:00
}
if ! user . Perms . EditSettings {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-08-27 09:33:45 +00:00
}
_ = wfid
2017-11-11 04:06:16 +00:00
pi := common . PanelPage { "Edit Word Filter" , user , headerVars , stats , tList , nil }
if common . PreRenderHooks [ "pre_render_panel_word_filters_edit" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_word_filters_edit" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
2017-08-27 09:33:45 +00:00
}
}
2017-11-11 04:06:16 +00:00
err := common . Templates . ExecuteTemplate ( w , "panel-word-filters-edit.html" , pi )
2017-08-27 09:33:45 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-08-27 09:33:45 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-08-27 09:33:45 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelWordFiltersEditSubmit ( w http . ResponseWriter , r * http . Request , user common . User , wfid string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-08-27 09:33:45 +00:00
}
2017-09-10 16:57:22 +00:00
// TODO: Either call it isJs or js rather than flip-flopping back and forth across the routes x.x
2017-09-03 04:50:31 +00:00
isJs := ( r . PostFormValue ( "isJs" ) == "1" )
2017-08-27 09:33:45 +00:00
if ! user . Perms . EditSettings {
2017-11-11 04:06:16 +00:00
return common . NoPermissionsJSQ ( w , r , user , isJs )
2017-08-27 09:33:45 +00:00
}
id , err := strconv . Atoi ( wfid )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalErrorJSQ ( "The word filter ID must be an integer." , w , r , user , isJs )
2017-08-27 09:33:45 +00:00
}
find := strings . TrimSpace ( r . PostFormValue ( "find" ) )
if find == "" {
2017-11-11 04:06:16 +00:00
return common . LocalErrorJSQ ( "You need to specify what word you want to match" , w , r , user , isJs )
2017-08-27 09:33:45 +00:00
}
// Unlike with find, it's okay if we leave this blank, as this means that the admin wants to remove the word entirely with no replacement
replacement := strings . TrimSpace ( r . PostFormValue ( "replacement" ) )
2017-11-05 09:55:34 +00:00
_ , err = stmts . updateWordFilter . Exec ( find , replacement , id )
2017-08-27 09:33:45 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalErrorJSQ ( err , w , r , isJs )
2017-08-27 09:33:45 +00:00
}
2017-11-11 04:06:16 +00:00
wordFilters := common . WordFilterBox . Load ( ) . ( common . WordFilterMap )
wordFilters [ id ] = common . WordFilter { ID : id , Find : find , Replacement : replacement }
common . WordFilterBox . Store ( wordFilters )
2017-08-27 09:33:45 +00:00
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/settings/word-filters/" , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-08-27 09:33:45 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelWordFiltersDeleteSubmit ( w http . ResponseWriter , r * http . Request , user common . User , wfid string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-08-27 09:33:45 +00:00
}
2017-09-03 04:50:31 +00:00
isJs := ( r . PostFormValue ( "isJs" ) == "1" )
2017-08-27 09:33:45 +00:00
if ! user . Perms . EditSettings {
2017-11-11 04:06:16 +00:00
return common . NoPermissionsJSQ ( w , r , user , isJs )
2017-08-27 09:33:45 +00:00
}
id , err := strconv . Atoi ( wfid )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalErrorJSQ ( "The word filter ID must be an integer." , w , r , user , isJs )
2017-08-27 09:33:45 +00:00
}
2017-11-05 09:55:34 +00:00
_ , err = stmts . deleteWordFilter . Exec ( id )
2017-08-27 09:33:45 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalErrorJSQ ( err , w , r , isJs )
2017-08-27 09:33:45 +00:00
}
2017-11-11 04:06:16 +00:00
wordFilters := common . WordFilterBox . Load ( ) . ( common . WordFilterMap )
2017-09-03 04:50:31 +00:00
delete ( wordFilters , id )
2017-11-11 04:06:16 +00:00
common . WordFilterBox . Store ( wordFilters )
2017-08-27 09:33:45 +00:00
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/settings/word-filters/" , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-08-27 09:33:45 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelPlugins ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManagePlugins {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
var pluginList [ ] interface { }
2017-11-11 04:06:16 +00:00
for _ , plugin := range common . Plugins {
2017-09-03 04:50:31 +00:00
pluginList = append ( pluginList , plugin )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pi := common . PanelPage { "Plugin Manager" , user , headerVars , stats , pluginList , nil }
if common . PreRenderHooks [ "pre_render_panel_plugins" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_plugins" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err := common . Templates . ExecuteTemplate ( w , "panel-plugins.html" , pi )
2017-08-13 11:22:34 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-08-13 11:22:34 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelPluginsActivate ( w http . ResponseWriter , r * http . Request , user common . User , uname string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManagePlugins {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
plugin , ok := common . Plugins [ uname ]
2017-04-05 14:15:22 +00:00
if ! ok {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The plugin isn't registered in the system" , w , r , user )
2017-04-05 14:15:22 +00:00
}
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if plugin . Installable && ! plugin . Installed {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You can't activate this plugin without installing it first" , w , r , user )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
2017-04-05 14:15:22 +00:00
var active bool
2017-11-05 09:55:34 +00:00
err := stmts . isPluginActive . QueryRow ( uname ) . Scan ( & active )
2017-06-28 12:05:26 +00:00
if err != nil && err != ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-09-10 16:57:22 +00:00
var hasPlugin = ( err == nil )
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
if common . Plugins [ uname ] . Activate != nil {
err = common . Plugins [ uname ] . Activate ( )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( err . Error ( ) , w , r , user )
2017-04-05 14:15:22 +00:00
}
}
2017-05-29 14:52:37 +00:00
2017-09-10 16:57:22 +00:00
if hasPlugin {
2017-04-05 14:15:22 +00:00
if active {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The plugin is already active" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-11-05 09:55:34 +00:00
_ , err = stmts . updatePlugin . Exec ( 1 , uname )
2017-04-05 14:15:22 +00:00
} else {
2017-11-11 23:34:27 +00:00
_ , err = stmts . addPlugin . Exec ( uname , 1 , 0 )
}
if err != nil {
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 23:34:27 +00:00
log . Printf ( "Activating plugin '%s'" , plugin . Name )
2017-04-05 14:15:22 +00:00
plugin . Active = true
2017-11-11 04:06:16 +00:00
common . Plugins [ uname ] = plugin
err = common . Plugins [ uname ] . Init ( )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( err . Error ( ) , w , r , user )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/plugins/" , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelPluginsDeactivate ( w http . ResponseWriter , r * http . Request , user common . User , uname string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManagePlugins {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
plugin , ok := common . Plugins [ uname ]
2017-04-05 14:15:22 +00:00
if ! ok {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The plugin isn't registered in the system" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
var active bool
2017-11-05 09:55:34 +00:00
err := stmts . isPluginActive . QueryRow ( uname ) . Scan ( & active )
2017-06-28 12:05:26 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The plugin you're trying to deactivate isn't active" , w , r , user )
2017-04-05 14:15:22 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
if ! active {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The plugin you're trying to deactivate isn't active" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-11-05 09:55:34 +00:00
_ , err = stmts . updatePlugin . Exec ( 0 , uname )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
plugin . Active = false
2017-11-11 04:06:16 +00:00
common . Plugins [ uname ] = plugin
common . Plugins [ uname ] . Deactivate ( )
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/plugins/" , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelPluginsInstall ( w http . ResponseWriter , r * http . Request , user common . User , uname string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
if ! user . Perms . ManagePlugins {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
2017-11-11 04:06:16 +00:00
plugin , ok := common . Plugins [ uname ]
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if ! ok {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The plugin isn't registered in the system" , w , r , user )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
if ! plugin . Installable {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "This plugin is not installable" , w , r , user )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
if plugin . Installed {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "This plugin has already been installed" , w , r , user )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
var active bool
2017-11-05 09:55:34 +00:00
err := stmts . isPluginActive . QueryRow ( uname ) . Scan ( & active )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if err != nil && err != ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
2017-09-10 16:57:22 +00:00
var hasPlugin = ( err == nil )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
2017-11-11 04:06:16 +00:00
if common . Plugins [ uname ] . Install != nil {
err = common . Plugins [ uname ] . Install ( )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( err . Error ( ) , w , r , user )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
if common . Plugins [ uname ] . Activate != nil {
err = common . Plugins [ uname ] . Activate ( )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( err . Error ( ) , w , r , user )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-09-10 16:57:22 +00:00
if hasPlugin {
2017-11-05 09:55:34 +00:00
_ , err = stmts . updatePluginInstall . Exec ( 1 , uname )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
2017-11-05 09:55:34 +00:00
_ , err = stmts . updatePlugin . Exec ( 1 , uname )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
} else {
2017-11-11 04:06:16 +00:00
_ , err = stmts . addPlugin . Exec ( uname , 1 , 1 )
}
if err != nil {
return common . InternalError ( err , w , r )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
2017-11-11 04:06:16 +00:00
log . Printf ( "Installing plugin '%s'" , plugin . Name )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
plugin . Active = true
plugin . Installed = true
2017-11-11 04:06:16 +00:00
common . Plugins [ uname ] = plugin
err = common . Plugins [ uname ] . Init ( )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( err . Error ( ) , w , r , user )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/plugins/" , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelUsers ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-08-17 11:13:49 +00:00
page , _ := strconv . Atoi ( r . FormValue ( "page" ) )
perPage := 10
2017-11-11 04:06:16 +00:00
offset , page , lastPage := common . PageOffset ( stats . Users , page , perPage )
2017-08-17 11:13:49 +00:00
2017-11-11 04:06:16 +00:00
var userList [ ] common . User
// TODO: Move this into the common.UserStore
2017-11-05 09:55:34 +00:00
rows , err := stmts . getUsersOffset . Query ( offset , perPage )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
defer rows . Close ( )
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
// TODO: Add a common.UserStore method for iterating over global users and global user offsets
2017-04-05 14:15:22 +00:00
for rows . Next ( ) {
2017-11-11 04:06:16 +00:00
puser := & common . User { ID : 0 }
2017-09-03 04:50:31 +00:00
err := rows . Scan ( & puser . ID , & puser . Name , & puser . Group , & puser . Active , & puser . IsSuperAdmin , & puser . Avatar )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
puser . InitPerms ( )
2017-04-05 14:15:22 +00:00
if puser . Avatar != "" {
if puser . Avatar [ 0 ] == '.' {
puser . Avatar = "/uploads/avatar_" + strconv . Itoa ( puser . ID ) + puser . Avatar
}
} else {
2017-11-11 04:06:16 +00:00
puser . Avatar = strings . Replace ( common . Config . Noavatar , "{id}" , strconv . Itoa ( puser . ID ) , 1 )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
if common . Gstore . DirtyGet ( puser . Group ) . Tag != "" {
puser . Tag = common . Gstore . DirtyGet ( puser . Group ) . Tag
2017-04-05 14:15:22 +00:00
} else {
puser . Tag = ""
}
2017-09-22 02:21:17 +00:00
userList = append ( userList , * puser )
2017-04-05 14:15:22 +00:00
}
err = rows . Err ( )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pageList := common . Paginate ( stats . Users , perPage , 5 )
pi := common . PanelUserPage { "User Manager" , user , headerVars , stats , userList , pageList , page , lastPage }
if common . PreRenderHooks [ "pre_render_panel_users" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_users" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "panel-users.html" , pi )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelUsersEdit ( w http . ResponseWriter , r * http . Request , user common . User , suid string ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . EditUser {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-13 15:01:30 +00:00
uid , err := strconv . Atoi ( suid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The provided common.User ID is not a valid number." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
targetUser , err := common . Users . Get ( uid )
2017-06-28 12:05:26 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The user you're trying to edit doesn't exist." , w , r , user )
2017-04-05 14:15:22 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if targetUser . IsAdmin && ! user . IsAdmin {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "Only administrators can edit the account of an administrator." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-10-30 09:57:08 +00:00
// ? - Should we stop admins from deleting all the groups? Maybe, protect the group they're currently using?
2017-11-11 04:06:16 +00:00
groups , err := common . Gstore . GetRange ( 1 , 0 ) // ? - 0 = Go to the end
2017-09-15 22:20:01 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-09-15 22:20:01 +00:00
}
2017-04-05 14:15:22 +00:00
var groupList [ ] interface { }
for _ , group := range groups [ 1 : ] {
2017-09-03 04:50:31 +00:00
if ! user . Perms . EditUserGroupAdmin && group . IsAdmin {
2017-04-05 14:15:22 +00:00
continue
}
2017-09-03 04:50:31 +00:00
if ! user . Perms . EditUserGroupSuperMod && group . IsMod {
2017-04-05 14:15:22 +00:00
continue
}
2017-09-03 04:50:31 +00:00
groupList = append ( groupList , group )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pi := common . PanelPage { "User Editor" , user , headerVars , stats , groupList , targetUser }
if common . PreRenderHooks [ "pre_render_panel_edit_user" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_edit_user" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "panel-user-edit.html" , pi )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelUsersEditSubmit ( w http . ResponseWriter , r * http . Request , user common . User , suid string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . EditUser {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-13 15:01:30 +00:00
uid , err := strconv . Atoi ( suid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The provided common.User ID is not a valid number." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
targetUser , err := common . Users . Get ( uid )
2017-06-28 12:05:26 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The user you're trying to edit doesn't exist." , w , r , user )
2017-04-05 14:15:22 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if targetUser . IsAdmin && ! user . IsAdmin {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "Only administrators can edit the account of other administrators." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
newname := html . EscapeString ( r . PostFormValue ( "user-name" ) )
if newname == "" {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You didn't put in a username." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
newemail := html . EscapeString ( r . PostFormValue ( "user-email" ) )
if newemail == "" {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You didn't put in an email address." , w , r , user )
2017-04-05 14:15:22 +00:00
}
if ( newemail != targetUser . Email ) && ! user . Perms . EditUserEmail {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditUserEmail permission to edit the email address of a user." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
newpassword := r . PostFormValue ( "user-password" )
if newpassword != "" && ! user . Perms . EditUserPassword {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditUserPassword permission to edit the password of a user." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
newgroup , err := strconv . Atoi ( r . PostFormValue ( "user-group" ) )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need to provide a whole number for the group ID" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
group , err := common . Gstore . Get ( newgroup )
2017-09-15 22:20:01 +00:00
if err == ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The group you're trying to place this user in doesn't exist." , w , r , user )
2017-09-15 22:20:01 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-15 22:20:01 +00:00
if ! user . Perms . EditUserGroupAdmin && group . IsAdmin {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditUserGroupAdmin permission to assign someone to an administrator group." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-09-15 22:20:01 +00:00
if ! user . Perms . EditUserGroupSuperMod && group . IsMod {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditUserGroupSuperMod permission to assign someone to a super mod group." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-05 09:55:34 +00:00
_ , err = stmts . updateUser . Exec ( newname , newemail , newgroup , targetUser . ID )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
if newpassword != "" {
2017-11-11 04:06:16 +00:00
common . SetPassword ( targetUser . ID , newpassword )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
targetUser . CacheRemove ( )
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/users/edit/" + strconv . Itoa ( targetUser . ID ) , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelGroups ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-08-15 13:47:56 +00:00
page , _ := strconv . Atoi ( r . FormValue ( "page" ) )
perPage := 9
2017-11-11 04:06:16 +00:00
offset , page , lastPage := common . PageOffset ( stats . Groups , page , perPage )
2017-08-15 13:47:56 +00:00
2017-10-21 00:27:47 +00:00
// Skip the 'Unknown' group
2017-08-15 13:47:56 +00:00
offset ++
var count int
2017-11-11 04:06:16 +00:00
var groupList [ ] common . GroupAdmin
groups , _ := common . Gstore . GetRange ( offset , 0 )
2017-09-15 22:20:01 +00:00
for _ , group := range groups {
2017-08-15 13:47:56 +00:00
if count == perPage {
break
}
2017-04-05 14:15:22 +00:00
var rank string
2017-09-03 04:50:31 +00:00
var rankClass string
var canEdit bool
var canDelete = false
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if group . IsAdmin {
2017-04-05 14:15:22 +00:00
rank = "Admin"
2017-09-03 04:50:31 +00:00
rankClass = "admin"
} else if group . IsMod {
2017-04-05 14:15:22 +00:00
rank = "Mod"
2017-09-03 04:50:31 +00:00
rankClass = "mod"
} else if group . IsBanned {
2017-04-05 14:15:22 +00:00
rank = "Banned"
2017-09-03 04:50:31 +00:00
rankClass = "banned"
2017-04-05 14:15:22 +00:00
} else if group . ID == 6 {
rank = "Guest"
2017-09-03 04:50:31 +00:00
rankClass = "guest"
2017-04-05 14:15:22 +00:00
} else {
rank = "Member"
2017-09-03 04:50:31 +00:00
rankClass = "member"
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
canEdit = user . Perms . EditGroup && ( ! group . IsAdmin || user . Perms . EditGroupAdmin ) && ( ! group . IsMod || user . Perms . EditGroupSuperMod )
2017-11-11 04:06:16 +00:00
groupList = append ( groupList , common . GroupAdmin { group . ID , group . Name , rank , rankClass , canEdit , canDelete } )
2017-08-15 13:47:56 +00:00
count ++
2017-04-05 14:15:22 +00:00
}
2017-08-13 11:22:34 +00:00
//log.Printf("groupList: %+v\n", groupList)
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pageList := common . Paginate ( stats . Groups , perPage , 5 )
pi := common . PanelGroupPage { "Group Manager" , user , headerVars , stats , groupList , pageList , page , lastPage }
if common . PreRenderHooks [ "pre_render_panel_groups" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_groups" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-08-13 11:22:34 +00:00
2017-11-11 04:06:16 +00:00
err := common . Templates . ExecuteTemplate ( w , "panel-groups.html" , pi )
2017-08-13 11:22:34 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-08-13 11:22:34 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelGroupsEdit ( w http . ResponseWriter , r * http . Request , user common . User , sgid string ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . EditGroup {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-13 15:01:30 +00:00
gid , err := strconv . Atoi ( sgid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need to provide a whole number for the group ID" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
group , err := common . Gstore . Get ( gid )
2017-09-15 22:20:01 +00:00
if err == ErrNoRows {
2017-08-13 11:22:34 +00:00
//log.Print("aaaaa monsters")
2017-11-11 04:06:16 +00:00
return common . NotFound ( w , r )
2017-09-15 22:20:01 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if group . IsAdmin && ! user . Perms . EditGroupAdmin {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupAdmin permission to edit an admin group." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-09-03 04:50:31 +00:00
if group . IsMod && ! user . Perms . EditGroupSuperMod {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupSuperMod permission to edit a super-mod group." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
var rank string
2017-10-21 00:27:47 +00:00
switch {
case group . IsAdmin :
2017-04-05 14:15:22 +00:00
rank = "Admin"
2017-10-21 00:27:47 +00:00
case group . IsMod :
2017-04-05 14:15:22 +00:00
rank = "Mod"
2017-10-21 00:27:47 +00:00
case group . IsBanned :
2017-04-05 14:15:22 +00:00
rank = "Banned"
2017-10-21 00:27:47 +00:00
case group . ID == 6 :
2017-04-05 14:15:22 +00:00
rank = "Guest"
2017-10-21 00:27:47 +00:00
default :
2017-04-05 14:15:22 +00:00
rank = "Member"
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
disableRank := ! user . Perms . EditGroupGlobalPerms || ( group . ID == 6 )
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pi := common . PanelEditGroupPage { "Group Editor" , user , headerVars , stats , group . ID , group . Name , group . Tag , rank , disableRank }
if common . PreRenderHooks [ "pre_render_panel_edit_group" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_edit_group" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "panel-group-edit.html" , pi )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelGroupsEditPerms ( w http . ResponseWriter , r * http . Request , user common . User , sgid string ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . EditGroup {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-13 15:01:30 +00:00
gid , err := strconv . Atoi ( sgid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The Group ID is not a valid integer." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
group , err := common . Gstore . Get ( gid )
2017-09-15 22:20:01 +00:00
if err == ErrNoRows {
2017-08-13 11:22:34 +00:00
//log.Print("aaaaa monsters")
2017-11-11 04:06:16 +00:00
return common . NotFound ( w , r )
2017-09-15 22:20:01 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if group . IsAdmin && ! user . Perms . EditGroupAdmin {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupAdmin permission to edit an admin group." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-09-03 04:50:31 +00:00
if group . IsMod && ! user . Perms . EditGroupSuperMod {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupSuperMod permission to edit a super-mod group." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-10 16:57:22 +00:00
// TODO: Load the phrases in bulk for efficiency?
2017-11-11 04:06:16 +00:00
var localPerms [ ] common . NameLangToggle
localPerms = append ( localPerms , common . NameLangToggle { "ViewTopic" , common . GetLocalPermPhrase ( "ViewTopic" ) , group . Perms . ViewTopic } )
localPerms = append ( localPerms , common . NameLangToggle { "LikeItem" , common . GetLocalPermPhrase ( "LikeItem" ) , group . Perms . LikeItem } )
localPerms = append ( localPerms , common . NameLangToggle { "CreateTopic" , common . GetLocalPermPhrase ( "CreateTopic" ) , group . Perms . CreateTopic } )
2017-04-05 14:15:22 +00:00
//<--
2017-11-11 04:06:16 +00:00
localPerms = append ( localPerms , common . NameLangToggle { "EditTopic" , common . GetLocalPermPhrase ( "EditTopic" ) , group . Perms . EditTopic } )
localPerms = append ( localPerms , common . NameLangToggle { "DeleteTopic" , common . GetLocalPermPhrase ( "DeleteTopic" ) , group . Perms . DeleteTopic } )
localPerms = append ( localPerms , common . NameLangToggle { "CreateReply" , common . GetLocalPermPhrase ( "CreateReply" ) , group . Perms . CreateReply } )
localPerms = append ( localPerms , common . NameLangToggle { "EditReply" , common . GetLocalPermPhrase ( "EditReply" ) , group . Perms . EditReply } )
localPerms = append ( localPerms , common . NameLangToggle { "DeleteReply" , common . GetLocalPermPhrase ( "DeleteReply" ) , group . Perms . DeleteReply } )
localPerms = append ( localPerms , common . NameLangToggle { "PinTopic" , common . GetLocalPermPhrase ( "PinTopic" ) , group . Perms . PinTopic } )
localPerms = append ( localPerms , common . NameLangToggle { "CloseTopic" , common . GetLocalPermPhrase ( "CloseTopic" ) , group . Perms . CloseTopic } )
var globalPerms [ ] common . NameLangToggle
globalPerms = append ( globalPerms , common . NameLangToggle { "BanUsers" , common . GetGlobalPermPhrase ( "BanUsers" ) , group . Perms . BanUsers } )
globalPerms = append ( globalPerms , common . NameLangToggle { "ActivateUsers" , common . GetGlobalPermPhrase ( "ActivateUsers" ) , group . Perms . ActivateUsers } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditUser" , common . GetGlobalPermPhrase ( "EditUser" ) , group . Perms . EditUser } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditUserEmail" , common . GetGlobalPermPhrase ( "EditUserEmail" ) , group . Perms . EditUserEmail } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditUserPassword" , common . GetGlobalPermPhrase ( "EditUserPassword" ) , group . Perms . EditUserPassword } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditUserGroup" , common . GetGlobalPermPhrase ( "EditUserGroup" ) , group . Perms . EditUserGroup } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditUserGroupSuperMod" , common . GetGlobalPermPhrase ( "EditUserGroupSuperMod" ) , group . Perms . EditUserGroupSuperMod } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditUserGroupAdmin" , common . GetGlobalPermPhrase ( "EditUserGroupAdmin" ) , group . Perms . EditUserGroupAdmin } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditGroup" , common . GetGlobalPermPhrase ( "EditGroup" ) , group . Perms . EditGroup } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditGroupLocalPerms" , common . GetGlobalPermPhrase ( "EditGroupLocalPerms" ) , group . Perms . EditGroupLocalPerms } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditGroupGlobalPerms" , common . GetGlobalPermPhrase ( "EditGroupGlobalPerms" ) , group . Perms . EditGroupGlobalPerms } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditGroupSuperMod" , common . GetGlobalPermPhrase ( "EditGroupSuperMod" ) , group . Perms . EditGroupSuperMod } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditGroupAdmin" , common . GetGlobalPermPhrase ( "EditGroupAdmin" ) , group . Perms . EditGroupAdmin } )
globalPerms = append ( globalPerms , common . NameLangToggle { "ManageForums" , common . GetGlobalPermPhrase ( "ManageForums" ) , group . Perms . ManageForums } )
globalPerms = append ( globalPerms , common . NameLangToggle { "EditSettings" , common . GetGlobalPermPhrase ( "EditSettings" ) , group . Perms . EditSettings } )
globalPerms = append ( globalPerms , common . NameLangToggle { "ManageThemes" , common . GetGlobalPermPhrase ( "ManageThemes" ) , group . Perms . ManageThemes } )
globalPerms = append ( globalPerms , common . NameLangToggle { "ManagePlugins" , common . GetGlobalPermPhrase ( "ManagePlugins" ) , group . Perms . ManagePlugins } )
globalPerms = append ( globalPerms , common . NameLangToggle { "ViewAdminLogs" , common . GetGlobalPermPhrase ( "ViewAdminLogs" ) , group . Perms . ViewAdminLogs } )
globalPerms = append ( globalPerms , common . NameLangToggle { "ViewIPs" , common . GetGlobalPermPhrase ( "ViewIPs" ) , group . Perms . ViewIPs } )
globalPerms = append ( globalPerms , common . NameLangToggle { "UploadFiles" , common . GetGlobalPermPhrase ( "UploadFiles" ) , group . Perms . UploadFiles } )
pi := common . PanelEditGroupPermsPage { "Group Editor" , user , headerVars , stats , group . ID , group . Name , localPerms , globalPerms }
if common . PreRenderHooks [ "pre_render_panel_edit_group_perms" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_edit_group_perms" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "panel-group-edit-perms.html" , pi )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelGroupsEditSubmit ( w http . ResponseWriter , r * http . Request , user common . User , sgid string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . EditGroup {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-13 15:01:30 +00:00
gid , err := strconv . Atoi ( sgid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need to provide a whole number for the group ID" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
group , err := common . Gstore . Get ( gid )
2017-09-15 22:20:01 +00:00
if err == ErrNoRows {
2017-08-13 11:22:34 +00:00
//log.Print("aaaaa monsters")
2017-11-11 04:06:16 +00:00
return common . NotFound ( w , r )
2017-09-15 22:20:01 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if group . IsAdmin && ! user . Perms . EditGroupAdmin {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupAdmin permission to edit an admin group." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-09-03 04:50:31 +00:00
if group . IsMod && ! user . Perms . EditGroupSuperMod {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupSuperMod permission to edit a super-mod group." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
gname := r . FormValue ( "group-name" )
if gname == "" {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The group name can't be left blank." , w , r , user )
2017-04-05 14:15:22 +00:00
}
gtag := r . FormValue ( "group-tag" )
rank := r . FormValue ( "group-type" )
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
var originalRank string
if group . IsAdmin {
originalRank = "Admin"
} else if group . IsMod {
originalRank = "Mod"
} else if group . IsBanned {
originalRank = "Banned"
2017-04-05 14:15:22 +00:00
} else if group . ID == 6 {
2017-09-03 04:50:31 +00:00
originalRank = "Guest"
2017-04-05 14:15:22 +00:00
} else {
2017-09-03 04:50:31 +00:00
originalRank = "Member"
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if rank != originalRank {
2017-04-05 14:15:22 +00:00
if ! user . Perms . EditGroupGlobalPerms {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupGlobalPerms permission to change the group type." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
switch rank {
case "Admin" :
if ! user . Perms . EditGroupAdmin {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupAdmin permission to designate this group as an admin group." , w , r , user )
2017-09-03 04:50:31 +00:00
}
2017-10-21 00:27:47 +00:00
err = group . ChangeRank ( true , true , false )
2017-09-03 04:50:31 +00:00
case "Mod" :
if ! user . Perms . EditGroupSuperMod {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupSuperMod permission to designate this group as a super-mod group." , w , r , user )
2017-09-03 04:50:31 +00:00
}
2017-10-21 00:27:47 +00:00
err = group . ChangeRank ( false , true , false )
2017-09-03 04:50:31 +00:00
case "Banned" :
2017-10-21 00:27:47 +00:00
err = group . ChangeRank ( false , false , true )
2017-09-03 04:50:31 +00:00
case "Guest" :
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You can't designate a group as a guest group." , w , r , user )
2017-09-03 04:50:31 +00:00
case "Member" :
2017-10-21 00:27:47 +00:00
err = group . ChangeRank ( false , false , false )
2017-09-03 04:50:31 +00:00
default :
2017-11-11 04:06:16 +00:00
return common . LocalError ( "Invalid group type." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-10-21 00:27:47 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-10-21 00:27:47 +00:00
}
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-02 13:35:19 +00:00
// TODO: Move this to *Group
2017-11-05 09:55:34 +00:00
_ , err = stmts . updateGroup . Exec ( gname , gtag , gid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
common . Gstore . Reload ( gid )
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/groups/edit/" + strconv . Itoa ( gid ) , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelGroupsEditPermsSubmit ( w http . ResponseWriter , r * http . Request , user common . User , sgid string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . EditGroup {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-13 15:01:30 +00:00
gid , err := strconv . Atoi ( sgid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The Group ID is not a valid integer." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
group , err := common . Gstore . Get ( gid )
2017-09-15 22:20:01 +00:00
if err == ErrNoRows {
2017-08-13 11:22:34 +00:00
//log.Print("aaaaa monsters o.o")
2017-11-11 04:06:16 +00:00
return common . NotFound ( w , r )
2017-09-15 22:20:01 +00:00
} else if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
if group . IsAdmin && ! user . Perms . EditGroupAdmin {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupAdmin permission to edit an admin group." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-09-03 04:50:31 +00:00
if group . IsMod && ! user . Perms . EditGroupSuperMod {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupSuperMod permission to edit a super-mod group." , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
var pmap = make ( map [ string ] bool )
2017-04-05 14:15:22 +00:00
if user . Perms . EditGroupLocalPerms {
2017-11-11 04:06:16 +00:00
for _ , perm := range common . LocalPermList {
2017-04-05 14:15:22 +00:00
pvalue := r . PostFormValue ( "group-perm-" + perm )
2017-04-13 15:01:30 +00:00
pmap [ perm ] = ( pvalue == "1" )
2017-04-05 14:15:22 +00:00
}
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
if user . Perms . EditGroupGlobalPerms {
2017-11-11 04:06:16 +00:00
for _ , perm := range common . GlobalPermList {
2017-04-05 14:15:22 +00:00
pvalue := r . PostFormValue ( "group-perm-" + perm )
2017-04-13 15:01:30 +00:00
pmap [ perm ] = ( pvalue == "1" )
2017-04-05 14:15:22 +00:00
}
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
pjson , err := json . Marshal ( pmap )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "Unable to marshal the data" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-11-05 09:55:34 +00:00
_ , err = stmts . updateGroupPerms . Exec ( pjson , gid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
err = common . RebuildGroupPermissions ( gid )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/groups/edit/perms/" + strconv . Itoa ( gid ) , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelGroupsCreateSubmit ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . EditGroup {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
groupName := r . PostFormValue ( "group-name" )
if groupName == "" {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need a name for this group!" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-09-03 04:50:31 +00:00
groupTag := r . PostFormValue ( "group-tag" )
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
var isAdmin , isMod , isBanned bool
2017-04-05 14:15:22 +00:00
if user . Perms . EditGroupGlobalPerms {
2017-09-03 04:50:31 +00:00
groupType := r . PostFormValue ( "group-type" )
if groupType == "Admin" {
2017-04-05 14:15:22 +00:00
if ! user . Perms . EditGroupAdmin {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupAdmin permission to create admin groups" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-09-03 04:50:31 +00:00
isAdmin = true
isMod = true
} else if groupType == "Mod" {
2017-04-05 14:15:22 +00:00
if ! user . Perms . EditGroupSuperMod {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You need the EditGroupSuperMod permission to create admin groups" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-09-03 04:50:31 +00:00
isMod = true
} else if groupType == "Banned" {
isBanned = true
2017-04-05 14:15:22 +00:00
}
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
gid , err := common . Gstore . Create ( groupName , groupTag , isAdmin , isMod , isBanned )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/groups/edit/" + strconv . Itoa ( gid ) , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelThemes ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManageThemes {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
var pThemeList , vThemeList [ ] common . Theme
for _ , theme := range common . Themes {
2017-04-05 14:15:22 +00:00
if theme . HideFromThemes {
continue
}
if theme . ForkOf == "" {
2017-09-03 04:50:31 +00:00
pThemeList = append ( pThemeList , theme )
2017-04-05 14:15:22 +00:00
} else {
2017-09-03 04:50:31 +00:00
vThemeList = append ( vThemeList , theme )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pi := common . PanelThemesPage { "Theme Manager" , user , headerVars , stats , pThemeList , vThemeList }
if common . PreRenderHooks [ "pre_render_panel_themes" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_themes" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err := common . Templates . ExecuteTemplate ( w , "panel-themes.html" , pi )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelThemesSetDefault ( w http . ResponseWriter , r * http . Request , user common . User , uname string ) common . RouteError {
_ , ferr := common . SimplePanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-05 14:15:22 +00:00
}
2017-06-16 10:41:30 +00:00
if ! user . Perms . ManageThemes {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
theme , ok := common . Themes [ uname ]
2017-04-05 14:15:22 +00:00
if ! ok {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The theme isn't registered in the system" , w , r , user )
2017-04-05 14:15:22 +00:00
}
if theme . Disabled {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "You must not enable this theme" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-04-05 14:15:22 +00:00
var isDefault bool
2017-11-05 09:55:34 +00:00
err := stmts . isThemeDefault . QueryRow ( uname ) . Scan ( & isDefault )
2017-06-28 12:05:26 +00:00
if err != nil && err != ErrNoRows {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
hasTheme := err != ErrNoRows
if hasTheme {
2017-04-05 14:15:22 +00:00
if isDefault {
2017-11-11 04:06:16 +00:00
return common . LocalError ( "The theme is already active" , w , r , user )
2017-04-05 14:15:22 +00:00
}
2017-11-05 09:55:34 +00:00
_ , err = stmts . updateTheme . Exec ( 1 , uname )
2017-04-05 14:15:22 +00:00
} else {
2017-11-11 23:34:27 +00:00
_ , err = stmts . addTheme . Exec ( uname , 1 )
}
if err != nil {
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-10 16:57:22 +00:00
// TODO: Make this less racey
2017-11-11 04:06:16 +00:00
// TODO: Move this to common
common . ChangeDefaultThemeMutex . Lock ( )
defaultTheme := common . DefaultThemeBox . Load ( ) . ( string )
2017-11-05 09:55:34 +00:00
_ , err = stmts . updateTheme . Exec ( 0 , defaultTheme )
2017-04-05 14:15:22 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-05 14:15:22 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
log . Printf ( "Setting theme '%s' as the default theme" , theme . Name )
2017-04-05 14:15:22 +00:00
theme . Active = true
2017-11-11 04:06:16 +00:00
common . Themes [ uname ] = theme
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
dTheme , ok := common . Themes [ defaultTheme ]
2017-04-05 14:15:22 +00:00
if ! ok {
2017-11-11 04:06:16 +00:00
return common . InternalError ( errors . New ( "The default theme is missing" ) , w , r )
2017-04-05 14:15:22 +00:00
}
dTheme . Active = false
2017-11-11 04:06:16 +00:00
common . Themes [ defaultTheme ] = dTheme
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
common . DefaultThemeBox . Store ( uname )
common . ResetTemplateOverrides ( )
common . MapThemeTemplates ( theme )
common . ChangeDefaultThemeMutex . Unlock ( )
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
http . Redirect ( w , r , "/panel/themes/" , http . StatusSeeOther )
2017-10-30 09:57:08 +00:00
return nil
2017-04-05 14:15:22 +00:00
}
2017-04-06 17:37:32 +00:00
2017-11-11 04:06:16 +00:00
func routePanelBackups ( w http . ResponseWriter , r * http . Request , user common . User , backupURL string ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-09-23 19:57:13 +00:00
}
if ! user . IsSuperAdmin {
2017-11-11 04:06:16 +00:00
return common . NoPermissions ( w , r , user )
2017-09-23 19:57:13 +00:00
}
if backupURL != "" {
// We don't want them trying to break out of this directory, it shouldn't hurt since it's a super admin, but it's always good to practice good security hygiene, especially if this is one of many instances on a managed server not controlled by the superadmin/s
2017-11-11 04:06:16 +00:00
backupURL = common . Stripslashes ( backupURL )
2017-09-23 19:57:13 +00:00
var ext = filepath . Ext ( "./backups/" + backupURL )
if ext == ".sql" {
info , err := os . Stat ( "./backups/" + backupURL )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . NotFound ( w , r )
2017-09-23 19:57:13 +00:00
}
// TODO: Change the served filename to gosora_backup_%timestamp%.sql, the time the file was generated, not when it was modified aka what the name of it should be
w . Header ( ) . Set ( "Content-Disposition" , "attachment; filename=gosora_backup.sql" )
w . Header ( ) . Set ( "Content-Length" , strconv . FormatInt ( info . Size ( ) , 10 ) )
// TODO: Fix the problem where non-existent files aren't greeted with custom 404s on ServeFile()'s side
http . ServeFile ( w , r , "./backups/" + backupURL )
2017-10-30 09:57:08 +00:00
return nil
2017-09-23 19:57:13 +00:00
}
2017-11-11 04:06:16 +00:00
return common . NotFound ( w , r )
2017-09-23 19:57:13 +00:00
}
2017-11-11 04:06:16 +00:00
var backupList [ ] common . BackupItem
2017-09-23 19:57:13 +00:00
backupFiles , err := ioutil . ReadDir ( "./backups" )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-09-23 19:57:13 +00:00
}
for _ , backupFile := range backupFiles {
var ext = filepath . Ext ( backupFile . Name ( ) )
if ext != ".sql" {
continue
}
2017-11-11 04:06:16 +00:00
backupList = append ( backupList , common . BackupItem { backupFile . Name ( ) , backupFile . ModTime ( ) } )
2017-09-23 19:57:13 +00:00
}
2017-11-11 04:06:16 +00:00
pi := common . PanelBackupPage { "Backups" , user , headerVars , stats , backupList }
err = common . Templates . ExecuteTemplate ( w , "panel-backups.html" , pi )
2017-09-23 19:57:13 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-09-23 19:57:13 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-09-23 19:57:13 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelLogsMod ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-04-06 17:37:32 +00:00
}
2017-05-29 14:52:37 +00:00
2017-08-17 11:13:49 +00:00
var logCount int
2017-11-05 09:55:34 +00:00
err := stmts . modlogCount . QueryRow ( ) . Scan ( & logCount )
2017-08-17 11:13:49 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-08-17 11:13:49 +00:00
}
page , _ := strconv . Atoi ( r . FormValue ( "page" ) )
perPage := 10
2017-11-11 04:06:16 +00:00
offset , page , lastPage := common . PageOffset ( logCount , page , perPage )
2017-08-17 11:13:49 +00:00
2017-11-05 09:55:34 +00:00
rows , err := stmts . getModlogsOffset . Query ( offset , perPage )
2017-04-06 17:37:32 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-06 17:37:32 +00:00
}
defer rows . Close ( )
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
var logs [ ] common . LogItem
2017-04-06 17:37:32 +00:00
var action , elementType , ipaddress , doneAt string
var elementID , actorID int
for rows . Next ( ) {
2017-09-03 04:50:31 +00:00
err := rows . Scan ( & action , & elementID , & elementType , & ipaddress , & actorID , & doneAt )
2017-04-06 17:37:32 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-06 17:37:32 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
actor , err := common . Users . Get ( actorID )
2017-04-06 17:37:32 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
actor = & common . User { Name : "Unknown" , Link : common . BuildProfileURL ( "unknown" , 0 ) }
2017-04-06 17:37:32 +00:00
}
2017-05-29 14:52:37 +00:00
2017-09-03 04:50:31 +00:00
switch action {
case "lock" :
2017-11-11 04:06:16 +00:00
topic , err := common . Topics . Get ( elementID )
2017-09-03 04:50:31 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
topic = & common . Topic { Title : "Unknown" , Link : common . BuildProfileURL ( "unknown" , 0 ) }
2017-09-03 04:50:31 +00:00
}
action = "<a href='" + topic . Link + "'>" + topic . Title + "</a> was locked by <a href='" + actor . Link + "'>" + actor . Name + "</a>"
case "unlock" :
2017-11-11 04:06:16 +00:00
topic , err := common . Topics . Get ( elementID )
2017-09-03 04:50:31 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
topic = & common . Topic { Title : "Unknown" , Link : common . BuildProfileURL ( "unknown" , 0 ) }
2017-09-03 04:50:31 +00:00
}
action = "<a href='" + topic . Link + "'>" + topic . Title + "</a> was reopened by <a href='" + actor . Link + "'>" + actor . Name + "</a>"
case "stick" :
2017-11-11 04:06:16 +00:00
topic , err := common . Topics . Get ( elementID )
2017-09-03 04:50:31 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
topic = & common . Topic { Title : "Unknown" , Link : common . BuildProfileURL ( "unknown" , 0 ) }
2017-09-03 04:50:31 +00:00
}
action = "<a href='" + topic . Link + "'>" + topic . Title + "</a> was pinned by <a href='" + actor . Link + "'>" + actor . Name + "</a>"
case "unstick" :
2017-11-11 04:06:16 +00:00
topic , err := common . Topics . Get ( elementID )
2017-09-03 04:50:31 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
topic = & common . Topic { Title : "Unknown" , Link : common . BuildProfileURL ( "unknown" , 0 ) }
2017-09-03 04:50:31 +00:00
}
action = "<a href='" + topic . Link + "'>" + topic . Title + "</a> was unpinned by <a href='" + actor . Link + "'>" + actor . Name + "</a>"
case "delete" :
if elementType == "topic" {
action = "Topic #" + strconv . Itoa ( elementID ) + " was deleted by <a href='" + actor . Link + "'>" + actor . Name + "</a>"
} else {
2017-11-11 04:06:16 +00:00
reply := common . BlankReply ( )
reply . ID = elementID
topic , err := reply . Topic ( )
2017-04-06 17:37:32 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
topic = & common . Topic { Title : "Unknown" , Link : common . BuildProfileURL ( "unknown" , 0 ) }
2017-04-06 17:37:32 +00:00
}
2017-09-03 04:50:31 +00:00
action = "A reply in <a href='" + topic . Link + "'>" + topic . Title + "</a> was deleted by <a href='" + actor . Link + "'>" + actor . Name + "</a>"
}
case "ban" :
2017-11-11 04:06:16 +00:00
targetUser , err := common . Users . Get ( elementID )
2017-09-03 04:50:31 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
targetUser = & common . User { Name : "Unknown" , Link : common . BuildProfileURL ( "unknown" , 0 ) }
2017-09-03 04:50:31 +00:00
}
action = "<a href='" + targetUser . Link + "'>" + targetUser . Name + "</a> was banned by <a href='" + actor . Link + "'>" + actor . Name + "</a>"
case "unban" :
2017-11-11 04:06:16 +00:00
targetUser , err := common . Users . Get ( elementID )
2017-09-03 04:50:31 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
targetUser = & common . User { Name : "Unknown" , Link : common . BuildProfileURL ( "unknown" , 0 ) }
2017-09-03 04:50:31 +00:00
}
action = "<a href='" + targetUser . Link + "'>" + targetUser . Name + "</a> was unbanned by <a href='" + actor . Link + "'>" + actor . Name + "</a>"
case "activate" :
2017-11-11 04:06:16 +00:00
targetUser , err := common . Users . Get ( elementID )
2017-09-03 04:50:31 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
targetUser = & common . User { Name : "Unknown" , Link : common . BuildProfileURL ( "unknown" , 0 ) }
2017-09-03 04:50:31 +00:00
}
action = "<a href='" + targetUser . Link + "'>" + targetUser . Name + "</a> was activated by <a href='" + actor . Link + "'>" + actor . Name + "</a>"
default :
action = "Unknown action '" + action + "' by <a href='" + actor . Link + "'>" + actor . Name + "</a>"
2017-04-06 17:37:32 +00:00
}
2017-11-11 04:06:16 +00:00
logs = append ( logs , common . LogItem { Action : template . HTML ( action ) , IPAddress : ipaddress , DoneAt : doneAt } )
2017-04-06 17:37:32 +00:00
}
err = rows . Err ( )
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-06 17:37:32 +00:00
}
2017-05-29 14:52:37 +00:00
2017-11-11 04:06:16 +00:00
pageList := common . Paginate ( logCount , perPage , 5 )
pi := common . PanelLogsPage { "Moderation Logs" , user , headerVars , stats , logs , pageList , page , lastPage }
if common . PreRenderHooks [ "pre_render_panel_mod_log" ] != nil {
if common . RunPreRenderHook ( "pre_render_panel_mod_log" , w , r , & user , & pi ) {
2017-10-30 09:57:08 +00:00
return nil
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
}
2017-11-11 04:06:16 +00:00
err = common . Templates . ExecuteTemplate ( w , "panel-modlogs.html" , pi )
2017-04-06 17:37:32 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-08-15 13:47:56 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-08-15 13:47:56 +00:00
}
2017-11-11 04:06:16 +00:00
func routePanelDebug ( w http . ResponseWriter , r * http . Request , user common . User ) common . RouteError {
headerVars , stats , ferr := common . PanelUserCheck ( w , r , & user )
2017-10-30 09:57:08 +00:00
if ferr != nil {
return ferr
2017-08-15 13:47:56 +00:00
}
uptime := "..."
2017-09-03 04:50:31 +00:00
dbStats := db . Stats ( )
openConnCount := dbStats . OpenConnections
2017-08-15 13:47:56 +00:00
// Disk I/O?
2017-11-11 04:06:16 +00:00
pi := common . PanelDebugPage { "Debug" , user , headerVars , stats , uptime , openConnCount , dbAdapter }
err := common . Templates . ExecuteTemplate ( w , "panel-debug.html" , pi )
2017-08-15 13:47:56 +00:00
if err != nil {
2017-11-11 04:06:16 +00:00
return common . InternalError ( err , w , r )
2017-04-06 17:37:32 +00:00
}
2017-10-30 09:57:08 +00:00
return nil
2017-04-06 17:37:32 +00:00
}