Eliminated some JS errors for guests on Cosora.

Fixed the build tags for the alt database engines.
Tweaked the quotes on the PgSQL adapter. Still not functional.
Removed the SQLite build tag as it's unlikely that it'll ever be implemented.
This commit is contained in:
Azareal 2018-08-15 17:02:57 +10:00
parent f2b210248a
commit 0305571cb3
49 changed files with 102 additions and 103 deletions

View File

@ -1,4 +1,4 @@
// +build !pgsql, !sqlite, !mssql // +build !pgsql,!mssql
/* This file was generated by Gosora's Query Generator. Please try to avoid modifying this file, as it might change at any time. */ /* This file was generated by Gosora's Query Generator. Please try to avoid modifying this file, as it might change at any time. */

View File

@ -33,56 +33,56 @@ func _gen_pgsql() (err error) {
common.DebugLog("Building the generated statements") common.DebugLog("Building the generated statements")
common.DebugLog("Preparing addForumPermsToForum statement.") common.DebugLog("Preparing addForumPermsToForum statement.")
stmts.addForumPermsToForum, err = db.Prepare("INSERT INTO "forums_permissions"("gid","fid","preset","permissions") VALUES (?,?,?,?)") stmts.addForumPermsToForum, err = db.Prepare("INSERT INTO \"forums_permissions\"(\"gid\",\"fid\",\"preset\",\"permissions\") VALUES (?,?,?,?)")
if err != nil { if err != nil {
log.Print("Error in addForumPermsToForum statement.") log.Print("Error in addForumPermsToForum statement.")
return err return err
} }
common.DebugLog("Preparing addTheme statement.") common.DebugLog("Preparing addTheme statement.")
stmts.addTheme, err = db.Prepare("INSERT INTO "themes"("uname","default") VALUES (?,?)") stmts.addTheme, err = db.Prepare("INSERT INTO \"themes\"(\"uname\",\"default\") VALUES (?,?)")
if err != nil { if err != nil {
log.Print("Error in addTheme statement.") log.Print("Error in addTheme statement.")
return err return err
} }
common.DebugLog("Preparing updateTheme statement.") common.DebugLog("Preparing updateTheme statement.")
stmts.updateTheme, err = db.Prepare("UPDATE `themes` SET `default` = ? WHERE `uname` = ?") stmts.updateTheme, err = db.Prepare("UPDATE \"themes\" SET `default` = ? WHERE `uname` = ?")
if err != nil { if err != nil {
log.Print("Error in updateTheme statement.") log.Print("Error in updateTheme statement.")
return err return err
} }
common.DebugLog("Preparing updateGroupPerms statement.") common.DebugLog("Preparing updateGroupPerms statement.")
stmts.updateGroupPerms, err = db.Prepare("UPDATE `users_groups` SET `permissions` = ? WHERE `gid` = ?") stmts.updateGroupPerms, err = db.Prepare("UPDATE \"users_groups\" SET `permissions` = ? WHERE `gid` = ?")
if err != nil { if err != nil {
log.Print("Error in updateGroupPerms statement.") log.Print("Error in updateGroupPerms statement.")
return err return err
} }
common.DebugLog("Preparing updateGroup statement.") common.DebugLog("Preparing updateGroup statement.")
stmts.updateGroup, err = db.Prepare("UPDATE `users_groups` SET `name` = ?,`tag` = ? WHERE `gid` = ?") stmts.updateGroup, err = db.Prepare("UPDATE \"users_groups\" SET `name` = ?,`tag` = ? WHERE `gid` = ?")
if err != nil { if err != nil {
log.Print("Error in updateGroup statement.") log.Print("Error in updateGroup statement.")
return err return err
} }
common.DebugLog("Preparing updateEmail statement.") common.DebugLog("Preparing updateEmail statement.")
stmts.updateEmail, err = db.Prepare("UPDATE `emails` SET `email` = ?,`uid` = ?,`validated` = ?,`token` = ? WHERE `email` = ?") stmts.updateEmail, err = db.Prepare("UPDATE \"emails\" SET `email` = ?,`uid` = ?,`validated` = ?,`token` = ? WHERE `email` = ?")
if err != nil { if err != nil {
log.Print("Error in updateEmail statement.") log.Print("Error in updateEmail statement.")
return err return err
} }
common.DebugLog("Preparing setTempGroup statement.") common.DebugLog("Preparing setTempGroup statement.")
stmts.setTempGroup, err = db.Prepare("UPDATE `users` SET `temp_group` = ? WHERE `uid` = ?") stmts.setTempGroup, err = db.Prepare("UPDATE \"users\" SET `temp_group` = ? WHERE `uid` = ?")
if err != nil { if err != nil {
log.Print("Error in setTempGroup statement.") log.Print("Error in setTempGroup statement.")
return err return err
} }
common.DebugLog("Preparing bumpSync statement.") common.DebugLog("Preparing bumpSync statement.")
stmts.bumpSync, err = db.Prepare("UPDATE `sync` SET `last_update` = LOCALTIMESTAMP()") stmts.bumpSync, err = db.Prepare("UPDATE \"sync\" SET `last_update` = LOCALTIMESTAMP()")
if err != nil { if err != nil {
log.Print("Error in bumpSync statement.") log.Print("Error in bumpSync statement.")
return err return err

View File

@ -3,7 +3,7 @@
/* /*
* *
* Gosora MSSQL Interface * Gosora MSSQL Interface
* Copyright Azareal 2016 - 2018 * Copyright Azareal 2016 - 2019
* *
*/ */
package main package main
@ -13,6 +13,7 @@ import (
"log" "log"
"net/url" "net/url"
"./common"
"./query_gen/lib" "./query_gen/lib"
_ "github.com/denisenkom/go-mssqldb" _ "github.com/denisenkom/go-mssqldb"
) )
@ -27,11 +28,11 @@ func init() {
func initMSSQL() (err error) { func initMSSQL() (err error) {
// TODO: Move this bit to the query gen lib // TODO: Move this bit to the query gen lib
query := url.Values{} query := url.Values{}
query.Add("database", dbConfig.Dbname) query.Add("database", common.DbConfig.Dbname)
u := &url.URL{ u := &url.URL{
Scheme: "sqlserver", Scheme: "sqlserver",
User: url.UserPassword(dbConfig.Username, dbConfig.Password), User: url.UserPassword(common.DbConfig.Username, common.DbConfig.Password),
Host: dbConfig.Host + ":" + dbConfig.Port, Host: common.DbConfig.Host + ":" + common.DbConfig.Port,
Path: dbInstance, Path: dbInstance,
RawQuery: query.Encode(), RawQuery: query.Encode(),
} }
@ -72,42 +73,42 @@ func initMSSQL() (err error) {
} }
// TODO: Is there a less noisy way of doing this for tests? // TODO: Is there a less noisy way of doing this for tests?
log.Print("Preparing getActivityFeedByWatcher statement.") /*log.Print("Preparing getActivityFeedByWatcher statement.")
getActivityFeedByWatcherStmt, err = db.Prepare("SELECT activity_stream_matches.asid, activity_stream.actor, activity_stream.targetUser, activity_stream.event, activity_stream.elementType, activity_stream.elementID FROM [activity_stream_matches] INNER JOIN [activity_stream] ON activity_stream_matches.asid = activity_stream.asid AND activity_stream_matches.watcher != activity_stream.actor WHERE [watcher] = ? ORDER BY activity_stream.asid DESC OFFSET 0 ROWS FETCH NEXT 8 ROWS ONLY") stmts.getActivityFeedByWatcherStmt, err = db.Prepare("SELECT activity_stream_matches.asid, activity_stream.actor, activity_stream.targetUser, activity_stream.event, activity_stream.elementType, activity_stream.elementID FROM [activity_stream_matches] INNER JOIN [activity_stream] ON activity_stream_matches.asid = activity_stream.asid AND activity_stream_matches.watcher != activity_stream.actor WHERE [watcher] = ? ORDER BY activity_stream.asid DESC OFFSET 0 ROWS FETCH NEXT 8 ROWS ONLY")
if err != nil { if err != nil {
return err return err
} }
log.Print("Preparing getActivityCountByWatcher statement.") log.Print("Preparing getActivityCountByWatcher statement.")
getActivityCountByWatcherStmt, err = db.Prepare("SELECT count(*) FROM [activity_stream_matches] INNER JOIN [activity_stream] ON activity_stream_matches.asid = activity_stream.asid AND activity_stream_matches.watcher != activity_stream.actor WHERE [watcher] = ?") stmts.getActivityCountByWatcherStmt, err = db.Prepare("SELECT count(*) FROM [activity_stream_matches] INNER JOIN [activity_stream] ON activity_stream_matches.asid = activity_stream.asid AND activity_stream_matches.watcher != activity_stream.actor WHERE [watcher] = ?")
if err != nil { if err != nil {
return err return err
} }
log.Print("Preparing todaysPostCount statement.") log.Print("Preparing todaysPostCount statement.")
todaysPostCountStmt, err = db.Prepare("select count(*) from replies where createdAt >= DATEADD(DAY, -1, GETUTCDATE())") stmts.todaysPostCountStmt, err = db.Prepare("select count(*) from replies where createdAt >= DATEADD(DAY, -1, GETUTCDATE())")
if err != nil { if err != nil {
return err return err
} }
log.Print("Preparing todaysTopicCount statement.") log.Print("Preparing todaysTopicCount statement.")
todaysTopicCountStmt, err = db.Prepare("select count(*) from topics where createdAt >= DATEADD(DAY, -1, GETUTCDATE())") stmts.todaysTopicCountStmt, err = db.Prepare("select count(*) from topics where createdAt >= DATEADD(DAY, -1, GETUTCDATE())")
if err != nil { if err != nil {
return err return err
} }*/
log.Print("Preparing todaysTopicCountByForum statement.") log.Print("Preparing todaysTopicCountByForum statement.")
// TODO: Stop hard-coding this query // TODO: Stop hard-coding this query
todaysTopicCountByForum, err = db.Prepare("select count(*) from topics where createdAt >= DATEADD(DAY, -1, GETUTCDATE()) and parentID = ?") stmts.todaysTopicCountByForum, err = db.Prepare("select count(*) from topics where createdAt >= DATEADD(DAY, -1, GETUTCDATE()) and parentID = ?")
if err != nil { if err != nil {
return err return err
} }
log.Print("Preparing todaysNewUserCount statement.") /*log.Print("Preparing todaysNewUserCount statement.")
todaysNewUserCountStmt, err = db.Prepare("select count(*) from users where createdAt >= DATEADD(DAY, -1, GETUTCDATE())") stmts.todaysNewUserCountStmt, err = db.Prepare("select count(*) from users where createdAt >= DATEADD(DAY, -1, GETUTCDATE())")
if err != nil { if err != nil {
return err return err
} }*/
return nil return nil
} }

View File

@ -1,4 +1,4 @@
// +build !pgsql, !sqlite, !mssql // +build !pgsql,!mssql
/* /*
* *

View File

@ -24,11 +24,11 @@ func init() {
func initPgsql() (err error) { func initPgsql() (err error) {
// TODO: Investigate connect_timeout to see what it does exactly and whether it's relevant to us // TODO: Investigate connect_timeout to see what it does exactly and whether it's relevant to us
var _dbpassword string var _dbpassword string
if dbpassword != "" { if common.DbConfig.Password != "" {
_dbpassword = " password='" + _escape_bit(common.DbConfig.Password) + "'" _dbpassword = " password='" + _escape_bit(common.DbConfig.Password) + "'"
} }
// TODO: Move this bit to the query gen lib // TODO: Move this bit to the query gen lib
db, err = sql.Open("postgres", "host='"+_escape_bit(common.DbConfig.Host)+"' port='"+_escape_bit(common.DbConfig.Port)+"' user='"+_escape_bit(common.DbConfig.Username)+"' dbname='"+_escape_bit(common.Config.Dbname)+"'"+_dbpassword+" sslmode='"+dbSslmode+"'") db, err = sql.Open("postgres", "host='"+_escape_bit(common.DbConfig.Host)+"' port='"+_escape_bit(common.DbConfig.Port)+"' user='"+_escape_bit(common.DbConfig.Username)+"' dbname='"+_escape_bit(common.DbConfig.Dbname)+"'"+_dbpassword+" sslmode='"+dbSslmode+"'")
if err != nil { if err != nil {
return err return err
} }

View File

@ -719,7 +719,7 @@ func (adapter *MysqlAdapter) Write() error {
} }
// TODO: Move these custom queries out of this file // TODO: Move these custom queries out of this file
out := `// +build !pgsql, !sqlite, !mssql out := `// +build !pgsql,!mssql
/* This file was generated by Gosora's Query Generator. Please try to avoid modifying this file, as it might change at any time. */ /* This file was generated by Gosora's Query Generator. Please try to avoid modifying this file, as it might change at any time. */

View File

@ -67,7 +67,7 @@ func (adapter *PgsqlAdapter) CreateTable(name string, table string, charset stri
return "", errors.New("You can't have a table with no columns") return "", errors.New("You can't have a table with no columns")
} }
var querystr = "CREATE TABLE `" + table + "` (" var querystr = "CREATE TABLE \"" + table + "\" ("
for _, column := range columns { for _, column := range columns {
if column.AutoIncrement { if column.AutoIncrement {
column.Type = "serial" column.Type = "serial"
@ -222,7 +222,8 @@ func (adapter *PgsqlAdapter) SimpleUpdate(name string, table string, set string,
if set == "" { if set == "" {
return "", errors.New("You need to set data in this update statement") return "", errors.New("You need to set data in this update statement")
} }
var querystr = "UPDATE `" + table + "` SET "
var querystr = "UPDATE \"" + table + "\" SET "
for _, item := range processSet(set) { for _, item := range processSet(set) {
querystr += "`" + item.Column + "` =" querystr += "`" + item.Column + "` ="
for _, token := range item.Expr { for _, token := range item.Expr {
@ -243,7 +244,6 @@ func (adapter *PgsqlAdapter) SimpleUpdate(name string, table string, set string,
} }
querystr += "," querystr += ","
} }
// Remove the trailing comma // Remove the trailing comma
querystr = querystr[0 : len(querystr)-1] querystr = querystr[0 : len(querystr)-1]
@ -414,7 +414,7 @@ func (adapter *PgsqlAdapter) Write() error {
stmts += "\t" + name + " *sql.Stmt\n" stmts += "\t" + name + " *sql.Stmt\n"
body += ` body += `
common.DebugLog("Preparing ` + name + ` statement.") common.DebugLog("Preparing ` + name + ` statement.")
stmts.` + name + `, err = db.Prepare("` + stmt.Contents + `") stmts.` + name + `, err = db.Prepare("` + strings.Replace(stmt.Contents, "\"", "\\\"", -1) + `")
if err != nil { if err != nil {
log.Print("Error in ` + name + ` statement.") log.Print("Error in ` + name + ` statement.")
return err return err

View File

@ -1,4 +1,4 @@
CREATE TABLE `activity_stream` ( CREATE TABLE "activity_stream" (
`asid` serial not null, `asid` serial not null,
`actor` int not null, `actor` int not null,
`targetUser` int not null, `targetUser` int not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `activity_stream_matches` ( CREATE TABLE "activity_stream_matches" (
`watcher` int not null, `watcher` int not null,
`asid` int not null `asid` int not null
); );

View File

@ -1,4 +1,4 @@
CREATE TABLE `activity_subscriptions` ( CREATE TABLE "activity_subscriptions" (
`user` int not null, `user` int not null,
`targetID` int not null, `targetID` int not null,
`targetType` varchar (50) not null, `targetType` varchar (50) not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `administration_logs` ( CREATE TABLE "administration_logs" (
`action` varchar (100) not null, `action` varchar (100) not null,
`elementID` int not null, `elementID` int not null,
`elementType` varchar (100) not null, `elementType` varchar (100) not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `attachments` ( CREATE TABLE "attachments" (
`attachID` serial not null, `attachID` serial not null,
`sectionID` int DEFAULT 0 not null, `sectionID` int DEFAULT 0 not null,
`sectionTable` varchar (200) DEFAULT 'forums' not null, `sectionTable` varchar (200) DEFAULT 'forums' not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `emails` ( CREATE TABLE "emails" (
`email` varchar (200) not null, `email` varchar (200) not null,
`uid` int not null, `uid` int not null,
`validated` boolean DEFAULT 0 not null, `validated` boolean DEFAULT 0 not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `forums` ( CREATE TABLE "forums" (
`fid` serial not null, `fid` serial not null,
`name` varchar (100) not null, `name` varchar (100) not null,
`desc` varchar (200) not null, `desc` varchar (200) not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `forums_permissions` ( CREATE TABLE "forums_permissions" (
`fid` int not null, `fid` int not null,
`gid` int not null, `gid` int not null,
`preset` varchar (100) DEFAULT '' not null, `preset` varchar (100) DEFAULT '' not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `likes` ( CREATE TABLE "likes" (
`weight` tinyint DEFAULT 1 not null, `weight` tinyint DEFAULT 1 not null,
`targetItem` int not null, `targetItem` int not null,
`targetType` varchar (50) DEFAULT 'replies' not null, `targetType` varchar (50) DEFAULT 'replies' not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `menu_items` ( CREATE TABLE "menu_items" (
`miid` serial not null, `miid` serial not null,
`mid` int not null, `mid` int not null,
`name` varchar (200) not null, `name` varchar (200) not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `menus` ( CREATE TABLE "menus" (
`mid` serial not null, `mid` serial not null,
primary key(`mid`) primary key(`mid`)
); );

View File

@ -1,4 +1,4 @@
CREATE TABLE `moderation_logs` ( CREATE TABLE "moderation_logs" (
`action` varchar (100) not null, `action` varchar (100) not null,
`elementID` int not null, `elementID` int not null,
`elementType` varchar (100) not null, `elementType` varchar (100) not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `pages` ( CREATE TABLE "pages" (
`pid` serial not null, `pid` serial not null,
`name` varchar (200) not null, `name` varchar (200) not null,
`title` varchar (200) not null, `title` varchar (200) not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `plugins` ( CREATE TABLE "plugins" (
`uname` varchar (180) not null, `uname` varchar (180) not null,
`active` boolean DEFAULT 0 not null, `active` boolean DEFAULT 0 not null,
`installed` boolean DEFAULT 0 not null, `installed` boolean DEFAULT 0 not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `polls` ( CREATE TABLE "polls" (
`pollID` serial not null, `pollID` serial not null,
`parentID` int DEFAULT 0 not null, `parentID` int DEFAULT 0 not null,
`parentTable` varchar (100) DEFAULT 'topics' not null, `parentTable` varchar (100) DEFAULT 'topics' not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `polls_options` ( CREATE TABLE "polls_options" (
`pollID` int not null, `pollID` int not null,
`option` int DEFAULT 0 not null, `option` int DEFAULT 0 not null,
`votes` int DEFAULT 0 not null `votes` int DEFAULT 0 not null

View File

@ -1,5 +0,0 @@
CREATE TABLE `polls_voters` (
`pollID` int not null,
`uid` int not null,
`option` int DEFAULT 0 not null
);

View File

@ -1,4 +1,4 @@
CREATE TABLE `polls_votes` ( CREATE TABLE "polls_votes" (
`pollID` int not null, `pollID` int not null,
`uid` int not null, `uid` int not null,
`option` int DEFAULT 0 not null, `option` int DEFAULT 0 not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `postchunks` ( CREATE TABLE "postchunks" (
`count` int DEFAULT 0 not null, `count` int DEFAULT 0 not null,
`createdAt` timestamp not null `createdAt` timestamp not null
); );

View File

@ -1,4 +1,4 @@
CREATE TABLE `registration_logs` ( CREATE TABLE "registration_logs" (
`rlid` serial not null, `rlid` serial not null,
`username` varchar (100) not null, `username` varchar (100) not null,
`email` varchar (100) not null, `email` varchar (100) not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `replies` ( CREATE TABLE "replies" (
`rid` serial not null, `rid` serial not null,
`tid` int not null, `tid` int not null,
`content` text not null, `content` text not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `revisions` ( CREATE TABLE "revisions" (
`reviseID` serial not null, `reviseID` serial not null,
`content` text not null, `content` text not null,
`contentID` int not null, `contentID` int not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `settings` ( CREATE TABLE "settings" (
`name` varchar (180) not null, `name` varchar (180) not null,
`content` varchar (250) not null, `content` varchar (250) not null,
`type` varchar (50) not null, `type` varchar (50) not null,

View File

@ -1,3 +1,3 @@
CREATE TABLE `sync` ( CREATE TABLE "sync" (
`last_update` timestamp not null `last_update` timestamp not null
); );

View File

@ -1,4 +1,4 @@
CREATE TABLE `themes` ( CREATE TABLE "themes" (
`uname` varchar (180) not null, `uname` varchar (180) not null,
`default` boolean DEFAULT 0 not null, `default` boolean DEFAULT 0 not null,
unique(`uname`) unique(`uname`)

View File

@ -1,4 +1,4 @@
CREATE TABLE `topicchunks` ( CREATE TABLE "topicchunks" (
`count` int DEFAULT 0 not null, `count` int DEFAULT 0 not null,
`createdAt` timestamp not null `createdAt` timestamp not null
); );

View File

@ -1,4 +1,4 @@
CREATE TABLE `topics` ( CREATE TABLE "topics" (
`tid` serial not null, `tid` serial not null,
`title` varchar (100) not null, `title` varchar (100) not null,
`content` text not null, `content` text not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `users` ( CREATE TABLE "users" (
`uid` serial not null, `uid` serial not null,
`name` varchar (100) not null, `name` varchar (100) not null,
`password` varchar (100) not null, `password` varchar (100) not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `users_2fa_keys` ( CREATE TABLE "users_2fa_keys" (
`uid` int not null, `uid` int not null,
`secret` varchar (100) not null, `secret` varchar (100) not null,
`scratch1` varchar (50) not null, `scratch1` varchar (50) not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `users_avatar_queue` ( CREATE TABLE "users_avatar_queue" (
`uid` int not null, `uid` int not null,
primary key(`uid`) primary key(`uid`)
); );

View File

@ -1,4 +1,4 @@
CREATE TABLE `users_groups` ( CREATE TABLE "users_groups" (
`gid` serial not null, `gid` serial not null,
`name` varchar (100) not null, `name` varchar (100) not null,
`permissions` text not null, `permissions` text not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `users_groups_scheduler` ( CREATE TABLE "users_groups_scheduler" (
`uid` int not null, `uid` int not null,
`set_group` int not null, `set_group` int not null,
`issued_by` int not null, `issued_by` int not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `users_replies` ( CREATE TABLE "users_replies" (
`rid` serial not null, `rid` serial not null,
`uid` int not null, `uid` int not null,
`content` text not null, `content` text not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `viewchunks` ( CREATE TABLE "viewchunks" (
`count` int DEFAULT 0 not null, `count` int DEFAULT 0 not null,
`createdAt` timestamp not null, `createdAt` timestamp not null,
`route` varchar (200) not null `route` varchar (200) not null

View File

@ -1,4 +1,4 @@
CREATE TABLE `viewchunks_agents` ( CREATE TABLE "viewchunks_agents" (
`count` int DEFAULT 0 not null, `count` int DEFAULT 0 not null,
`createdAt` timestamp not null, `createdAt` timestamp not null,
`browser` varchar (200) not null `browser` varchar (200) not null

View File

@ -1,4 +1,4 @@
CREATE TABLE `viewchunks_forums` ( CREATE TABLE "viewchunks_forums" (
`count` int DEFAULT 0 not null, `count` int DEFAULT 0 not null,
`createdAt` timestamp not null, `createdAt` timestamp not null,
`forum` int not null `forum` int not null

View File

@ -1,4 +1,4 @@
CREATE TABLE `viewchunks_langs` ( CREATE TABLE "viewchunks_langs" (
`count` int DEFAULT 0 not null, `count` int DEFAULT 0 not null,
`createdAt` timestamp not null, `createdAt` timestamp not null,
`lang` varchar (200) not null `lang` varchar (200) not null

View File

@ -1,4 +1,4 @@
CREATE TABLE `viewchunks_referrers` ( CREATE TABLE "viewchunks_referrers" (
`count` int DEFAULT 0 not null, `count` int DEFAULT 0 not null,
`createdAt` timestamp not null, `createdAt` timestamp not null,
`domain` varchar (200) not null `domain` varchar (200) not null

View File

@ -1,4 +1,4 @@
CREATE TABLE `viewchunks_systems` ( CREATE TABLE "viewchunks_systems" (
`count` int DEFAULT 0 not null, `count` int DEFAULT 0 not null,
`createdAt` timestamp not null, `createdAt` timestamp not null,
`system` varchar (200) not null `system` varchar (200) not null

View File

@ -1,4 +1,4 @@
CREATE TABLE `widgets` ( CREATE TABLE "widgets" (
`position` int not null, `position` int not null,
`side` varchar (100) not null, `side` varchar (100) not null,
`type` varchar (100) not null, `type` varchar (100) not null,

View File

@ -1,4 +1,4 @@
CREATE TABLE `word_filters` ( CREATE TABLE "word_filters" (
`wfid` serial not null, `wfid` serial not null,
`find` varchar (200) not null, `find` varchar (200) not null,
`replacement` varchar (200) not null, `replacement` varchar (200) not null,

View File

@ -1,6 +1,8 @@
"use strict" "use strict"
$(document).ready(function(){ $(document).ready(function(){
let loggedIn = document.head.querySelector("[property='x-loggedin']").content;
if(loggedIn) {
// Is there we way we can append instead? Maybe, an editor plugin? // Is there we way we can append instead? Maybe, an editor plugin?
attachItemCallback = function(attachItem) { attachItemCallback = function(attachItem) {
let currentContent = $('#input_content').trumbowyg('html'); let currentContent = $('#input_content').trumbowyg('html');
@ -31,6 +33,7 @@ $(document).ready(function(){
btns: [['viewHTML'],['strong','em','del'],['link'],['insertImage'],['removeformat']], btns: [['viewHTML'],['strong','em','del'],['link'],['insertImage'],['removeformat']],
autogrow: true, autogrow: true,
}); });
}
// TODO: Refactor this to use `each` less // TODO: Refactor this to use `each` less
$('.button_menu').click(function(){ $('.button_menu').click(function(){