Browse Source

Remove not needed backup files

Vova Tkach 6 years ago
parent
commit
be301de7c8
58 changed files with 0 additions and 3204 deletions
  1. 0 64
      .bak/engine.go
  2. 0 45
      .bak/engine/actions/action_first_user.go
  3. 0 83
      .bak/engine/actions/action_mysql.go
  4. 0 61
      .bak/engine/actions/action_signin.go
  5. 0 21
      .bak/engine/actions/action_singout.go
  6. 0 57
      .bak/engine/actions/action_usersettings.go
  7. 0 104
      .bak/engine/actions/actions.go
  8. 0 131
      .bak/engine/backend/backend.go
  9. 0 50
      .bak/engine/backend/modules/module_empty.go
  10. 0 53
      .bak/engine/backend/modules/module_index.go
  11. 0 48
      .bak/engine/backend/modules/module_settings.go
  12. 0 115
      .bak/engine/backend/modules/module_users.go
  13. 0 465
      .bak/engine/backend/modules/modules.go
  14. 0 58
      .bak/engine/frontend/frontend.go
  15. 0 218
      .bak/engine/sessions/sessions.go
  16. 0 38
      .bak/engine/wrapper/redirects.go
  17. BIN
      .bak/engine/wrapper/resources/images/assets.sys.bg.png
  18. 0 3
      .bak/engine/wrapper/resources/images/assets.sys.bg.png.go
  19. BIN
      .bak/engine/wrapper/resources/images/assets.sys.logo.png
  20. 0 2
      .bak/engine/wrapper/resources/images/assets.sys.logo.png.go
  21. BIN
      .bak/engine/wrapper/resources/others/assets.sys.fave.ico
  22. 0 2
      .bak/engine/wrapper/resources/others/assets.sys.fave.ico.go
  23. 0 1
      .bak/engine/wrapper/resources/others/assets.sys.logo.svg
  24. 0 3
      .bak/engine/wrapper/resources/others/assets.sys.logo.svg.go
  25. 0 9
      .bak/engine/wrapper/resources/others/assets.sys.svg.icons.go
  26. 0 126
      .bak/engine/wrapper/resources/scripts/assets.cp.scripts.js
  27. 0 3
      .bak/engine/wrapper/resources/scripts/assets.cp.scripts.js.go
  28. 0 7
      .bak/engine/wrapper/resources/scripts/assets.sys.bootstrap.js.go
  29. 0 3
      .bak/engine/wrapper/resources/scripts/assets.sys.jquery.js.go
  30. 0 5
      .bak/engine/wrapper/resources/scripts/assets.sys.popper.js.go
  31. 0 290
      .bak/engine/wrapper/resources/styles/assets.cp.styles.css
  32. 0 3
      .bak/engine/wrapper/resources/styles/assets.cp.styles.css.go
  33. 0 7
      .bak/engine/wrapper/resources/styles/assets.sys.bootstrap.css.go
  34. 0 112
      .bak/engine/wrapper/resources/styles/assets.sys.styles.css
  35. 0 3
      .bak/engine/wrapper/resources/styles/assets.sys.styles.css.go
  36. 0 2
      .bak/engine/wrapper/resources/templates/cp.base.go
  37. 0 119
      .bak/engine/wrapper/resources/templates/cp.base.html
  38. 0 3
      .bak/engine/wrapper/resources/templates/cp.firstuser.go
  39. 0 33
      .bak/engine/wrapper/resources/templates/cp.firstuser.html
  40. 0 3
      .bak/engine/wrapper/resources/templates/cp.login.go
  41. 0 29
      .bak/engine/wrapper/resources/templates/cp.login.html
  42. 0 3
      .bak/engine/wrapper/resources/templates/cp.mysql.go
  43. 0 35
      .bak/engine/wrapper/resources/templates/cp.mysql.html
  44. 0 3
      .bak/engine/wrapper/resources/templates/page.default.go
  45. 0 23
      .bak/engine/wrapper/resources/templates/page.default.html
  46. 0 3
      .bak/engine/wrapper/resources/templates/page.engerror.go
  47. 0 23
      .bak/engine/wrapper/resources/templates/page.engerror.html
  48. 0 3
      .bak/engine/wrapper/resources/templates/page.error.404.go
  49. 0 23
      .bak/engine/wrapper/resources/templates/page.error.404.html
  50. 0 3
      .bak/engine/wrapper/resources/templates/page.tmplerror.go
  51. 0 23
      .bak/engine/wrapper/resources/templates/page.tmplerror.html
  52. 0 215
      .bak/engine/wrapper/static.go
  53. 0 61
      .bak/engine/wrapper/utils/config_mysql.go
  54. 0 7
      .bak/engine/wrapper/utils/struct_msubmenu.go
  55. 0 9
      .bak/engine/wrapper/utils/struct_mysql.go
  56. 0 34
      .bak/engine/wrapper/utils/utils.go
  57. 0 219
      .bak/engine/wrapper/wrapper.go
  58. 0 138
      .bak/main.go

+ 0 - 64
.bak/engine.go

@@ -1,64 +0,0 @@
-package main
-
-import (
-	"database/sql"
-	"net/http"
-	"strings"
-
-	"golang-fave/engine/backend"
-	"golang-fave/engine/frontend"
-	"golang-fave/engine/wrapper"
-
-	templates "golang-fave/engine/wrapper/resources/templates"
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-func handlerPage(wrapper *wrapper.Wrapper) bool {
-	mysql_conf_exists := utils.IsMySqlConfigExists(wrapper.DirVHostHome)
-
-	is_front_end := true
-	if wrapper.R.URL.Path == "/cp" || strings.HasPrefix(wrapper.R.URL.Path, "/cp/") {
-		is_front_end = false
-	}
-
-	if is_front_end {
-		// Front-end
-		if !mysql_conf_exists {
-			(*wrapper.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-			http.Redirect(*wrapper.W, wrapper.R, wrapper.R.URL.Scheme+"://"+wrapper.R.Host+"/cp/", 302)
-			return true
-		}
-	} else {
-		// Back-end
-		if !mysql_conf_exists {
-			return wrapper.TmplBackEnd(templates.CpMySQL, nil)
-		}
-	}
-
-	// Connect to database or show error
-	mc, err := utils.MySqlConfigRead(wrapper.DirVHostHome)
-	if wrapper.EngineErrMsgOnError(err) {
-		return true
-	}
-	db, err := sql.Open("mysql", mc.User+":"+mc.Password+"@tcp("+mc.Host+":"+mc.Port+")/"+mc.Name)
-	if wrapper.EngineErrMsgOnError(err) {
-		return true
-	}
-	defer db.Close()
-	err = db.Ping()
-	if wrapper.EngineErrMsgOnError(err) {
-		return true
-	}
-
-	// Parse url params
-	url_args := utils.UrlToArray(wrapper.R.URL.Path)
-
-	// Run WebSite or CP
-	if is_front_end {
-		// Front-end
-		return frontend.New(wrapper, db, &url_args).Run()
-	} else {
-		// Back-end
-		return backend.New(wrapper, db, &url_args).Run()
-	}
-}

+ 0 - 45
.bak/engine/actions/action_first_user.go

@@ -1,45 +0,0 @@
-package actions
-
-import (
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-func (this *Action) Action_first_user() {
-	if err := this.use_database(); err != nil {
-		this.msg_error(err.Error())
-		return
-	} else {
-		defer this.db.Close()
-	}
-
-	pf_first_name := this.wrapper.R.FormValue("first_name")
-	pf_last_name := this.wrapper.R.FormValue("last_name")
-	pf_email := this.wrapper.R.FormValue("email")
-	pf_password := this.wrapper.R.FormValue("password")
-
-	if pf_email == "" {
-		this.msg_error(`Please specify user email`)
-		return
-	}
-
-	if !utils.EmailIsValid(pf_email) {
-		this.msg_error(`Please specify correct user email`)
-		return
-	}
-
-	if pf_password == "" {
-		this.msg_error(`Please specify user password`)
-		return
-	}
-
-	_, err := this.db.Query(
-		"INSERT INTO `users` SET `first_name` = ?, `last_name` = ?, `email` = ?, `password` = MD5(?);",
-		pf_first_name, pf_last_name, pf_email, pf_password)
-	if err != nil {
-		this.msg_error(err.Error())
-		return
-	}
-
-	// Reload current page
-	this.write(`window.location.reload(false);`)
-}

+ 0 - 83
.bak/engine/actions/action_mysql.go

@@ -1,83 +0,0 @@
-package actions
-
-import (
-	"database/sql"
-	_ "github.com/go-sql-driver/mysql"
-
-	"fmt"
-	"strconv"
-
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-func (this *Action) Action_mysql() {
-	pf_host := this.wrapper.R.FormValue("host")
-	pf_port := this.wrapper.R.FormValue("port")
-	pf_name := this.wrapper.R.FormValue("name")
-	pf_user := this.wrapper.R.FormValue("user")
-	pf_password := this.wrapper.R.FormValue("password")
-
-	if pf_host == "" {
-		this.msg_error(`Please specify host for MySQL connection`)
-		return
-	}
-
-	if pf_port == "" {
-		this.msg_error(`Please specify host port for MySQL connection`)
-		return
-	}
-
-	if _, err := strconv.Atoi(pf_port); err != nil {
-		this.msg_error(`MySQL host port must be integer number`)
-		return
-	}
-
-	if pf_name == "" {
-		this.msg_error(`Please specify MySQL database name`)
-		return
-	}
-
-	if pf_user == "" {
-		this.msg_error(`Please specify MySQL user`)
-		return
-	}
-
-	// Try connect to mysql
-	db, err := sql.Open("mysql", pf_user+":"+pf_password+"@tcp("+pf_host+":"+pf_port+")/"+pf_name)
-	if err != nil {
-		this.msg_error(err.Error())
-		return
-	}
-	defer db.Close()
-	err = db.Ping()
-	if err != nil {
-		this.msg_error(err.Error())
-		return
-	}
-
-	// Try to install all tables
-	_, err = db.Query(fmt.Sprintf(
-		"CREATE TABLE `%s`.`users` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI', `first_name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'User first name', `last_name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'User last name', `email` VARCHAR(64) NOT NULL COMMENT 'User email', `password` VARCHAR(32) NOT NULL COMMENT 'User password (MD5)', PRIMARY KEY (`id`)) ENGINE = InnoDB;",
-		pf_name))
-	if err != nil {
-		this.msg_error(err.Error())
-		return
-	}
-	_, err = db.Query(fmt.Sprintf(
-		"CREATE TABLE `%s`.`pages` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI', `user` int(11) NOT NULL COMMENT 'User id', `name` varchar(255) NOT NULL COMMENT 'Page name', `slug` varchar(255) NOT NULL COMMENT 'Page url part', `content` text NOT NULL COMMENT 'Page content', `meta_title` varchar(255) NOT NULL DEFAULT '' COMMENT 'Page meta title', `meta_keywords` varchar(255) NOT NULL DEFAULT '' COMMENT 'Page meta keywords', `meta_description` varchar(510) NOT NULL DEFAULT '' COMMENT 'Page meta description', `datetime` datetime NOT NULL COMMENT 'Creation date/time', `status` enum('draft','public','trash') NOT NULL COMMENT 'Page status', PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;",
-		pf_name))
-	if err != nil {
-		this.msg_error(err.Error())
-		return
-	}
-
-	// Save mysql config file
-	err = utils.MySqlConfigWrite(this.wrapper.DirVHostHome, pf_host, pf_port, pf_name, pf_user, pf_password)
-	if err != nil {
-		this.msg_error(err.Error())
-		return
-	}
-
-	// Reload current page
-	this.write(`window.location.reload(false);`)
-}

+ 0 - 61
.bak/engine/actions/action_signin.go

@@ -1,61 +0,0 @@
-package actions
-
-import (
-	"database/sql"
-	_ "github.com/go-sql-driver/mysql"
-
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-func (this *Action) Action_signin() {
-	if err := this.use_database(); err != nil {
-		this.msg_error(err.Error())
-		return
-	} else {
-		defer this.db.Close()
-	}
-
-	pf_email := this.wrapper.R.FormValue("email")
-	pf_password := this.wrapper.R.FormValue("password")
-
-	if pf_email == "" {
-		this.msg_error(`Please specify user email`)
-		return
-	}
-
-	if !utils.EmailIsValid(pf_email) {
-		this.msg_error(`Please specify correct user email`)
-		return
-	}
-
-	if pf_password == "" {
-		this.msg_error(`Please specify user password`)
-		return
-	}
-
-	if this.wrapper.Session.GetIntDef("UserId", 0) > 0 {
-		this.msg_error(`You already logined`)
-		return
-	}
-
-	var user_id int
-	err := this.db.QueryRow(
-		"SELECT `id` FROM `users` WHERE `email` = ? and `password` = MD5(?) LIMIT 1;",
-		pf_email, pf_password).Scan(&user_id)
-
-	if err != nil && err != sql.ErrNoRows {
-		this.msg_error(err.Error())
-		return
-	}
-
-	if err == sql.ErrNoRows {
-		this.msg_error(`Incorrect email or password`)
-		return
-	}
-
-	// Save to current session
-	this.wrapper.Session.SetInt("UserId", user_id)
-
-	// Reload current page
-	this.write(`window.location.reload(false);`)
-}

+ 0 - 21
.bak/engine/actions/action_singout.go

@@ -1,21 +0,0 @@
-package actions
-
-func (this *Action) Action_singout() {
-	if err := this.use_database(); err != nil {
-		this.msg_error(err.Error())
-		return
-	} else {
-		defer this.db.Close()
-	}
-
-	if err := this.load_session_user(); err != nil {
-		this.msg_error(err.Error())
-		return
-	}
-
-	// Set to zero
-	this.wrapper.Session.SetInt("UserId", 0)
-
-	// Reload current page
-	this.write(`window.location.reload(false);`)
-}

+ 0 - 57
.bak/engine/actions/action_usersettings.go

@@ -1,57 +0,0 @@
-package actions
-
-import (
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-func (this *Action) Action_usersettings() {
-	if err := this.use_database(); err != nil {
-		this.msg_error(err.Error())
-		return
-	} else {
-		defer this.db.Close()
-	}
-
-	if err := this.load_session_user(); err != nil {
-		this.msg_error(err.Error())
-		return
-	}
-
-	pf_first_name := this.wrapper.R.FormValue("first_name")
-	pf_last_name := this.wrapper.R.FormValue("last_name")
-	pf_email := this.wrapper.R.FormValue("email")
-	pf_password := this.wrapper.R.FormValue("password")
-
-	if pf_email == "" {
-		this.msg_error(`Please specify user email`)
-		return
-	}
-
-	if !utils.EmailIsValid(pf_email) {
-		this.msg_error(`Please specify correct user email`)
-		return
-	}
-
-	if pf_password != "" {
-		// Update with password if set
-		_, err := this.db.Query(
-			"UPDATE `users` SET `first_name` = ?, `last_name` = ?, `email` = ?, `password` = MD5(?) WHERE `id` = ?;",
-			pf_first_name, pf_last_name, pf_email, pf_password, this.user.A_id)
-		if err != nil {
-			this.msg_error(err.Error())
-			return
-		}
-	} else {
-		// Update without password if not set
-		_, err := this.db.Query(
-			"UPDATE `users` SET `first_name` = ?, `last_name` = ?, `email` = ? WHERE `id` = ?;",
-			pf_first_name, pf_last_name, pf_email, this.user.A_id)
-		if err != nil {
-			this.msg_error(err.Error())
-			return
-		}
-	}
-
-	// Reload current page
-	this.write(`window.location.reload(false);`)
-}

+ 0 - 104
.bak/engine/actions/actions.go

@@ -1,104 +0,0 @@
-package actions
-
-import (
-	"database/sql"
-	_ "github.com/go-sql-driver/mysql"
-
-	"errors"
-	"fmt"
-	"reflect"
-	"strings"
-
-	"golang-fave/engine/wrapper"
-
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-type Action struct {
-	wrapper *wrapper.Wrapper
-	db      *sql.DB
-	user    *utils.MySql_user
-}
-
-func (this *Action) write(data string) {
-	(*this.wrapper.W).Write([]byte(data))
-}
-
-func (this *Action) msg_success(msg string) {
-	this.write(fmt.Sprintf(
-		`ShowSystemMsgSuccess('Success!', '%s', false);`,
-		strings.Replace(strings.Replace(msg, `'`, `’`, -1), `"`, `”`, -1)))
-}
-
-func (this *Action) msg_error(msg string) {
-	this.write(fmt.Sprintf(
-		`ShowSystemMsgError('Error!', '%s', true);`,
-		strings.Replace(strings.Replace(msg, `'`, `’`, -1), `"`, `”`, -1)))
-}
-
-func (this *Action) use_database() error {
-	if this.db != nil {
-		return errors.New("already connected to database")
-	}
-	if !utils.IsMySqlConfigExists(this.wrapper.DirVHostHome) {
-		return errors.New("can't read database configuration file")
-	}
-	mc, err := utils.MySqlConfigRead(this.wrapper.DirVHostHome)
-	if err != nil {
-		return err
-	}
-	this.db, err = sql.Open("mysql", mc.User+":"+mc.Password+"@tcp("+mc.Host+":"+mc.Port+")/"+mc.Name)
-	if err != nil {
-		return err
-	}
-	err = this.db.Ping()
-	if err != nil {
-		this.db.Close()
-		return err
-	}
-	return nil
-}
-
-func (this *Action) load_session_user() error {
-	if this.db == nil {
-		return errors.New("not connected to database")
-	}
-	if this.user != nil {
-		return errors.New("user already loaded")
-	}
-	if this.wrapper.Session.GetIntDef("UserId", 0) <= 0 {
-		return errors.New("session user id is not defined")
-	}
-	this.user = &utils.MySql_user{}
-	err := this.db.QueryRow("SELECT `id`, `first_name`, `last_name`, `email`, `password` FROM `users` WHERE `id` = ? LIMIT 1;", this.wrapper.Session.GetIntDef("UserId", 0)).Scan(
-		&this.user.A_id, &this.user.A_first_name, &this.user.A_last_name, &this.user.A_email, &this.user.A_password)
-	if err != nil {
-		return err
-	}
-	if this.user.A_id != this.wrapper.Session.GetIntDef("UserId", 0) {
-		return errors.New("can't load user from session user id")
-	}
-	return nil
-}
-
-func New(wrapper *wrapper.Wrapper) *Action {
-	return &Action{wrapper, nil, nil}
-}
-
-func (this *Action) Run() bool {
-	if this.wrapper.R.Method != "POST" {
-		return false
-	}
-	if err := this.wrapper.R.ParseForm(); err == nil {
-		action := this.wrapper.R.FormValue("action")
-		if action != "" {
-			if _, ok := reflect.TypeOf(this).MethodByName("Action_" + action); ok {
-				(*this.wrapper.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-				(*this.wrapper.W).Header().Set("Content-Type", "text/html; charset=utf-8")
-				reflect.ValueOf(this).MethodByName("Action_" + action).Call([]reflect.Value{})
-				return true
-			}
-		}
-	}
-	return false
-}

+ 0 - 131
.bak/engine/backend/backend.go

@@ -1,131 +0,0 @@
-package backend
-
-import (
-	"database/sql"
-	_ "github.com/go-sql-driver/mysql"
-	"html/template"
-
-	"golang-fave/constants"
-	"golang-fave/engine/backend/modules"
-	"golang-fave/engine/wrapper"
-
-	templates "golang-fave/engine/wrapper/resources/templates"
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-type Backend struct {
-	wrapper *wrapper.Wrapper
-	db      *sql.DB
-	user    *utils.MySql_user
-	urls    *[]string
-}
-
-type TmplData struct {
-	Title              string
-	BodyClasses        string
-	UserId             int
-	UserFirstName      string
-	UserLastName       string
-	UserEmail          string
-	UserPassword       string
-	UserAvatarLink     string
-	NavBarModules      template.HTML
-	NavBarModulesSys   template.HTML
-	ModuleCurrentAlias string
-	SidebarLeft        template.HTML
-	Content            template.HTML
-	SidebarRight       template.HTML
-}
-
-func New(wrapper *wrapper.Wrapper, db *sql.DB, url_args *[]string) *Backend {
-	return &Backend{wrapper, db, nil, url_args}
-}
-
-func (this *Backend) Run() bool {
-	// Show add user form if no any user in db
-	var count int
-	err := this.db.QueryRow("SELECT COUNT(*) FROM `users`;").Scan(&count)
-	if this.wrapper.EngineErrMsgOnError(err) {
-		return true
-	}
-	if count <= 0 {
-		return this.wrapper.TmplBackEnd(templates.CpFirstUser, nil)
-	}
-
-	// Login page
-	if this.wrapper.Session.GetIntDef("UserId", 0) <= 0 {
-		return this.wrapper.TmplBackEnd(templates.CpLogin, nil)
-	}
-
-	// Load current user, if not, show login page
-	this.user = &utils.MySql_user{}
-	err = this.db.QueryRow("SELECT `id`, `first_name`, `last_name`, `email`, `password` FROM `users` WHERE `id` = ? LIMIT 1;", this.wrapper.Session.GetIntDef("UserId", 0)).Scan(
-		&this.user.A_id, &this.user.A_first_name, &this.user.A_last_name, &this.user.A_email, &this.user.A_password)
-	if this.wrapper.EngineErrMsgOnError(err) {
-		return true
-	}
-	if this.user.A_id != this.wrapper.Session.GetIntDef("UserId", 0) {
-		return this.wrapper.TmplBackEnd(templates.CpLogin, nil)
-	}
-
-	// Display cp page
-	body_class := "cp"
-
-	// Get module content here
-	page_content := ""
-	page_sb_right := ""
-
-	mdl := modules.New(this.wrapper, this.db, this.user, this.urls)
-	page_sb_left := mdl.GetSidebarLeft()
-	nav_bar_modules_all := mdl.GetNavMenuModules()
-	nav_bar_modules_sys := mdl.GetNavMenuModulesSys()
-
-	if mdl.Run() {
-		page_content = mdl.GetContent()
-		page_sb_right = mdl.GetSidebarRight()
-	}
-
-	// If right sidebar and content need to show
-	if page_sb_left != "" {
-		body_class = body_class + " cp-sidebar-left"
-	}
-	if page_content == "" {
-		body_class = body_class + " cp-404"
-		page_content = "Panel 404"
-	}
-	if page_sb_right != "" {
-		body_class = body_class + " cp-sidebar-right"
-	}
-
-	// Current module alias
-	malias := "index"
-	if len(*this.urls) >= 2 {
-		malias = (*this.urls)[1]
-	}
-
-	// Render page
-	page := this.wrapper.TmplParseToString(templates.CpBase, wrapper.TmplDataAll{
-		System: this.wrapper.TmplGetSystemData(),
-		Data: TmplData{
-			Title:              "Fave " + constants.ServerVersion,
-			BodyClasses:        body_class,
-			UserId:             this.user.A_id,
-			UserFirstName:      this.user.A_first_name,
-			UserLastName:       this.user.A_last_name,
-			UserEmail:          this.user.A_email,
-			UserPassword:       "",
-			UserAvatarLink:     "https://s.gravatar.com/avatar/" + utils.GetMd5(this.user.A_email) + "?s=80&r=g",
-			NavBarModules:      template.HTML(nav_bar_modules_all),
-			NavBarModulesSys:   template.HTML(nav_bar_modules_sys),
-			ModuleCurrentAlias: malias,
-			SidebarLeft:        template.HTML(page_sb_left),
-			Content:            template.HTML(page_content),
-			SidebarRight:       template.HTML(page_sb_right),
-		},
-	})
-	(*this.wrapper.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-	(*this.wrapper.W).Write([]byte(page))
-	return true
-
-	return false
-}

+ 0 - 50
.bak/engine/backend/modules/module_empty.go

@@ -1,50 +0,0 @@
-package modules
-
-/*
-import (
-	others "golang-fave/engine/wrapper/resources/others"
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-func (this *Module) Module_empty() {
-	// Do something here...
-}
-
-func (this *Module) Module_empty_display() bool {
-	return true
-}
-
-func (this *Module) Module_empty_alias() string {
-	return "empty"
-}
-
-func (this *Module) Module_empty_name() string {
-	return "Empty module"
-}
-
-func (this *Module) Module_empty_icon() string {
-	return others.File_assets_sys_svg_gear
-}
-
-func (this *Module) Module_empty_order() int {
-	return 2
-}
-
-func (this *Module) Module_empty_submenu() []utils.ModuleSubMenu {
-	result := make([]utils.ModuleSubMenu, 0)
-	result = append(result, utils.ModuleSubMenu{
-		Alias: "default",
-		Name:  "Sub-menu item",
-		Icon:  others.File_assets_sys_svg_list,
-	})
-	return result
-}
-
-func (this *Module) Module_empty_content() string {
-	return "Empty module content"
-}
-
-func (this *Module) Module_empty_sidebar() string {
-	return "Empty module right sidebar"
-}
-*/

+ 0 - 53
.bak/engine/backend/modules/module_index.go

@@ -1,53 +0,0 @@
-package modules
-
-import (
-	others "golang-fave/engine/wrapper/resources/others"
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-func (this *Module) Module_index() {
-	// Do something here...
-}
-
-func (this *Module) Module_index_display() bool {
-	return true
-}
-
-func (this *Module) Module_index_alias() string {
-	return "index"
-}
-
-func (this *Module) Module_index_name() string {
-	return "Pages"
-}
-
-func (this *Module) Module_index_icon() string {
-	return others.File_assets_sys_svg_page
-}
-
-func (this *Module) Module_index_order() int {
-	return 1
-}
-
-func (this *Module) Module_index_submenu() []utils.ModuleSubMenu {
-	result := make([]utils.ModuleSubMenu, 0)
-	result = append(result, utils.ModuleSubMenu{
-		Alias: "default",
-		Name:  "List of pages",
-		Icon:  others.File_assets_sys_svg_list,
-	})
-	result = append(result, utils.ModuleSubMenu{
-		Alias: "modify",
-		Name:  "Add new page",
-		Icon:  others.File_assets_sys_svg_plus,
-	})
-	return result
-}
-
-func (this *Module) Module_index_content() string {
-	return "Index content"
-}
-
-func (this *Module) Module_index_sidebar() string {
-	return "Index right sidebar"
-}

+ 0 - 48
.bak/engine/backend/modules/module_settings.go

@@ -1,48 +0,0 @@
-package modules
-
-import (
-	others "golang-fave/engine/wrapper/resources/others"
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-func (this *Module) Module_settings() {
-	// Do something here...
-}
-
-func (this *Module) Module_settings_display() bool {
-	return false
-}
-
-func (this *Module) Module_settings_alias() string {
-	return "settings"
-}
-
-func (this *Module) Module_settings_name() string {
-	return "Settings"
-}
-
-func (this *Module) Module_settings_icon() string {
-	return others.File_assets_sys_svg_gear
-}
-
-func (this *Module) Module_settings_order() int {
-	return 101
-}
-
-func (this *Module) Module_settings_submenu() []utils.ModuleSubMenu {
-	result := make([]utils.ModuleSubMenu, 0)
-	result = append(result, utils.ModuleSubMenu{
-		Alias: "default",
-		Name:  "Main settings",
-		Icon:  others.File_assets_sys_svg_gear,
-	})
-	return result
-}
-
-func (this *Module) Module_settings_content() string {
-	return "Settings content"
-}
-
-func (this *Module) Module_settings_sidebar() string {
-	return `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Save</button>`
-}

+ 0 - 115
.bak/engine/backend/modules/module_users.go

@@ -1,115 +0,0 @@
-package modules
-
-import (
-	"html"
-
-	others "golang-fave/engine/wrapper/resources/others"
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-func (this *Module) Module_users() {
-	// Do something here...
-}
-
-func (this *Module) Module_users_display() bool {
-	return false
-}
-
-func (this *Module) Module_users_alias() string {
-	return "users"
-}
-
-func (this *Module) Module_users_name() string {
-	return "Users"
-}
-
-func (this *Module) Module_users_icon() string {
-	return others.File_assets_sys_svg_user
-}
-
-func (this *Module) Module_users_order() int {
-	return 100
-}
-
-func (this *Module) Module_users_submenu() []utils.ModuleSubMenu {
-	result := make([]utils.ModuleSubMenu, 0)
-	result = append(result, utils.ModuleSubMenu{
-		Alias: "default",
-		Name:  "List of users",
-		Icon:  others.File_assets_sys_svg_list,
-	})
-	result = append(result, utils.ModuleSubMenu{
-		Alias: "modify",
-		Name:  "Add new user",
-		Icon:  others.File_assets_sys_svg_plus,
-	})
-	return result
-}
-
-func (this *Module) Module_users_content() string {
-	if this.smod == "default" {
-		breadcrumb := this.breadcrumb([]dataBreadcrumb{
-			{"List of users", ""},
-		})
-		data_table := this.data_table("users", "email", "ASC", []dataTableRow{
-			{"id", "", nil},
-			{"email", "Email", func(values *[]string) string {
-				email := `<a href="/cp/users/modify/` + (*values)[0] + `/">` + html.EscapeString((*values)[1]) + `</a>`
-				name := html.EscapeString((*values)[2])
-				if name != "" && (*values)[3] != "" {
-					name += ` ` + (*values)[3]
-				}
-				if name != "" {
-					name = `<div><small>` + name + `</small></div>`
-				}
-				return `<div>` + email + `</div>` + name
-			}},
-			{"first_name", "", nil},
-			{"last_name", "", nil},
-		}, func(values *[]string) string {
-			return `<a class="ico" href="/cp/users/modify/` + (*values)[0] + `/">` +
-				others.File_assets_sys_svg_edit + `</a>` +
-				`<a class="ico" href="#">` + others.File_assets_sys_svg_remove + `</a>`
-		}, "/cp/users/default/")
-		return breadcrumb + data_table
-	} else if this.smod == "modify" && this.imod == 0 {
-		breadcrumb := this.breadcrumb([]dataBreadcrumb{
-			{"Add new user", ""},
-		})
-		data_form := this.data_form([]dataFormField{
-			{kind: dfkHidden, name: "action", value: "users_add"},
-			{kind: dfkHidden, name: "id", value: "0"},
-			{kind: dfkText, caption: "User first name", name: "first_name"},
-			{kind: dfkText, caption: "User last name", name: "last_name"},
-			{kind: dfkEmail, caption: "User email", name: "email", required: true},
-			{kind: dfkPassword, caption: "User password", name: "password", hint: "Please specify new user password", required: true},
-			{kind: dfkSubmit, value: "Add", target: "add-edit-button"},
-		})
-		return breadcrumb + data_form
-	} else if this.smod == "modify" && this.imod != 0 {
-		breadcrumb := this.breadcrumb([]dataBreadcrumb{
-			{"Edit user", ""},
-		})
-		// Load user data
-		data_form := this.data_form([]dataFormField{
-			{kind: dfkHidden, name: "action", value: "users_edit"},
-			{kind: dfkHidden, name: "id", value: "0"},
-			{kind: dfkText, caption: "User first name", name: "first_name", value: "1"},
-			{kind: dfkText, caption: "User last name", name: "last_name", value: "2"},
-			{kind: dfkEmail, caption: "User email", name: "email", value: "3", required: true},
-			{kind: dfkPassword, caption: "User password", name: "password", hint: "Leave the field blank to not change the password"},
-			{kind: dfkSubmit, value: "Add", target: "add-edit-button"},
-		})
-		return breadcrumb + data_form
-	}
-	return ""
-}
-
-func (this *Module) Module_users_sidebar() string {
-	if this.smod == "modify" && this.imod == 0 {
-		return `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Add</button>`
-	} else if this.smod == "modify" && this.imod != 0 {
-		return `<button class="btn btn-primary btn-sidebar" id="add-edit-button">Save</button>`
-	}
-	return ""
-}

+ 0 - 465
.bak/engine/backend/modules/modules.go

@@ -1,465 +0,0 @@
-package modules
-
-import (
-	"database/sql"
-	_ "github.com/go-sql-driver/mysql"
-
-	"fmt"
-	"html"
-	"math"
-	"reflect"
-	"sort"
-	"strconv"
-	"strings"
-
-	"golang-fave/engine/wrapper"
-
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-type dataTableDisplay func(values *[]string) string
-
-type dataTableAction func(values *[]string) string
-
-type dataTableRow struct {
-	dbField     string
-	nameInTable string
-	display     dataTableDisplay
-}
-
-type dataBreadcrumb struct {
-	name string
-	link string
-}
-
-const (
-	dfkHidden = iota
-	dfkText
-	dfkEmail
-	dfkPassword
-	dfkTextArea
-	dfkSubmit
-)
-
-type dataFormFieldOption struct {
-	caption string
-	value   string
-}
-
-type dataFormFieldHook func(field *dataFormField) string
-
-type dataFormField struct {
-	caption     string
-	kind        int
-	name        string
-	value       string
-	placeholder string
-	hint        string
-	target      string
-	required    bool
-	options     []dataFormFieldOption
-	hook        dataFormFieldHook
-}
-
-type ModuleItem struct {
-	Alias   string
-	Display bool
-	Name    string
-	Icon    string
-	Order   int
-}
-
-type Module struct {
-	wrapper *wrapper.Wrapper
-	db      *sql.DB
-	user    *utils.MySql_user
-	urls    *[]string
-	mmod    string
-	smod    string
-	imod    int
-	modlist []ModuleItem
-}
-
-func (this *Module) module_get_display(name string) bool {
-	mname := "Module_" + name + "_display"
-	if _, ok := reflect.TypeOf(this).MethodByName(mname); ok {
-		result := reflect.ValueOf(this).MethodByName(mname).Call([]reflect.Value{})
-		return result[0].Bool()
-	}
-	return false
-}
-
-func (this *Module) module_get_name(name string) string {
-	mname := "Module_" + name + "_name"
-	if _, ok := reflect.TypeOf(this).MethodByName(mname); ok {
-		result := reflect.ValueOf(this).MethodByName(mname).Call([]reflect.Value{})
-		return result[0].String()
-	}
-	return ""
-}
-
-func (this *Module) module_get_icon(name string) string {
-	mname := "Module_" + name + "_icon"
-	if _, ok := reflect.TypeOf(this).MethodByName(mname); ok {
-		result := reflect.ValueOf(this).MethodByName(mname).Call([]reflect.Value{})
-		return result[0].String()
-	}
-	return ""
-}
-
-func (this *Module) module_get_order(name string) int {
-	mname := "Module_" + name + "_order"
-	if _, ok := reflect.TypeOf(this).MethodByName(mname); ok {
-		result := reflect.ValueOf(this).MethodByName(mname).Call([]reflect.Value{})
-		return int(result[0].Int())
-	}
-	return 0
-}
-
-func (this *Module) module_get_submenu(name string) string {
-	mname := "Module_" + name + "_submenu"
-	if _, ok := reflect.TypeOf(this).MethodByName(mname); ok {
-		result := reflect.ValueOf(this).MethodByName(mname).Call([]reflect.Value{})
-		result_array := result[0].Interface().([]utils.ModuleSubMenu)
-		result_html := ""
-		for _, value := range result_array {
-			class := ""
-			if name == this.mmod && value.Alias == this.smod && this.imod == 0 {
-				class = " active"
-			}
-			result_html += `<li class="nav-item` + class + `"><a class="nav-link" href="/cp/` + name + `/` + value.Alias + `/">` + value.Icon + value.Name + `</a></li>`
-		}
-		if result_html != "" {
-			result_html = `<ul class="nav flex-column">` + result_html + `</ul>`
-		}
-		return result_html
-	}
-	return ""
-}
-
-func (this *Module) module_get_list_of_modules() *[]ModuleItem {
-	if len(this.modlist) <= 0 {
-		t := reflect.TypeOf(this)
-		for i := 0; i < t.NumMethod(); i++ {
-			m := t.Method(i)
-			if strings.HasPrefix(m.Name, "Module_") && strings.HasSuffix(m.Name, "_alias") {
-				alias := m.Name[7:]
-				alias = alias[0 : len(alias)-6]
-				this.modlist = append(this.modlist, ModuleItem{
-					alias,
-					this.module_get_display(alias),
-					this.module_get_name(alias),
-					this.module_get_icon(alias),
-					this.module_get_order(alias),
-				})
-			}
-		}
-		sort.Slice(this.modlist, func(i, j int) bool {
-			return this.modlist[i].Order < this.modlist[j].Order
-		})
-	}
-	return &this.modlist
-}
-
-func (this *Module) breadcrumb(data []dataBreadcrumb) string {
-	result := ``
-	result += `<nav aria-label="breadcrumb">`
-	result += `<ol class="breadcrumb">`
-	result += `<li class="breadcrumb-item"><a href="/cp/` + this.mmod + `/">` + html.EscapeString(this.module_get_name(this.mmod)) + `</a></li>`
-	for _, item := range data {
-		if item.link == "" {
-			result += `<li class="breadcrumb-item active" aria-current="page">` + html.EscapeString(item.name) + `</li>`
-		} else {
-			result += `<li class="breadcrumb-item"><a href="` + item.link + `">` + html.EscapeString(item.name) + `</a></li>`
-		}
-	}
-	result += `</ol>`
-	result += `</nav>`
-	return result
-}
-
-func (this *Module) data_table(table string, order_by string, order_way string, data []dataTableRow, action dataTableAction, pagination_url string) string {
-	var num int
-	err := this.db.QueryRow("SELECT COUNT(*) FROM `" + table + "`;").Scan(&num)
-	if err != nil {
-		return ""
-	}
-	pear_page := 10
-	max_pages := int(math.Ceil(float64(num) / float64(pear_page)))
-	curr_page := 1
-	p := this.wrapper.R.URL.Query().Get("p")
-	if p != "" {
-		pi, err := strconv.Atoi(p)
-		if err != nil {
-			curr_page = 1
-		} else {
-			if pi < 1 {
-				curr_page = 1
-			} else if pi > max_pages {
-				curr_page = max_pages
-			} else {
-				curr_page = pi
-			}
-		}
-	}
-	limit_offset := curr_page*pear_page - pear_page
-	result := `<table class="table data-table table-striped table-bordered table-hover table_` + table + `">`
-	result += `<thead>`
-	result += `<tr>`
-	sql := "SELECT"
-	for i, column := range data {
-		if column.nameInTable != "" {
-			result += `<th scope="col" class="col_` + column.dbField + `">` + html.EscapeString(column.nameInTable) + `</th>`
-		}
-		sql += " `" + column.dbField + "`"
-		if i+1 < len(data) {
-			sql += ","
-		}
-	}
-	sql += " FROM `" + table + "` ORDER BY `" + order_by + "` " + order_way + " LIMIT ?, ?;"
-	if action != nil {
-		result += `<th scope="col" class="col_action">&nbsp;</th>`
-	}
-	result += `</tr>`
-	result += `</thead>`
-	result += `<tbody>`
-	rows, err := this.db.Query(sql, limit_offset, pear_page)
-	if err == nil {
-		values := make([]string, len(data))
-		scan := make([]interface{}, len(values))
-		for i := range values {
-			scan[i] = &values[i]
-		}
-		for rows.Next() {
-			err = rows.Scan(scan...)
-			if err == nil {
-				result += `<tr>`
-				for i, val := range values {
-					if data[i].nameInTable != "" {
-						if data[i].display == nil {
-							result += `<td class="col_` + data[i].dbField + `">` + html.EscapeString(string(val)) + `</td>`
-						} else {
-							result += `<td class="col_` + data[i].dbField + `">` + data[i].display(&values) + `</td>`
-						}
-					}
-				}
-				if action != nil {
-					result += `<td class="col_action">` + action(&values) + `</td>`
-				}
-				result += `</tr>`
-			}
-		}
-	}
-	result += `</tbody></table>`
-	result += `<nav>`
-	result += `<ul class="pagination" style="margin-bottom:0px;">`
-	class := ""
-	if curr_page <= 1 {
-		class = " disabled"
-	}
-	result += `<li class="page-item` + class + `">`
-	result += `<a class="page-link" href="` + pagination_url + `?p=` + fmt.Sprintf("%d", curr_page-1) + `" aria-label="Previous">`
-	result += `<span aria-hidden="true">&laquo;</span>`
-	result += `<span class="sr-only">Previous</span>`
-	result += `</a>`
-	result += `</li>`
-	for i := 1; i <= max_pages; i++ {
-		class = ""
-		if i == curr_page {
-			class = " active"
-		}
-		result += `<li class="page-item` + class + `">`
-		result += `<a class="page-link" href="` + pagination_url + `?p=` + fmt.Sprintf("%d", i) + `">` + fmt.Sprintf("%d", i) + `</a>`
-		result += `</li>`
-	}
-	class = ""
-	if curr_page >= max_pages {
-		class = " disabled"
-	}
-	result += `<li class="page-item` + class + `">`
-	result += `<a class="page-link" href="` + pagination_url + `?p=` + fmt.Sprintf("%d", curr_page+1) + `" aria-label="Next">`
-	result += `<span aria-hidden="true">&raquo;</span>`
-	result += `<span class="sr-only">Next</span>`
-	result += `</a>`
-	result += `</li>`
-	result += `</ul>`
-	result += `</nav>`
-	return result
-}
-
-func (this *Module) data_form(data []dataFormField) string {
-	result := `<form class="data-form" action="/cp/" method="post" autocomplete="off">`
-	result += `<div class="hidden">`
-	for _, field := range data {
-		if field.kind == dfkHidden {
-			if field.hook != nil {
-				result += field.hook(&field)
-			} else {
-				result += `<input type="hidden" name="` + field.name + `" value="` + html.EscapeString(field.value) + `">`
-			}
-		}
-	}
-	result += `</div>`
-	for _, field := range data {
-		if field.kind != dfkHidden && field.kind != dfkSubmit {
-			if field.hook != nil {
-				result += field.hook(&field)
-			} else {
-				required := ``
-				if field.required {
-					required = ` required`
-				}
-				result += `<div class="form-group">`
-				result += `<div class="row">`
-				result += `<div class="col-3">`
-				result += `<label for="lbl_` + field.name + `">` + field.caption + `</label>`
-				result += `</div>`
-				result += `<div class="col-9">`
-				result += `<div>`
-				if field.kind == dfkText {
-					result += `<input class="form-control" type="text" id="lbl_` + field.name + `" name="` + field.name + `" value="` + html.EscapeString(field.value) + `" placeholder="` + field.placeholder + `" autocomplete="off"` + required + `>`
-				} else if field.kind == dfkEmail {
-					result += `<input class="form-control" type="email" id="lbl_` + field.name + `" name="` + field.name + `" value="` + html.EscapeString(field.value) + `" placeholder="` + field.placeholder + `" autocomplete="off"` + required + `>`
-				} else if field.kind == dfkPassword {
-					result += `<input class="form-control" type="password" id="lbl_` + field.name + `" name="` + field.name + `" value="` + html.EscapeString(field.value) + `" placeholder="` + field.placeholder + `" autocomplete="off"` + required + `>`
-				} else if field.kind == dfkTextArea {
-					result += `<textarea class="form-control" id="lbl_` + field.name + `" name="` + field.name + `" placeholder="` + field.placeholder + `" autocomplete="off"` + required + `>` + html.EscapeString(field.value) + `</textarea>`
-				}
-				result += `</div>`
-				if field.hint != "" {
-					result += `<div><small>` + field.hint + `</small></div>`
-				}
-				result += `</div>`
-				result += `</div>`
-				result += `</div>`
-			}
-		}
-	}
-	for _, field := range data {
-		if field.kind == dfkSubmit {
-			if field.hook != nil {
-				result += field.hook(&field)
-			} else {
-				result += `<div class="row hidden">`
-				result += `<div class="col-3">`
-				result += `&nbsp;`
-				result += `</div>`
-				result += `<div class="col-9">`
-				result += `<button type="submit" class="btn btn-primary" data-target="` + field.target + `">` + html.EscapeString(field.value) + `</button>`
-				result += `</div>`
-				result += `</div>`
-			}
-		}
-	}
-	result += `</form>`
-	return result
-}
-
-func New(wrapper *wrapper.Wrapper, db *sql.DB, user *utils.MySql_user, url_args *[]string) *Module {
-	mmod := "index"
-	smod := "default"
-	imod := 0
-	if len(*url_args) >= 2 {
-		mmod = (*url_args)[1]
-	}
-	if len(*url_args) >= 3 {
-		smod = (*url_args)[2]
-	}
-	if len(*url_args) >= 4 {
-		if val, err := strconv.Atoi((*url_args)[3]); err == nil {
-			imod = val
-		}
-	}
-	return &Module{wrapper, db, user, url_args, mmod, smod, imod, make([]ModuleItem, 0)}
-}
-
-func (this *Module) Run() bool {
-	mname := "Module_" + this.mmod
-	if _, ok := reflect.TypeOf(this).MethodByName(mname); ok {
-		reflect.ValueOf(this).MethodByName(mname).Call([]reflect.Value{})
-		return true
-	}
-	return false
-}
-
-func (this *Module) GetNavMenuModules() string {
-	html := ""
-	list := this.module_get_list_of_modules()
-	for _, value := range *list {
-		if value.Display {
-			class := ""
-			if value.Alias == this.mmod {
-				class = " active"
-			}
-			html += `<a class="dropdown-item` + class + `" href="/cp/` + value.Alias + `/">` + value.Name + `</a>`
-		}
-	}
-	return html
-}
-
-func (this *Module) GetNavMenuModulesSys() string {
-	html := ""
-	list := this.module_get_list_of_modules()
-	for _, value := range *list {
-		if !value.Display {
-			class := ""
-			if value.Alias == this.mmod {
-				class = " active"
-			}
-			html += `<a class="dropdown-item` + class + `" href="/cp/` + value.Alias + `/">` + value.Name + `</a>`
-		}
-	}
-	return html
-}
-
-func (this *Module) GetSidebarLeft() string {
-	list := this.module_get_list_of_modules()
-
-	modules_all := `<ul class="nav flex-column">`
-	for _, value := range *list {
-		if value.Display {
-			class := ""
-			submenu := ""
-			if value.Alias == this.mmod {
-				class = " active"
-				submenu = this.module_get_submenu(value.Alias)
-			}
-			modules_all += `<li class="nav-item` + class + `"><a class="nav-link" href="/cp/` + value.Alias + `/">` + value.Icon + value.Name + `</a>` + submenu + `</li>`
-		}
-	}
-	modules_all += `</ul>`
-
-	modules_sys := `<ul class="nav flex-column">`
-	for _, value := range *list {
-		if !value.Display {
-			class := ""
-			submenu := ""
-			if value.Alias == this.mmod {
-				class = " active"
-				submenu = this.module_get_submenu(value.Alias)
-			}
-			modules_sys += `<li class="nav-item` + class + `"><a class="nav-link" href="/cp/` + value.Alias + `/">` + value.Icon + value.Name + `</a>` + submenu + `</li>`
-		}
-	}
-	modules_sys += `</ul>`
-
-	return modules_all + `<div class="dropdown-divider"></div>` + modules_sys
-}
-
-func (this *Module) GetContent() string {
-	mname := "Module_" + this.mmod + "_content"
-	if _, ok := reflect.TypeOf(this).MethodByName(mname); ok {
-		result := reflect.ValueOf(this).MethodByName(mname).Call([]reflect.Value{})
-		return result[0].String()
-	}
-	return ""
-}
-
-func (this *Module) GetSidebarRight() string {
-	mname := "Module_" + this.mmod + "_sidebar"
-	if _, ok := reflect.TypeOf(this).MethodByName(mname); ok {
-		result := reflect.ValueOf(this).MethodByName(mname).Call([]reflect.Value{})
-		return result[0].String()
-	}
-	return ""
-}

+ 0 - 58
.bak/engine/frontend/frontend.go

@@ -1,58 +0,0 @@
-package frontend
-
-import (
-	"database/sql"
-	_ "github.com/go-sql-driver/mysql"
-
-	"golang-fave/engine/wrapper"
-
-	utils "golang-fave/engine/wrapper/utils"
-)
-
-// --- Demo
-type MenuItem struct {
-	Name   string
-	Link   string
-	Active bool
-}
-
-type TmplData struct {
-	MetaTitle       string
-	MetaKeywords    string
-	MetaDescription string
-	MenuItems       []MenuItem
-}
-
-// --------
-
-type Frontend struct {
-	wrapper *wrapper.Wrapper
-	db      *sql.DB
-	user    *utils.MySql_user
-	urls    *[]string
-}
-
-func New(wrapper *wrapper.Wrapper, db *sql.DB, url_args *[]string) *Frontend {
-	return &Frontend{wrapper, db, nil, url_args}
-}
-
-func (this *Frontend) Run() bool {
-	// --- Demo
-	if this.wrapper.R.URL.Path == "/" {
-		return this.wrapper.TmplFrontEnd("index", TmplData{
-			MetaTitle:       "Meta Title",
-			MetaKeywords:    "Meta Keywords",
-			MetaDescription: "Meta Description",
-
-			MenuItems: []MenuItem{
-				{Name: "Home", Link: "/", Active: true},
-				{Name: "Item 1", Link: "/#1", Active: false},
-				{Name: "Item 2", Link: "/#2", Active: false},
-				{Name: "Item 3", Link: "/#3", Active: false},
-			},
-		})
-	}
-	// --------
-
-	return false
-}

+ 0 - 218
.bak/engine/sessions/sessions.go

@@ -1,218 +0,0 @@
-package sessions
-
-import (
-	"crypto/sha1"
-	"encoding/json"
-	"errors"
-	"fmt"
-	"math/rand"
-	"net/http"
-	"os"
-	"strconv"
-	"time"
-)
-
-type Vars struct {
-	Int    map[string]int
-	String map[string]string
-	Bool   map[string]bool
-}
-
-type Session struct {
-	W            *http.ResponseWriter
-	R            *http.Request
-	VHost        string
-	DirVHostHome string
-	RemoteIp     string
-	vars         *Vars
-	ident        string
-	changed      bool
-}
-
-func New(w *http.ResponseWriter, r *http.Request, vhost string, vhosthome string, remoteip string) *Session {
-	return &Session{w, r, vhost, vhosthome, remoteip, &Vars{}, "", false}
-}
-
-func (this *Session) Load() {
-	var session, err = this.R.Cookie("fsession")
-	if err == nil && len(session.Value) == 40 {
-		// Load session
-		this.ident = session.Value
-		StartNewSession := true
-		fsessfile := this.DirVHostHome + "/tmp/" + this.ident
-		file, ferr := os.Open(fsessfile)
-		if ferr == nil {
-			defer file.Close()
-			dec := json.NewDecoder(file)
-			ferr = dec.Decode(&this.vars)
-			if ferr == nil {
-				StartNewSession = false
-			}
-		}
-		if StartNewSession {
-			sessdata := Vars{}
-			sessdata.Int = map[string]int{}
-			sessdata.String = map[string]string{}
-			sessdata.Bool = map[string]bool{}
-			this.vars = &sessdata
-			this.changed = true
-		}
-	} else {
-		// Create new session
-		// Generate unique hash
-		rand.Seed(time.Now().Unix())
-		rnd := rand.Intn(9999999-99) + 99
-		userstr := this.VHost + this.RemoteIp + this.R.Header.Get("User-Agent") +
-			strconv.FormatInt((int64(time.Now().Unix())), 10) +
-			strconv.FormatInt(int64(rnd), 10)
-		userhashstr := fmt.Sprintf("%x", sha1.Sum([]byte(userstr)))
-		this.ident = userhashstr
-
-		// Try to create session file
-		sessdata := Vars{}
-		sessdata.Int = map[string]int{}
-		sessdata.String = map[string]string{}
-		sessdata.Bool = map[string]bool{}
-		this.vars = &sessdata
-		this.changed = true
-
-		// Set session cookie
-		expiration := time.Now().Add(365 * 24 * time.Hour)
-		cookie := http.Cookie{
-			Name:     "fsession",
-			Value:    userhashstr,
-			Path:     "/",
-			Expires:  expiration,
-			HttpOnly: true,
-		}
-		http.SetCookie(*this.W, &cookie)
-	}
-}
-
-func (this *Session) Save() bool {
-	if !this.changed {
-		return false
-	}
-	fsessfile := this.DirVHostHome + "/tmp/" + this.ident
-	r, err := json.Marshal(this.vars)
-	if err == nil {
-		file, ferr := os.Create(fsessfile)
-		if ferr == nil {
-			defer file.Close()
-			_, ferr = file.Write(r)
-			if ferr == nil {
-				this.changed = false
-				return true
-			}
-		}
-	}
-	return false
-}
-
-func (this *Session) IsSetInt(name string) bool {
-	if _, ok := this.vars.Int[name]; ok {
-		return true
-	} else {
-		return false
-	}
-}
-
-func (this *Session) IsSetString(name string) bool {
-	if _, ok := this.vars.String[name]; ok {
-		return true
-	} else {
-		return false
-	}
-}
-
-func (this *Session) IsSetBool(name string) bool {
-	if _, ok := this.vars.Bool[name]; ok {
-		return true
-	} else {
-		return false
-	}
-}
-
-func (this *Session) SetInt(name string, value int) {
-	this.vars.Int[name] = value
-	this.changed = true
-}
-
-func (this *Session) SetString(name string, value string) {
-	this.vars.String[name] = value
-	this.changed = true
-}
-
-func (this *Session) SetBool(name string, value bool) {
-	this.vars.Bool[name] = value
-	this.changed = true
-}
-
-func (this *Session) GetInt(name string) (int, error) {
-	if this.IsSetInt(name) {
-		return this.vars.Int[name], nil
-	} else {
-		return 0, errors.New("Variable is not found")
-	}
-}
-
-func (this *Session) GetString(name string) (string, error) {
-	if this.IsSetString(name) {
-		return this.vars.String[name], nil
-	} else {
-		return "", errors.New("Variable is not found")
-	}
-}
-
-func (this *Session) GetBool(name string) (bool, error) {
-	if this.IsSetBool(name) {
-		return this.vars.Bool[name], nil
-	} else {
-		return false, errors.New("Variable is not found")
-	}
-}
-
-func (this *Session) GetIntDef(name string, def int) int {
-	if this.IsSetInt(name) {
-		return this.vars.Int[name]
-	} else {
-		return def
-	}
-}
-
-func (this *Session) GetStringDef(name string, def string) string {
-	if this.IsSetString(name) {
-		return this.vars.String[name]
-	} else {
-		return def
-	}
-}
-
-func (this *Session) GetBoolDef(name string, def bool) bool {
-	if this.IsSetBool(name) {
-		return this.vars.Bool[name]
-	} else {
-		return def
-	}
-}
-
-func (this *Session) DelInt(name string) {
-	if this.IsSetInt(name) {
-		delete(this.vars.Int, name)
-		this.changed = true
-	}
-}
-
-func (this *Session) DelString(name string) {
-	if this.IsSetString(name) {
-		delete(this.vars.String, name)
-		this.changed = true
-	}
-}
-
-func (this *Session) DelBool(name string) {
-	if this.IsSetBool(name) {
-		delete(this.vars.Bool, name)
-		this.changed = true
-	}
-}

+ 0 - 38
.bak/engine/wrapper/redirects.go

@@ -1,38 +0,0 @@
-package wrapper
-
-import (
-	"io/ioutil"
-	"net/http"
-	"strings"
-)
-
-func (this *Wrapper) redirectToMainDomain() bool {
-	file, err := ioutil.ReadFile(this.DirVHostHome + "/config/domain")
-	if err == nil {
-		maindomain := strings.TrimSpace(string(file))
-		port := ""
-		if this.Port != "80" {
-			port = ":" + this.Port
-		}
-		if maindomain+port != this.R.Host {
-			http.Redirect(*this.W, this.R, this.R.URL.Scheme+"://"+maindomain+
-				port+this.R.URL.RequestURI(), 301)
-			return true
-		}
-	}
-	return false
-}
-
-func (this *Wrapper) redirectSeoFix() bool {
-	full := this.R.URL.RequestURI()
-	uris := full[len(this.R.URL.Path):]
-	if len(this.R.URL.Path) > 0 {
-		if this.R.URL.Path[len(this.R.URL.Path)-1] != '/' {
-			http.Redirect(*this.W, this.R, this.R.URL.Path+"/"+uris, 301)
-			return true
-		}
-	} else {
-		return false
-	}
-	return false
-}

BIN
.bak/engine/wrapper/resources/images/assets.sys.bg.png


+ 0 - 3
.bak/engine/wrapper/resources/images/assets.sys.bg.png.go

@@ -1,3 +0,0 @@
-package images
-
-var File_assets_sys_bg_png = []byte{137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 30, 0, 0, 0, 30, 1, 3, 0, 0, 0, 1, 254, 60, 225, 0, 0, 0, 6, 80, 76, 84, 69, 255, 255, 255, 255, 255, 255, 85, 124, 245, 108, 0, 0, 0, 2, 116, 82, 78, 83, 13, 36, 255, 62, 87, 164, 0, 0, 0, 48, 73, 68, 65, 84, 8, 215, 99, 104, 80, 224, 96, 96, 112, 16, 96, 97, 96, 80, 224, 96, 98, 96, 16, 96, 97, 100, 96, 0, 50, 26, 24, 128, 12, 7, 6, 32, 67, 129, 1, 200, 16, 96, 128, 43, 164, 135, 14, 0, 115, 128, 11, 236, 193, 23, 245, 239, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130}

BIN
.bak/engine/wrapper/resources/images/assets.sys.logo.png


File diff suppressed because it is too large
+ 0 - 2
.bak/engine/wrapper/resources/images/assets.sys.logo.png.go


BIN
.bak/engine/wrapper/resources/others/assets.sys.fave.ico


File diff suppressed because it is too large
+ 0 - 2
.bak/engine/wrapper/resources/others/assets.sys.fave.ico.go


+ 0 - 1
.bak/engine/wrapper/resources/others/assets.sys.logo.svg

@@ -1 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45" style="enable-background:new 0 0 45 45;" xml:space="preserve" version="1.1" id="svg2"><metadata id="metadata8"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/></cc:Work></rdf:RDF></metadata><defs id="defs6"><clipPath id="clipPath16" clipPathUnits="userSpaceOnUse"><path id="path18" d="M 0,36 36,36 36,0 0,0 0,36 Z"/></clipPath></defs><g transform="matrix(1.25,0,0,-1.25,0,45)" id="g10"><g id="g12"><g clip-path="url(#clipPath16)" id="g14"><g transform="translate(35.8848,24.1665)" id="g20"><path id="path22" style="fill:#FFF;fill-opacity:1;fill-rule:nonzero;stroke:none" d="m 0,0 c 0,5.45 -4.418,9.868 -9.867,9.868 -3.308,0 -6.227,-1.633 -8.018,-4.129 -1.79,2.496 -4.71,4.129 -8.017,4.129 -5.45,0 -9.868,-4.418 -9.868,-9.868 0,-0.772 0.098,-1.52 0.266,-2.241 1.371,-8.512 10.835,-17.494 17.619,-19.96 6.783,2.466 16.249,11.448 17.617,19.96 C -0.098,-1.52 0,-0.772 0,0"/></g></g></g></g></svg>

+ 0 - 3
.bak/engine/wrapper/resources/others/assets.sys.logo.svg.go

@@ -1,3 +0,0 @@
-package others
-
-var File_assets_sys_logo_svg = []byte(`<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45" style="enable-background:new 0 0 45 45;" xml:space="preserve" version="1.1" id="svg2"><metadata id="metadata8"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/></cc:Work></rdf:RDF></metadata><defs id="defs6"><clipPath id="clipPath16" clipPathUnits="userSpaceOnUse"><path id="path18" d="M 0,36 36,36 36,0 0,0 0,36 Z"/></clipPath></defs><g transform="matrix(1.25,0,0,-1.25,0,45)" id="g10"><g id="g12"><g clip-path="url(#clipPath16)" id="g14"><g transform="translate(35.8848,24.1665)" id="g20"><path id="path22" style="fill:#FFF;fill-opacity:1;fill-rule:nonzero;stroke:none" d="m 0,0 c 0,5.45 -4.418,9.868 -9.867,9.868 -3.308,0 -6.227,-1.633 -8.018,-4.129 -1.79,2.496 -4.71,4.129 -8.017,4.129 -5.45,0 -9.868,-4.418 -9.868,-9.868 0,-0.772 0.098,-1.52 0.266,-2.241 1.371,-8.512 10.835,-17.494 17.619,-19.96 6.783,2.466 16.249,11.448 17.617,19.96 C -0.098,-1.52 0,-0.772 0,0"/></g></g></g></g></svg>`)

+ 0 - 9
.bak/engine/wrapper/resources/others/assets.sys.svg.icons.go

@@ -1,9 +0,0 @@
-package others
-
-var File_assets_sys_svg_page = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"></path></svg>`
-var File_assets_sys_svg_list = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M2 13c0 .59 0 1-.59 1H.59C0 14 0 13.59 0 13c0-.59 0-1 .59-1h.81c.59 0 .59.41.59 1H2zm2.59-9h6.81c.59 0 .59-.41.59-1 0-.59 0-1-.59-1H4.59C4 2 4 2.41 4 3c0 .59 0 1 .59 1zM1.41 7H.59C0 7 0 7.41 0 8c0 .59 0 1 .59 1h.81c.59 0 .59-.41.59-1 0-.59 0-1-.59-1h.01zm0-5H.59C0 2 0 2.41 0 3c0 .59 0 1 .59 1h.81c.59 0 .59-.41.59-1 0-.59 0-1-.59-1h.01zm10 5H4.59C4 7 4 7.41 4 8c0 .59 0 1 .59 1h6.81c.59 0 .59-.41.59-1 0-.59 0-1-.59-1h.01zm0 5H4.59C4 12 4 12.41 4 13c0 .59 0 1 .59 1h6.81c.59 0 .59-.41.59-1 0-.59 0-1-.59-1h.01z"></path></svg>`
-var File_assets_sys_svg_plus = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M12 9H7v5H5V9H0V7h5V2h2v5h5v2z"></path></svg>`
-var File_assets_sys_svg_gear = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M14 8.77v-1.6l-1.94-.64-.45-1.09.88-1.84-1.13-1.13-1.81.91-1.09-.45-.69-1.92h-1.6l-.63 1.94-1.11.45-1.84-.88-1.13 1.13.91 1.81-.45 1.09L0 7.23v1.59l1.94.64.45 1.09-.88 1.84 1.13 1.13 1.81-.91 1.09.45.69 1.92h1.59l.63-1.94 1.11-.45 1.84.88 1.13-1.13-.92-1.81.47-1.09L14 8.75v.02zM7 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"></path></svg>`
-var File_assets_sys_svg_user = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M12 14.002a.998.998 0 0 1-.998.998H1.001A1 1 0 0 1 0 13.999V13c0-2.633 4-4 4-4s.229-.409 0-1c-.841-.62-.944-1.59-1-4 .173-2.413 1.867-3 3-3s2.827.586 3 3c-.056 2.41-.159 3.38-1 4-.229.59 0 1 0 1s4 1.367 4 4v1.002z"></path></svg>`
-var File_assets_sys_svg_edit = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M0 12v3h3l8-8-3-3-8 8zm3 2H1v-2h1v1h1v1zm10.3-9.3L12 6 9 3l1.3-1.3a.996.996 0 0 1 1.41 0l1.59 1.59c.39.39.39 1.02 0 1.41z"></path></svg>`
-var File_assets_sys_svg_remove = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 12H3V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9zm1-10H2V3h9v1z"></path></svg>`

+ 0 - 126
.bak/engine/wrapper/resources/scripts/assets.cp.scripts.js

@@ -1,126 +0,0 @@
-function GetModalAlertTmpl(title, message, error) {
-	return '<div class="alert alert-' + (!error?'success':'danger') + ' alert-dismissible fade show" role="alert"><strong>' + title + '</strong> ' + message + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>';
-}
-
-function ShowSystemMsg(title, message, error) {
-	var modal_alert_place = $('.modal.show .sys-messages');
-	if(!modal_alert_place.length) {
-		modal_alert_place = $('form.alert-here .sys-messages');
-	}
-	if(modal_alert_place.length) {
-		modal_alert_place.html(GetModalAlertTmpl(title, message, error));
-	}
-}
-
-function ShowSystemMsgSuccess(title, message) {
-	ShowSystemMsg(title, message, false);
-}
-
-function ShowSystemMsgError(title, message) {
-	ShowSystemMsg(title, message, true);
-}
-
-function AjaxDone(data) {
-	try {
-		eval(data);
-	} catch(e) {
-		if(e instanceof SyntaxError) {
-			console.log(data);
-			console.log('JavaScript Eval Error', e.message)
-		}
-	}
-}
-
-function AjaxFail() {
-	console.log('Form send fail, page will be reloaded');
-	window.location.reload(false);
-}
-
-function ActionSingOut() {
-	$.ajax({
-		type: "POST",
-		url: '/cp/',
-		data: {
-			action: 'singout',
-		}
-	}).done(function(data) {
-		AjaxDone(data)
-	}).fail(function() {
-		AjaxFail();
-	});
-}
-
-$(document).ready(function() {
-	// Ajax forms
-	$('form').each(function() {
-		$(this).submit(function(e) {
-			var form = $(this);
-			if(form.hasClass('loading')) {
-				e.preventDefault();
-				return;
-			}
-
-			// Block send button
-			form.addClass('loading').addClass('alert-here');
-			var button = $(this).find('button[type=submit]');
-			button.addClass('progress-bar-striped').addClass('progress-bar-animated');
-
-			// Another button
-			if(button.attr('data-target') != '') {
-				$('#' + button.attr('data-target')).addClass('progress-bar-striped').addClass('progress-bar-animated');
-			}
-
-			// Clear form messages
-			form.find('.sys-messages').html('');
-
-			$.ajax({
-				type: "POST",
-				url: form.attr('action'),
-				data: form.serialize()
-			}).done(function(data) {
-				AjaxDone(data)
-			}).fail(function() {
-				AjaxFail();
-			}).always(function() {
-				// Add delay for one second
-				setTimeout(function() {
-					form.removeClass('loading').removeClass('alert-here');
-					button.removeClass('progress-bar-striped').removeClass('progress-bar-animated');
-					// Another button
-					if(button.attr('data-target') != '') {
-						$('#' + button.attr('data-target')).removeClass('progress-bar-striped').removeClass('progress-bar-animated');
-					}
-				}, 100);
-			});
-
-			e.preventDefault();
-		});
-
-		// Bind to another button
-		var button = $(this).find('button[type=submit]');
-		if(button.attr('data-target') != '') {
-			$('#' + button.attr('data-target')).click(function() {
-				button.click();
-			});
-		}
-	});
-
-	// Remove alert from modal on close
-	$('.modal.fade').on('hidden.bs.modal', function() {
-		modal_alert_place = $(this).find('.sys-messages');
-		if(modal_alert_place.length) {
-			modal_alert_place.html('');
-		}
-		// Reset form at modal close
-		form = $(this).find('form');
-		if(form.length) {
-			form[0].reset();
-		}
-	}).on('show.bs.modal', function() {
-		// Reset form at modal open
-		form = $(this).find('form');
-		if(form.length) {
-			form[0].reset();
-		}
-	});
-});

File diff suppressed because it is too large
+ 0 - 3
.bak/engine/wrapper/resources/scripts/assets.cp.scripts.js.go


File diff suppressed because it is too large
+ 0 - 7
.bak/engine/wrapper/resources/scripts/assets.sys.bootstrap.js.go


File diff suppressed because it is too large
+ 0 - 3
.bak/engine/wrapper/resources/scripts/assets.sys.jquery.js.go


File diff suppressed because it is too large
+ 0 - 5
.bak/engine/wrapper/resources/scripts/assets.sys.popper.js.go


+ 0 - 290
.bak/engine/wrapper/resources/styles/assets.cp.styles.css

@@ -1,290 +0,0 @@
-/* Bootstrap scroll fix */
-body.cp {
-	padding-right: 0px !important;
-}
-
-/* Bootstrap modal CP padding fix */
-.cp .navbar {
-	padding: .5rem 1rem !important;
-}
-
-/* Bootstrap dropdown hover fix */
-.dropdown-item:focus, .dropdown-item:hover {
-	background-color: #f1f1f1;
-}
-
-.dropdown-item.active, .dropdown-item:active {
-	background-color: #007bff;
-}
-
-/* Login/MySQL form */
-body.cp-login,
-body.cp-mysql,
-body.cp-first-user {
-	height: 100%;
-	display: -ms-flexbox;
-	display: -webkit-box;
-	display: flex;
-	-ms-flex-align: center;
-	-ms-flex-pack: center;
-	-webkit-box-align: center;
-	align-items: center;
-	-webkit-box-pack: center;
-	justify-content: center;
-	padding-top: 40px;
-	padding-bottom: 40px;
-	background-color: #f5f5f5;
-}
-
-.cp-login .form-signin,
-.cp-mysql .form-signin,
-.cp-first-user .form-signin {
-	width: 100%;
-	max-width: 330px;
-	padding: 15px;
-	margin: 0 auto;
-}
-
-.cp-login .form-signin label,
-.cp-mysql .form-signin label,
-.cp-first-user .form-signin label {
-	cursor: pointer;
-}
-
-.cp-login .form-signin .form-control,
-.cp-mysql .form-signin .form-control,
-.cp-first-user .form-signin .form-control {
-	position: relative;
-	box-sizing: border-box;
-	height: auto;
-	padding: 10px;
-	font-size: 16px;
-}
-
-.cp-login .form-signin .form-control:focus,
-.cp-mysql .form-signin .form-control:focus,
-.cp-first-user .form-signin .form-control:focus {
-	z-index: 2;
-}
-
-.cp-login .form-signin input[type="email"] {
-	margin-bottom: -1px;
-	border-bottom-right-radius: 0;
-	border-bottom-left-radius: 0;
-}
-
-.cp-login .form-signin input[type="password"] {
-	margin-bottom: 10px;
-	border-top-left-radius: 0;
-	border-top-right-radius: 0;
-}
-
-.cp-login .sys-messages,
-.cp-mysql .sys-messages,
-.cp-first-user .sys-messages {
-	text-align: left;
-}
-
-/* Control panel skeleton */
-body.cp {
-	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
-	background: initial;
-	background-color: #fff;
-	font-size: 1rem;
-	font-weight: 400;
-	line-height: 1.5;
-	color: #212529;
-	width: 100%;
-	height: 100%;
-	overflow: hidden;
-}
-
-body.cp nav.main {
-	height: 56px;
-	box-shadow: 0 0 5px 4px rgba(0,0,0,0.25);
-}
-
-body.cp nav.main.bg-dark {
-	background: #205081 url(/assets/sys/bg.png) repeat 0 0!important;
-}
-
-body.cp nav.main a.navbar-brand {
-	font-weight: bold;
-}
-
-body.cp nav.main .navbar-nav .nav-item a img {
-	width: 35px;
-	height: 35px;
-	margin-right: 10px;
-	margin-top: -30px;
-	margin-bottom: -30px;
-	background-color: gray;
-}
-
-body.cp .wrap {
-	width: 100%;
-	height: 100%;
-	display: table;
-	align-items: stretch;
-}
-
-body.cp .wrap .sidebar,
-body.cp .wrap .content {
-	display: table-cell;
-	position: relative;
-	padding-top: 56px;
-	vertical-align: top;
-}
-
-body.cp .wrap .sidebar {
-	display: none;
-}
-
-body.cp.cp-sidebar-left .wrap .sidebar.sidebar-left {
-	display: table-cell;
-}
-
-body.cp.cp-sidebar-right .wrap .sidebar.sidebar-right {
-	display: table-cell;
-}
-
-body.cp .wrap .sidebar-right .padd,
-body.cp .wrap .content .padd {
-	padding: 1rem 1rem;
-}
-
-body.cp .wrap .scroll {
-	height: 100%;
-	overflow: hidden;
-	overflow-y: auto;
-}
-
-body.cp .wrap .sidebar {
-	width: 245px;
-	background: #eee;
-	box-shadow: 0 0.5em 0.5em rgba(0,0,0,.3);
-}
-
-body.cp .wrap .sidebar .dropdown-divider {
-	border-color: #d6d6d6;
-	margin: 0px;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav {
-	padding: 1rem 0px;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav li.nav-item a {
-	color: #444;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav li.nav-item.active {
-	background-color: #417cb9;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav li.nav-item.active a {
-	color: #fff;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav li.nav-item:hover {
-	background-color: #e7e7e7;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav li.nav-item.active:hover {
-	background-color: #417cb9;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav ul.nav {
-	background: #eee;
-	padding-top: 0px;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav ul.nav li.nav-item a {
-	color: #444;
-	padding-left: 2rem;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav ul.nav li.nav-item.active {
-	background-color: #e7e7e7;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav ul.nav li.nav-item.active a {
-	color: #417cb9;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav li.nav-item:last-child ul {
-	padding-bottom: 0px;
-}
-
-body.cp .wrap .sidebar.sidebar-left ul.nav li.nav-item svg.sicon {
-	fill: currentColor;
-	margin-right: 5px;
-}
-
-body.cp .wrap .sidebar .btn-sidebar {
-	width: 100%;
-}
-
-/* Admin table */
-.data-table.table-hover tbody tr:hover {
-	background-color: #fffbdf;
-}
-
-.data-table a svg {
-	fill: currentColor;
-	color: #007bff;
-}
-
-.data-table a:hover svg {
-	color: #0056b3;
-}
-
-.data-table td.col_action a.ico {
-	display: inline-block;
-	width: 16px;
-	height: 16px;
-	margin-right: 10px;
-}
-
-.data-table td.col_action a.ico:last-child {
-	margin-right: 0px;
-}
-
-.data-table thead tr {
-	background-color: #e9ecef;
-}
-
-.data-table.table-bordered td,
-.data-table.table-bordered th {
-	border: none;
-	border-top: 1px solid #dee2e6;
-}
-
-/* Admin table: table_users */
-.data-table.table_users .col_action {
-	width: 100px;
-	text-align: right;
-}
-
-/* Admin data form */
-.data-form .hidden {
-	display: none;
-}
-
-.data-form label {
-	font-weight: bold;
-	margin-top: .45rem;
-	margin-bottom: .45rem;
-}
-
-.data-form small {
-	color: #aeb8bc;
-}
-
-.data-form > div:nth-last-child(2) {
-	margin-bottom: 0px;
-}
-
-.data-form textarea {
-	min-height: 5.4rem;
-}

File diff suppressed because it is too large
+ 0 - 3
.bak/engine/wrapper/resources/styles/assets.cp.styles.css.go


File diff suppressed because it is too large
+ 0 - 7
.bak/engine/wrapper/resources/styles/assets.sys.bootstrap.css.go


+ 0 - 112
.bak/engine/wrapper/resources/styles/assets.sys.styles.css

@@ -1,112 +0,0 @@
-html {
-	min-height: 100%;
-	height: 100%;
-	position: relative
-}
-
-body {
-	background: #205081 url(/assets/sys/bg.png) repeat 0 0;
-	margin: 0;
-	padding: 0;
-	color: #FFF;
-	font-family: Arial, sans-serif;
-	font-weight: 300;
-	font-size: 18px;
-	line-height: 21px;
-	position: relative;
-	width: 100%;
-	min-height: 100%;
-	height: 100%;
-	height: auto;
-	display: table
-}
-
-.wrapper {
-	padding: 15px;
-	text-align: center;
-	display: table-cell;
-	vertical-align: middle
-}
-
-.wrapper .logo {
-	width: 332px;
-	height: 203px;
-	margin: 0 auto;
-	background: url(/assets/sys/logo.png) no-repeat 0 0
-}
-
-.wrapper .logo .svg {
-	width: 150px;
-	height: 150px;
-	margin: 0 auto;
-	position: relative;
-	padding-top: 40px
-}
-
-.wrapper .logo .svg img {
-	top: 50%;
-	left: 50%;
-	position: absolute;
-	width: 150px;
-	height: 150px;
-	margin-top: -75px;
-	margin-left: -75px;
-	animation-name: fave;
-	animation-duration: 1000ms;
-	animation-iteration-count: infinite;
-	animation-timing-function: linear
-}
-
-@keyframes fave {
-	0% {
-		width: 150px;
-		height: 150px;
-		margin-top: -75px;
-		margin-left: -75px
-	}
-
-	40% {
-		width: 150px;
-		height: 150px;
-		margin-top: -75px;
-		margin-left: -75px
-	}
-
-	60% {
-		width: 120px;
-		height: 120px;
-		margin-top: -60px;
-		margin-left: -60px
-	}
-
-	100% {
-		width: 150px;
-		height: 150px;
-		margin-top: -75px;
-		margin-left: -75px
-	}
-}
-
-h1, h2 {
-	font-weight: 400;
-	font-size: 34px;
-	line-height: 36px;
-	margin: 10px 0
-}
-
-h2 {
-	font-weight: 350;
-	font-size: 14px;
-	line-height: 18px;
-	margin-bottom: 0
-}
-
-@media only screen and (max-width:800px) {
-	.wrapper {
-		padding: 15px 0
-	}
-
-	h1, h2 {
-		padding: 0 15px
-	}
-}

+ 0 - 3
.bak/engine/wrapper/resources/styles/assets.sys.styles.css.go

@@ -1,3 +0,0 @@
-package styles
-
-var File_assets_sys_styles_css = []byte(`html{min-height:100%;height:100%;position:relative}body{background:#205081 url(/assets/sys/bg.png) repeat 0 0;margin:0;padding:0;color:#FFF;font-family:Arial,sans-serif;font-weight:300;font-size:18px;line-height:21px;position:relative;width:100%;min-height:100%;height:100%;height:auto;display:table}.wrapper{padding:15px;text-align:center;display:table-cell;vertical-align:middle}.wrapper .logo{width:332px;height:203px;margin:0 auto;background:url(/assets/sys/logo.png) no-repeat 0 0}.wrapper .logo .svg{width:150px;height:150px;margin:0 auto;position:relative;padding-top:40px}.wrapper .logo .svg img{top:50%;left:50%;position:absolute;width:150px;height:150px;margin-top:-75px;margin-left:-75px;animation-name:fave;animation-duration:1000ms;animation-iteration-count:infinite;animation-timing-function:linear}@keyframes fave{0%{width:150px;height:150px;margin-top:-75px;margin-left:-75px}40%{width:150px;height:150px;margin-top:-75px;margin-left:-75px}60%{width:120px;height:120px;margin-top:-60px;margin-left:-60px}100%{width:150px;height:150px;margin-top:-75px;margin-left:-75px}}h1,h2{font-weight:400;font-size:34px;line-height:36px;margin:10px 0}h2{font-weight:350;font-size:14px;line-height:18px;margin-bottom:0}@media only screen and (max-width:800px){.wrapper{padding:15px 0}h1,h2{padding:0 15px}}`)

File diff suppressed because it is too large
+ 0 - 2
.bak/engine/wrapper/resources/templates/cp.base.go


+ 0 - 119
.bak/engine/wrapper/resources/templates/cp.base.html

@@ -1,119 +0,0 @@
-<!doctype html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8">
-		<meta name="theme-color" content="#205081" />
-		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-		<title>{{$.Data.Title}}</title>
-		<link rel="stylesheet" href="{{$.System.PathCssBootstrap}}">
-		<link rel="stylesheet" href="{{$.System.PathCssStyles}}" />
-		<link rel="stylesheet" href="{{$.System.PathCssCpStyles}}">
-		<link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" />
-	</head>
-	<body class="{{$.Data.BodyClasses}}">
-		<div class="modal fade" id="sys-modal-user-settings" tabindex="-1" role="dialog" aria-labelledby="sysModalUserSettingsLabel" aria-hidden="true">
-			<div class="modal-dialog modal-dialog-centered" role="document">
-				<div class="modal-content">
-					<form class="form-user-settings" action="/cp/" method="post" autocomplete="off">
-						<input type="hidden" name="action" value="usersettings">
-						<div class="modal-header">
-							<h5 class="modal-title" id="sysModalUserSettingsLabel">User settings</h5>
-							<button type="button" class="close" data-dismiss="modal" aria-label="Close">
-								<span aria-hidden="true">&times;</span>
-							</button>
-						</div>
-						<div class="modal-body text-left">
-							<div class="form-group">
-								<label for="first_name">User first name</label>
-								<input type="text" class="form-control" id="first_name" name="first_name" value="{{$.Data.UserFirstName}}" placeholder="User first name" autocomplete="off">
-							</div>
-							<div class="form-group">
-								<label for="last_name">User last name</label>
-								<input type="text" class="form-control" id="last_name" name="last_name" value="{{$.Data.UserLastName}}" placeholder="User last name" autocomplete="off">
-							</div>
-							<div class="form-group">
-								<label for="email">User email</label>
-								<input type="email" class="form-control" id="email" name="email" value="{{$.Data.UserEmail}}" placeholder="User email" autocomplete="off" required>
-							</div>
-							<div class="form-group">
-								<label for="password">User new password</label>
-								<input type="password" class="form-control" id="password" aria-describedby="passwordHelp" name="password" value="{{$.Data.UserPassword}}" placeholder="User new password" autocomplete="off">
-								<small id="passwordHelp" class="form-text text-muted">Leave this field empty if you don't want change your password</small>
-							</div>
-							<div class="sys-messages"></div>
-						</div>
-						<div class="modal-footer">
-							<button type="submit" class="btn btn-primary">Save changes</button>
-							<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
-						</div>
-					</form>
-				</div>
-			</div>
-		</div>
-		<nav class="navbar main navbar-expand-md navbar-dark fixed-top bg-dark">
-			<a class="navbar-brand" href="/cp/">{{$.Data.Title}}</a>
-			<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
-				<span class="navbar-toggler-icon"></span>
-			</button>
-			<div class="collapse navbar-collapse" id="navbarCollapse">
-				<ul class="navbar-nav mr-auto">
-					<li class="nav-item dropdown">
-						<a class="nav-link dropdown-toggle" href="javascript:;" id="nbModulesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-							Modules
-						</a>
-						<div class="dropdown-menu" aria-labelledby="nbModulesDropdown">
-							{{$.Data.NavBarModules}}
-						</div>
-					</li>
-					<li class="nav-item dropdown">
-						<a class="nav-link dropdown-toggle" href="javascript:;" id="nbSystemDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-							System
-						</a>
-						<div class="dropdown-menu" aria-labelledby="nbSystemDropdown">
-							{{$.Data.NavBarModulesSys}}
-						</div>
-					</li>
-				</ul>
-				<ul class="navbar-nav ml-auto">
-					<li class="nav-item dropdown">
-						<a class="nav-link dropdown-toggle" href="javascript:;" id="nbAccountDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-							<img class="rounded-circle" src="{{$.Data.UserAvatarLink}}">{{$.Data.UserEmail}}
-						</a>
-						<div class="dropdown-menu dropdown-menu-right" aria-labelledby="nbAccountDropdown">
-							<a class="dropdown-item" href="javascript:;" data-toggle="modal" data-target="#sys-modal-user-settings" data-backdrop="static" data-keyboard="false">Settings</a>
-							<div class="dropdown-divider"></div>
-							<a class="dropdown-item" href="javascript:ActionSingOut();">Sing out</a>
-						</div>
-					</li>
-				</ul>
-			</div>
-		</nav>
-		<div class="wrap">
-			<div class="sidebar sidebar-left">
-				<div class="scroll">
-					<div class="padd">
-						{{$.Data.SidebarLeft}}
-					</div>
-				</div>
-			</div>
-			<div class="content">
-				<div class="scroll">
-					<div class="padd">
-						{{$.Data.Content}}
-					</div>
-				</div>
-			</div>
-			<div class="sidebar sidebar-right">
-				<div class="scroll">
-					<div class="padd">
-						{{$.Data.SidebarRight}}
-					</div>
-				</div>
-			</div>
-		</div>
-		<script src="{{$.System.PathJsJquery}}"></script>
-		<script src="{{$.System.PathJsPopper}}"></script>
-		<script src="{{$.System.PathJsBootstrap}}"></script>
-		<script src="{{$.System.PathJsCpScripts}}"></script>
-	</body>
-</html>

+ 0 - 3
.bak/engine/wrapper/resources/templates/cp.firstuser.go

@@ -1,3 +0,0 @@
-package templates
-
-var CpFirstUser = []byte(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="theme-color" content="#205081" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Creating first user</title><link rel="stylesheet" href="{{$.System.PathCssBootstrap}}"><link rel="stylesheet" href="{{$.System.PathCssCpStyles}}"><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><style type="text/css">html{height:100%;}</style></head><body class="cp-first-user text-center"><form class="form-signin card" action="/cp/" method="post"><input type="hidden" name="action" value="first_user"><h1 class="h3 mb-3 font-weight-normal">Creating first user</h1><label for="first_name" class="sr-only">User first name</label><input type="text" id="first_name" name="first_name" class="form-control mb-3" placeholder="User first name"><label for="last_name" class="sr-only">User last name</label><input type="text" id="last_name" name="last_name" class="form-control mb-3" placeholder="User last name"><label for="email" class="sr-only">User email</label><input type="email" id="email" name="email" class="form-control mb-3" placeholder="User email" required><label for="password" class="sr-only">User password</label><input type="password" id="password" name="password" class="form-control mb-3" placeholder="User password" required><div class="sys-messages"></div><button class="btn btn-lg btn-primary btn-block" type="submit">Create</button></form><script src="{{$.System.PathJsJquery}}"></script><script src="{{$.System.PathJsPopper}}"></script><script src="{{$.System.PathJsBootstrap}}"></script><script src="{{$.System.PathJsCpScripts}}"></script></body></html>`)

+ 0 - 33
.bak/engine/wrapper/resources/templates/cp.firstuser.html

@@ -1,33 +0,0 @@
-<!doctype html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8">
-		<meta name="theme-color" content="#205081" />
-		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-		<title>Creating first user</title>
-		<link rel="stylesheet" href="{{$.System.PathCssBootstrap}}">
-		<link rel="stylesheet" href="{{$.System.PathCssCpStyles}}">
-		<link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" />
-		<style type="text/css">html{height:100%;}</style>
-	</head>
-	<body class="cp-first-user text-center">
-		<form class="form-signin card" action="/cp/" method="post">
-			<input type="hidden" name="action" value="first_user">
-			<h1 class="h3 mb-3 font-weight-normal">Creating first user</h1>
-			<label for="first_name" class="sr-only">User first name</label>
-			<input type="text" id="first_name" name="first_name" class="form-control mb-3" placeholder="User first name">
-			<label for="last_name" class="sr-only">User last name</label>
-			<input type="text" id="last_name" name="last_name" class="form-control mb-3" placeholder="User last name">
-			<label for="email" class="sr-only">User email</label>
-			<input type="email" id="email" name="email" class="form-control mb-3" placeholder="User email" required>
-			<label for="password" class="sr-only">User password</label>
-			<input type="password" id="password" name="password" class="form-control mb-3" placeholder="User password" required>
-			<div class="sys-messages"></div>
-			<button class="btn btn-lg btn-primary btn-block" type="submit">Create</button>
-		</form>
-		<script src="{{$.System.PathJsJquery}}"></script>
-		<script src="{{$.System.PathJsPopper}}"></script>
-		<script src="{{$.System.PathJsBootstrap}}"></script>
-		<script src="{{$.System.PathJsCpScripts}}"></script>
-	</body>
-</html>

+ 0 - 3
.bak/engine/wrapper/resources/templates/cp.login.go

@@ -1,3 +0,0 @@
-package templates
-
-var CpLogin = []byte(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="theme-color" content="#205081" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Please login</title><link rel="stylesheet" href="{{$.System.PathCssBootstrap}}"><link rel="stylesheet" href="{{$.System.PathCssCpStyles}}"><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><style type="text/css">html{height:100%;}</style></head><body class="cp-login text-center"><form class="form-signin card" action="/cp/" method="post"><input type="hidden" name="action" value="signin"><h1 class="h3 mb-3 font-weight-normal">Please login</h1><label for="email" class="sr-only">User email</label><input type="email" id="email" name="email" class="form-control" placeholder="User email" required autofocus><label for="password" class="sr-only">User password</label><input type="password" id="password" name="password" class="form-control mb-3" placeholder="User password" required><div class="sys-messages"></div><button class="btn btn-lg btn-primary btn-block" type="submit">Login</button></form><script src="{{$.System.PathJsJquery}}"></script><script src="{{$.System.PathJsPopper}}"></script><script src="{{$.System.PathJsBootstrap}}"></script><script src="{{$.System.PathJsCpScripts}}"></script></body></html>`)

+ 0 - 29
.bak/engine/wrapper/resources/templates/cp.login.html

@@ -1,29 +0,0 @@
-<!doctype html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8">
-		<meta name="theme-color" content="#205081" />
-		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-		<title>Please login</title>
-		<link rel="stylesheet" href="{{$.System.PathCssBootstrap}}">
-		<link rel="stylesheet" href="{{$.System.PathCssCpStyles}}">
-		<link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" />
-		<style type="text/css">html{height:100%;}</style>
-	</head>
-	<body class="cp-login text-center">
-		<form class="form-signin card" action="/cp/" method="post">
-			<input type="hidden" name="action" value="signin">
-			<h1 class="h3 mb-3 font-weight-normal">Please login</h1>
-			<label for="email" class="sr-only">User email</label>
-			<input type="email" id="email" name="email" class="form-control" placeholder="User email" required autofocus>
-			<label for="password" class="sr-only">User password</label>
-			<input type="password" id="password" name="password" class="form-control mb-3" placeholder="User password" required>
-			<div class="sys-messages"></div>
-			<button class="btn btn-lg btn-primary btn-block" type="submit">Login</button>
-		</form>
-		<script src="{{$.System.PathJsJquery}}"></script>
-		<script src="{{$.System.PathJsPopper}}"></script>
-		<script src="{{$.System.PathJsBootstrap}}"></script>
-		<script src="{{$.System.PathJsCpScripts}}"></script>
-	</body>
-</html>

+ 0 - 3
.bak/engine/wrapper/resources/templates/cp.mysql.go

@@ -1,3 +0,0 @@
-package templates
-
-var CpMySQL = []byte(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="theme-color" content="#205081" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Configure MySQL</title><link rel="stylesheet" href="{{$.System.PathCssBootstrap}}"><link rel="stylesheet" href="{{$.System.PathCssCpStyles}}"><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><style type="text/css">html{height:100%;}</style></head><body class="cp-mysql text-center"><form class="form-signin card" action="/cp/" method="post"><input type="hidden" name="action" value="mysql"><h1 class="h3 mb-3 font-weight-normal">Configure MySQL</h1><label for="host" class="sr-only">Database host</label><input type="text" id="host" name="host" class="form-control mb-3" placeholder="Database host" value="localhost" required><label for="port" class="sr-only">Database host port</label><input type="text" id="port" name="port" class="form-control mb-3" placeholder="Database host port" value="3306" required><label for="name" class="sr-only">Database name</label><input type="text" id="name" name="name" class="form-control mb-3" placeholder="Database name" required autofocus><label for="user" class="sr-only">Database user name</label><input type="text" id="user" name="user" class="form-control mb-3" placeholder="Database user name" required><label for="password" class="sr-only">Database user password</label><input type="password" id="password" name="password" class="form-control mb-3" placeholder="Database user password"><div class="sys-messages"></div><button class="btn btn-lg btn-primary btn-block" type="submit">Configure</button></form><script src="{{$.System.PathJsJquery}}"></script><script src="{{$.System.PathJsPopper}}"></script><script src="{{$.System.PathJsBootstrap}}"></script><script src="{{$.System.PathJsCpScripts}}"></script></body></html>`)

+ 0 - 35
.bak/engine/wrapper/resources/templates/cp.mysql.html

@@ -1,35 +0,0 @@
-<!doctype html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8">
-		<meta name="theme-color" content="#205081" />
-		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-		<title>Configure MySQL</title>
-		<link rel="stylesheet" href="{{$.System.PathCssBootstrap}}">
-		<link rel="stylesheet" href="{{$.System.PathCssCpStyles}}">
-		<link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" />
-		<style type="text/css">html{height:100%;}</style>
-	</head>
-	<body class="cp-mysql text-center">
-		<form class="form-signin card" action="/cp/" method="post">
-			<input type="hidden" name="action" value="mysql">
-			<h1 class="h3 mb-3 font-weight-normal">Configure MySQL</h1>
-			<label for="host" class="sr-only">Database host</label>
-			<input type="text" id="host" name="host" class="form-control mb-3" placeholder="Database host" value="localhost" required>
-			<label for="port" class="sr-only">Database host port</label>
-			<input type="text" id="port" name="port" class="form-control mb-3" placeholder="Database host port" value="3306" required>
-			<label for="name" class="sr-only">Database name</label>
-			<input type="text" id="name" name="name" class="form-control mb-3" placeholder="Database name" required autofocus>
-			<label for="user" class="sr-only">Database user name</label>
-			<input type="text" id="user" name="user" class="form-control mb-3" placeholder="Database user name" required>
-			<label for="password" class="sr-only">Database user password</label>
-			<input type="password" id="password" name="password" class="form-control mb-3" placeholder="Database user password">
-			<div class="sys-messages"></div>
-			<button class="btn btn-lg btn-primary btn-block" type="submit">Configure</button>
-		</form>
-		<script src="{{$.System.PathJsJquery}}"></script>
-		<script src="{{$.System.PathJsPopper}}"></script>
-		<script src="{{$.System.PathJsBootstrap}}"></script>
-		<script src="{{$.System.PathJsCpScripts}}"></script>
-	</body>
-</html>

+ 0 - 3
.bak/engine/wrapper/resources/templates/page.default.go

@@ -1,3 +0,0 @@
-package templates
-
-var PageDefault = []byte(`<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta name="theme-color" content="#205081" /><title>Default Page</title><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="width=device-width, initial-scale=0.8, maximum-scale=0.8" /><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><link rel="stylesheet" type="text/css" media="all" href="{{$.System.PathCssStyles}}" /></head><body><div class="wrapper"><div class="logo"><div class="svg"><img src="{{$.System.PathSvgLogo}}" width="150" height="150" /></div></div><h1>Default Page</h1><h2><script>document.write(document.location.host);</script><noscript>fave.pro</noscript></h2></div></body></html>`)

+ 0 - 23
.bak/engine/wrapper/resources/templates/page.default.html

@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<meta name="theme-color" content="#205081" />
-		<title>Default Page</title>
-		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
-		<meta name="viewport" content="width=device-width, initial-scale=0.8, maximum-scale=0.8" />
-		<link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" />
-		<link rel="stylesheet" type="text/css" media="all" href="{{$.System.PathCssStyles}}" />
-	</head>
-	<body>
-		<div class="wrapper">
-			<div class="logo">
-				<div class="svg">
-					<img src="{{$.System.PathSvgLogo}}" width="150" height="150" />
-				</div>
-			</div>
-			<h1>Default Page</h1>
-			<h2><script>document.write(document.location.host);</script><noscript>fave.pro</noscript></h2>
-		</div>
-	</body>
-</html>

+ 0 - 3
.bak/engine/wrapper/resources/templates/page.engerror.go

@@ -1,3 +0,0 @@
-package templates
-
-var PageEngError = []byte(`<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta name="theme-color" content="#205081" /><title>Engine Error</title><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="width=device-width, initial-scale=0.8, maximum-scale=0.8" /><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><link rel="stylesheet" type="text/css" media="all" href="{{$.System.PathCssStyles}}" /></head><body><div class="wrapper"><div class="logo"><div class="svg"><img src="{{$.System.PathSvgLogo}}" width="150" height="150" /></div></div><h1>Engine Error</h1><h2>{{$.Data.ErrorMessage}}</h2></div></body></html>`)

+ 0 - 23
.bak/engine/wrapper/resources/templates/page.engerror.html

@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<meta name="theme-color" content="#205081" />
-		<title>Engine Error</title>
-		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
-		<meta name="viewport" content="width=device-width, initial-scale=0.8, maximum-scale=0.8" />
-		<link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" />
-		<link rel="stylesheet" type="text/css" media="all" href="{{$.System.PathCssStyles}}" />
-	</head>
-	<body>
-		<div class="wrapper">
-			<div class="logo">
-				<div class="svg">
-					<img src="{{$.System.PathSvgLogo}}" width="150" height="150" />
-				</div>
-			</div>
-			<h1>Engine Error</h1>
-			<h2>{{$.Data.ErrorMessage}}</h2>
-		</div>
-	</body>
-</html>

+ 0 - 3
.bak/engine/wrapper/resources/templates/page.error.404.go

@@ -1,3 +0,0 @@
-package templates
-
-var PageError404 = []byte(`<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta name="theme-color" content="#205081" /><title>404 Not Found</title><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="width=device-width, initial-scale=0.8, maximum-scale=0.8" /><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><link rel="stylesheet" type="text/css" media="all" href="{{$.System.PathCssStyles}}" /></head><body><div class="wrapper"><div class="logo"><div class="svg"><img src="{{$.System.PathSvgLogo}}" width="150" height="150" /></div></div><h1>404 Not Found</h1><h2><script>document.write(document.location.host);</script><noscript>fave.pro</noscript></h2></div></body></html>`)

+ 0 - 23
.bak/engine/wrapper/resources/templates/page.error.404.html

@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<meta name="theme-color" content="#205081" />
-		<title>404 Not Found</title>
-		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
-		<meta name="viewport" content="width=device-width, initial-scale=0.8, maximum-scale=0.8" />
-		<link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" />
-		<link rel="stylesheet" type="text/css" media="all" href="{{$.System.PathCssStyles}}" />
-	</head>
-	<body>
-		<div class="wrapper">
-			<div class="logo">
-				<div class="svg">
-					<img src="{{$.System.PathSvgLogo}}" width="150" height="150" />
-				</div>
-			</div>
-			<h1>404 Not Found</h1>
-			<h2><script>document.write(document.location.host);</script><noscript>fave.pro</noscript></h2>
-		</div>
-	</body>
-</html>

+ 0 - 3
.bak/engine/wrapper/resources/templates/page.tmplerror.go

@@ -1,3 +0,0 @@
-package templates
-
-var PageTmplError = []byte(`<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta name="theme-color" content="#205081" /><title>Template Error</title><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="width=device-width, initial-scale=0.8, maximum-scale=0.8" /><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><link rel="stylesheet" type="text/css" media="all" href="{{$.System.PathCssStyles}}" /></head><body><div class="wrapper"><div class="logo"><div class="svg"><img src="{{$.System.PathSvgLogo}}" width="150" height="150" /></div></div><h1>Template Error</h1><h2>{{$.Data.ErrorMessage}}</h2></div></body></html>`)

+ 0 - 23
.bak/engine/wrapper/resources/templates/page.tmplerror.html

@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<meta name="theme-color" content="#205081" />
-		<title>Template Error</title>
-		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
-		<meta name="viewport" content="width=device-width, initial-scale=0.8, maximum-scale=0.8" />
-		<link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" />
-		<link rel="stylesheet" type="text/css" media="all" href="{{$.System.PathCssStyles}}" />
-	</head>
-	<body>
-		<div class="wrapper">
-			<div class="logo">
-				<div class="svg">
-					<img src="{{$.System.PathSvgLogo}}" width="150" height="150" />
-				</div>
-			</div>
-			<h1>Template Error</h1>
-			<h2>{{$.Data.ErrorMessage}}</h2>
-		</div>
-	</body>
-</html>

+ 0 - 215
.bak/engine/wrapper/static.go

@@ -1,215 +0,0 @@
-package wrapper
-
-import (
-	"html/template"
-	"io/ioutil"
-	"net/http"
-	"os"
-
-	images "golang-fave/engine/wrapper/resources/images"
-	others "golang-fave/engine/wrapper/resources/others"
-	scripts "golang-fave/engine/wrapper/resources/scripts"
-	styles "golang-fave/engine/wrapper/resources/styles"
-	templates "golang-fave/engine/wrapper/resources/templates"
-)
-
-type tmplDataErrorMsg struct {
-	ErrorMessage string
-}
-
-func (this *Wrapper) staticResource() bool {
-	if this.R.URL.Path == "/assets/sys/styles.css" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "text/css")
-		(*this.W).Write(styles.File_assets_sys_styles_css)
-		return true
-	} else if this.R.URL.Path == "/assets/cp/styles.css" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "text/css")
-		(*this.W).Write(styles.File_assets_cp_styles_css)
-		return true
-	} else if this.R.URL.Path == "/assets/sys/bootstrap.css" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "text/css")
-		(*this.W).Write(styles.File_assets_sys_bootstrap_css)
-		return true
-	} else if this.R.URL.Path == "/assets/sys/jquery.js" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "application/javascript; charset=utf-8")
-		(*this.W).Write(scripts.File_assets_sys_jquery_js)
-		return true
-	} else if this.R.URL.Path == "/assets/sys/popper.js" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "application/javascript; charset=utf-8")
-		(*this.W).Write(scripts.File_assets_sys_popper_js)
-		return true
-	} else if this.R.URL.Path == "/assets/sys/bootstrap.js" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "application/javascript; charset=utf-8")
-		(*this.W).Write(scripts.File_assets_sys_bootstrap_js)
-		return true
-	} else if this.R.URL.Path == "/assets/cp/scripts.js" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "application/javascript; charset=utf-8")
-		(*this.W).Write(scripts.File_assets_cp_scripts_js)
-		return true
-	} else if this.R.URL.Path == "/assets/sys/logo.svg" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "image/svg+xml")
-		(*this.W).Write(others.File_assets_sys_logo_svg)
-		return true
-	} else if this.R.URL.Path == "/assets/sys/bg.png" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "image/png")
-		(*this.W).Write(images.File_assets_sys_bg_png)
-		return true
-	} else if this.R.URL.Path == "/assets/sys/logo.png" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "image/png")
-		(*this.W).Write(images.File_assets_sys_logo_png)
-		return true
-	} else if this.R.URL.Path == "/assets/sys/fave.ico" {
-		(*this.W).Header().Set("Cache-Control", "public, max-age=31536000")
-		(*this.W).Header().Set("Content-Type", "image/x-icon")
-		(*this.W).Write(others.File_assets_sys_fave_ico)
-		return true
-	}
-	return false
-}
-
-func (this *Wrapper) staticFile() bool {
-	file := this.R.URL.Path
-	if file != "/" {
-		f, err := os.Open(this.DirVHostHome + "/htdocs" + file)
-		if err == nil {
-			defer f.Close()
-			st, err := os.Stat(this.DirVHostHome + "/htdocs" + file)
-			if err != nil {
-				return false
-			}
-			if st.Mode().IsDir() {
-				if file[len(file)-1] == '/' {
-					fi, err := os.Open(this.DirVHostHome + "/htdocs" + file + "/index.html")
-					if err == nil {
-						defer fi.Close()
-						sti, err := os.Stat(this.DirVHostHome + "/htdocs" + file + "/index.html")
-						if err != nil {
-							return false
-						}
-						if sti.Mode().IsDir() {
-							return false
-						}
-						http.ServeFile(*this.W, this.R, this.DirVHostHome+"/htdocs"+file+"/index.html")
-						return true
-					}
-				}
-				return false
-			}
-			http.ServeFile(*this.W, this.R, this.DirVHostHome+"/htdocs"+file)
-			return true
-		}
-	} else {
-		f, err := os.Open(this.DirVHostHome + "/htdocs/index.html")
-		if err == nil {
-			defer f.Close()
-			st, err := os.Stat(this.DirVHostHome + "/htdocs/index.html")
-			if err != nil {
-				return false
-			}
-			if st.Mode().IsDir() {
-				return false
-			}
-			http.ServeFile(*this.W, this.R, this.DirVHostHome+"/htdocs/index.html")
-			return true
-		}
-	}
-	return false
-}
-
-func (this *Wrapper) printPageDefault() {
-	// Custom page
-	f, err := os.Open(this.DirVHostHome + "/htdocs" + "/index.html")
-	if err == nil {
-		defer f.Close()
-		http.ServeFile(*this.W, this.R, this.DirVHostHome+"/htdocs"+"/index.html")
-		return
-	}
-
-	// Default page
-	tmpl, err := template.New("template").Parse(string(templates.PageDefault))
-	if err != nil {
-		this.printTmplPageError(err)
-		return
-	}
-	(*this.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-	(*this.W).Header().Set("Content-Type", "text/html")
-	tmpl.Execute(*this.W, TmplDataAll{
-		System: this.TmplGetSystemData(),
-	})
-}
-
-func (this *Wrapper) printPage404() {
-	// Custom 404 error page
-	f, err := ioutil.ReadFile(this.DirVHostHome + "/htdocs" + "/404.html")
-	if err == nil {
-		(*this.W).WriteHeader(http.StatusNotFound)
-		(*this.W).Header().Set("Content-Type", "text/html")
-		(*this.W).Write(f)
-		return
-	}
-
-	// Default error page
-	tmpl, err := template.New("template").Parse(string(templates.PageError404))
-	if err != nil {
-		this.printTmplPageError(err)
-		return
-	}
-	(*this.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-	(*this.W).WriteHeader(http.StatusNotFound)
-	(*this.W).Header().Set("Content-Type", "text/html")
-	tmpl.Execute(*this.W, TmplDataAll{
-		System: this.TmplGetSystemData(),
-	})
-}
-
-func (this *Wrapper) printTmplPageError(perr error) {
-	tmpl, err := template.New("template").Parse(string(templates.PageTmplError))
-	if err != nil {
-		(*this.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-		(*this.W).WriteHeader(http.StatusInternalServerError)
-		(*this.W).Header().Set("Content-Type", "text/html")
-		(*this.W).Write([]byte("<h1>Critical engine error!</h1>"))
-		(*this.W).Write([]byte("<h2>" + perr.Error() + "</h2>"))
-		return
-	}
-	(*this.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-	(*this.W).WriteHeader(http.StatusInternalServerError)
-	(*this.W).Header().Set("Content-Type", "text/html")
-	tmpl.Execute(*this.W, TmplDataAll{
-		System: this.TmplGetSystemData(),
-		Data: tmplDataErrorMsg{
-			ErrorMessage: perr.Error(),
-		},
-	})
-}
-
-func (this *Wrapper) PrintEnginePageError(perr error) {
-	tmpl, err := template.New("template").Parse(string(templates.PageEngError))
-	if err != nil {
-		(*this.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-		(*this.W).WriteHeader(http.StatusInternalServerError)
-		(*this.W).Header().Set("Content-Type", "text/html")
-		(*this.W).Write([]byte("<h1>Critical engine error!</h1>"))
-		(*this.W).Write([]byte("<h2>" + perr.Error() + "</h2>"))
-		return
-	}
-	(*this.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-	(*this.W).WriteHeader(http.StatusInternalServerError)
-	(*this.W).Header().Set("Content-Type", "text/html")
-	tmpl.Execute(*this.W, TmplDataAll{
-		System: this.TmplGetSystemData(),
-		Data: tmplDataErrorMsg{
-			ErrorMessage: perr.Error(),
-		},
-	})
-}

+ 0 - 61
.bak/engine/wrapper/utils/config_mysql.go

@@ -1,61 +0,0 @@
-package utils
-
-import (
-	"encoding/json"
-	"os"
-)
-
-type ConfigMySql struct {
-	Host     string
-	Port     string
-	Name     string
-	User     string
-	Password string
-}
-
-func IsMySqlConfigExists(homedir string) bool {
-	f, err := os.Open(homedir + "/config/mysql.json")
-	if err == nil {
-		defer f.Close()
-		st, err := os.Stat(homedir + "/config/mysql.json")
-		if err == nil {
-			if !st.Mode().IsDir() {
-				return true
-			}
-		}
-	}
-	return false
-}
-
-func MySqlConfigRead(homedir string) (*ConfigMySql, error) {
-	f, err := os.Open(homedir + "/config/mysql.json")
-	if err == nil {
-		defer f.Close()
-		dec := json.NewDecoder(f)
-		conf := ConfigMySql{}
-		err = dec.Decode(&conf)
-		if err == nil {
-			return &conf, err
-		}
-	}
-	return nil, err
-}
-
-func MySqlConfigWrite(homedir string, host string, port string, name string, user string, password string) error {
-	r, err := json.Marshal(&ConfigMySql{
-		Host:     host,
-		Port:     port,
-		Name:     name,
-		User:     user,
-		Password: password,
-	})
-	if err == nil {
-		f, err := os.Create(homedir + "/config/mysql.json")
-		if err == nil {
-			defer f.Close()
-			_, err = f.WriteString(string(r))
-			return err
-		}
-	}
-	return err
-}

+ 0 - 7
.bak/engine/wrapper/utils/struct_msubmenu.go

@@ -1,7 +0,0 @@
-package utils
-
-type ModuleSubMenu struct {
-	Alias string
-	Name  string
-	Icon  string
-}

+ 0 - 9
.bak/engine/wrapper/utils/struct_mysql.go

@@ -1,9 +0,0 @@
-package utils
-
-type MySql_user struct {
-	A_id         int
-	A_first_name string
-	A_last_name  string
-	A_email      string
-	A_password   string
-}

+ 0 - 34
.bak/engine/wrapper/utils/utils.go

@@ -1,34 +0,0 @@
-package utils
-
-import (
-	"crypto/md5"
-	"encoding/hex"
-	"regexp"
-	"strings"
-)
-
-func EmailIsValid(email string) bool {
-	regexpe := regexp.MustCompile(`^[a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,4}$`)
-	return regexpe.MatchString(email)
-}
-
-func GetMd5(str string) string {
-	hasher := md5.New()
-	hasher.Write([]byte(str))
-	return hex.EncodeToString(hasher.Sum(nil))
-}
-
-func UrlToArray(url string) []string {
-	url_buff := url
-	if len(url_buff) >= 1 && url_buff[:1] == "/" {
-		url_buff = url_buff[1:]
-	}
-	if len(url_buff) >= 1 && url_buff[len(url_buff)-1:] == "/" {
-		url_buff = url_buff[:len(url_buff)-1]
-	}
-	if url_buff == "" {
-		return []string{}
-	} else {
-		return strings.Split(url_buff, "/")
-	}
-}

+ 0 - 219
.bak/engine/wrapper/wrapper.go

@@ -1,219 +0,0 @@
-package wrapper
-
-import (
-	"bytes"
-	"html/template"
-	"log"
-	"net"
-	"net/http"
-	"os"
-	"strings"
-
-	"golang-fave/constants"
-	"golang-fave/engine/sessions"
-)
-
-type handleRun func(wrapper *Wrapper) bool
-
-type tmplDataSystem struct {
-	PathIcoFav       string
-	PathSvgLogo      string
-	PathCssStyles    string
-	PathCssCpStyles  string
-	PathCssBootstrap string
-	PathJsJquery     string
-	PathJsPopper     string
-	PathJsBootstrap  string
-	PathJsCpScripts  string
-}
-
-type TmplDataAll struct {
-	System tmplDataSystem
-	Data   interface{}
-}
-
-type Wrapper struct {
-	W            *http.ResponseWriter
-	R            *http.Request
-	VHost        string
-	Port         string
-	DirWww       string
-	DirVHostHome string
-	RemoteIp     string
-	LoggerAcc    *log.Logger
-	LoggerErr    *log.Logger
-	Session      *sessions.Session
-}
-
-func New(w *http.ResponseWriter, r *http.Request, vhost string, port string, wwwdir string, vhosthome string) *Wrapper {
-	return &Wrapper{
-		VHost:        vhost,
-		Port:         port,
-		DirWww:       wwwdir,
-		DirVHostHome: vhosthome,
-		W:            w,
-		R:            r,
-	}
-}
-
-func (this *Wrapper) Run(hRun handleRun) {
-	// Populate some values
-	this.RemoteIp = this.R.RemoteAddr
-
-	// Create loggers
-	this.LoggerAcc = log.New(os.Stdout, this.VHost+", ", log.LstdFlags)
-	this.LoggerErr = log.New(os.Stdout, this.VHost+", ", log.LstdFlags)
-
-	// Attach file for access log
-	if !constants.Debug {
-		acclogfile, acclogfileerr := os.OpenFile(this.DirVHostHome+"/logs/access.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
-		if acclogfileerr == nil {
-			defer acclogfile.Close()
-			this.LoggerAcc.SetOutput(acclogfile)
-		}
-	}
-
-	// Attach file for access log
-	if !constants.Debug {
-		errlogfile, errlogfileerr := os.OpenFile(this.DirVHostHome+"/logs/error.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
-		if errlogfileerr == nil {
-			defer errlogfile.Close()
-			this.LoggerErr.SetOutput(errlogfile)
-		}
-	}
-
-	// Fix remote IP
-	if strings.ContainsRune(this.R.RemoteAddr, ':') {
-		this.RemoteIp, _, _ = net.SplitHostPort(this.R.RemoteAddr)
-	}
-
-	// Redirect to main domain
-	if this.redirectToMainDomain() {
-		this.Log("301")
-		return
-	}
-
-	// Static resource
-	if this.staticResource() {
-		this.Log("200")
-		return
-	}
-
-	// Static file
-	if this.staticFile() {
-		this.Log("200")
-		return
-	}
-
-	// Friendly search engine url
-	if this.redirectSeoFix() {
-		this.Log("301")
-		return
-	}
-
-	// Create and load session
-	this.Session = sessions.New(this.W, this.R, this.VHost, this.DirVHostHome, this.RemoteIp)
-	this.Session.Load()
-
-	// Set session vars
-	if !this.Session.IsSetInt("UserId") {
-		this.Session.SetInt("UserId", 0)
-	}
-
-	// Logic
-	if hRun != nil {
-		if hRun(this) {
-			this.Log("200")
-			this.Session.Save()
-			return
-		}
-	}
-
-	// Show default page
-	if this.R.URL.Path == "/" {
-		this.Log("200")
-		this.printPageDefault()
-	} else {
-		this.LogError("404")
-		this.printPage404()
-	}
-}
-
-func (this *Wrapper) Log(value string) {
-	this.LoggerAcc.Println("[ACC] [" + this.R.Method + "] [" + value + "] [" + this.RemoteIp +
-		"] [" + this.R.URL.Scheme + "://" + this.R.Host + this.R.URL.RequestURI() +
-		"] [" + this.R.Header.Get("User-Agent") + "]")
-}
-
-func (this *Wrapper) LogError(value string) {
-	this.LoggerErr.Println("[ERR] [" + this.R.Method + "] [" + value + "] [" + this.RemoteIp +
-		"] [" + this.R.URL.Scheme + "://" + this.R.Host + this.R.URL.RequestURI() +
-		"] [" + this.R.Header.Get("User-Agent") + "]")
-}
-
-func (this *Wrapper) TmplGetSystemData() tmplDataSystem {
-	return tmplDataSystem{
-		PathIcoFav:       this.R.URL.Scheme + "://" + this.R.Host + "/assets/sys/fave.ico?v=" + constants.AssetsVersion,
-		PathSvgLogo:      this.R.URL.Scheme + "://" + this.R.Host + "/assets/sys/logo.svg?v=" + constants.AssetsVersion,
-		PathCssStyles:    this.R.URL.Scheme + "://" + this.R.Host + "/assets/sys/styles.css?v=" + constants.AssetsVersion,
-		PathCssCpStyles:  this.R.URL.Scheme + "://" + this.R.Host + "/assets/cp/styles.css?v=" + constants.AssetsVersion,
-		PathCssBootstrap: this.R.URL.Scheme + "://" + this.R.Host + "/assets/sys/bootstrap.css?v=" + constants.AssetsVersion,
-		PathJsJquery:     this.R.URL.Scheme + "://" + this.R.Host + "/assets/sys/jquery.js?v=" + constants.AssetsVersion,
-		PathJsPopper:     this.R.URL.Scheme + "://" + this.R.Host + "/assets/sys/popper.js?v=" + constants.AssetsVersion,
-		PathJsBootstrap:  this.R.URL.Scheme + "://" + this.R.Host + "/assets/sys/bootstrap.js?v=" + constants.AssetsVersion,
-		PathJsCpScripts:  this.R.URL.Scheme + "://" + this.R.Host + "/assets/cp/scripts.js?v=" + constants.AssetsVersion,
-	}
-}
-
-func (this *Wrapper) TmplParseToString(tcont []byte, data interface{}) string {
-	tmpl, err := template.New("template").Parse(string(tcont))
-	if err != nil {
-		return err.Error()
-	}
-	var tpl bytes.Buffer
-	if err := tmpl.Execute(&tpl, data); err != nil {
-		return err.Error()
-	}
-	return tpl.String()
-}
-
-func (this *Wrapper) TmplFrontEnd(tname string, data interface{}) bool {
-	tmpl, err := template.ParseFiles(
-		this.DirVHostHome+"/template"+"/"+tname+".html",
-		this.DirVHostHome+"/template"+"/header.html",
-		this.DirVHostHome+"/template"+"/sidebar.html",
-		this.DirVHostHome+"/template"+"/footer.html",
-	)
-	if err != nil {
-		this.printTmplPageError(err)
-		return true
-	}
-	(*this.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-	tmpl.Execute(*this.W, TmplDataAll{
-		System: this.TmplGetSystemData(),
-		Data:   data,
-	})
-	return true
-}
-
-func (this *Wrapper) TmplBackEnd(tcont []byte, data interface{}) bool {
-	tmpl, err := template.New("template").Parse(string(tcont))
-	if err != nil {
-		this.printTmplPageError(err)
-		return true
-	}
-	(*this.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-	tmpl.Execute(*this.W, TmplDataAll{
-		System: this.TmplGetSystemData(),
-		Data:   data,
-	})
-	return true
-}
-
-func (this *Wrapper) EngineErrMsgOnError(err error) bool {
-	if err != nil {
-		this.PrintEnginePageError(err)
-		return true
-	}
-	return false
-}

+ 0 - 138
.bak/main.go

@@ -1,138 +0,0 @@
-package main
-
-import (
-	"context"
-	"errors"
-	"flag"
-	"fmt"
-	"log"
-	"net/http"
-	"os"
-	"os/signal"
-	"strconv"
-	"strings"
-	"time"
-
-	"golang-fave/constants"
-	"golang-fave/engine/actions"
-	"golang-fave/engine/wrapper"
-)
-
-var ParamHost string
-var ParamPort int
-var ParamWwwDir string
-var VhostHomeDir string
-
-func init() {
-	flag.StringVar(&ParamHost, "host", "0.0.0.0", "server host")
-	flag.IntVar(&ParamPort, "port", 8080, "server port")
-	flag.StringVar(&ParamWwwDir, "dir", "", "virtual hosts directory")
-	flag.Parse()
-}
-
-func main() {
-	if _, err := os.Stat(ParamWwwDir); os.IsNotExist(err) {
-		fmt.Println("Virtual hosts directory is not exists")
-		fmt.Println("Example: ./fave -host 127.0.0.1 -port 80 -dir ./hosts")
-		return
-	}
-	if ParamWwwDir[len(ParamWwwDir)-1] != '/' {
-		ParamWwwDir = ParamWwwDir + "/"
-	}
-
-	// Handle
-	mux := http.NewServeMux()
-	mux.HandleFunc("/", handler)
-
-	srv := &http.Server{
-		Addr:    fmt.Sprintf("%s:%d", ParamHost, ParamPort),
-		Handler: mux,
-	}
-
-	stop := make(chan os.Signal)
-	signal.Notify(stop, os.Interrupt)
-
-	go func() {
-		log.Printf("Starting server at %s:%d", ParamHost, ParamPort)
-		if err := srv.ListenAndServe(); err != nil {
-			if err != http.ErrServerClosed {
-				log.Fatal(err)
-			}
-		}
-	}()
-
-	// Wait for signal
-	<-stop
-
-	log.Printf("Shutting down server...\n")
-	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
-	defer cancel()
-
-	if err := srv.Shutdown(ctx); err != nil {
-		log.Fatal(err)
-	} else {
-		log.Printf("Server is off!")
-	}
-}
-
-func vhExists(vhosthome string) bool {
-	if st, err := os.Stat(vhosthome); !os.IsNotExist(err) {
-		if err == nil {
-			fmode := st.Mode()
-			if fmode.IsDir() {
-				return true
-			}
-		}
-	}
-	return false
-}
-
-func handler(w http.ResponseWriter, r *http.Request) {
-	// Build vhost home dir
-	host := r.Host
-	port := strconv.Itoa(ParamPort)
-	index := strings.Index(host, ":")
-	if index > -1 {
-		port = host[index+1:]
-		host = host[0:index]
-	}
-
-	// Cut "www" if exists
-	if strings.HasPrefix(host, "www.") {
-		host = host[4:]
-	}
-	VhostHomeDir = ParamWwwDir + host
-
-	// Check if virtual host exists
-	if !vhExists(VhostHomeDir) {
-		host = "localhost"
-		VhostHomeDir = ParamWwwDir + host
-	}
-
-	// Set protocol
-	r.URL.Scheme = "http"
-
-	// Set server name
-	w.Header().Set("Server", "fave.pro/"+constants.ServerVersion)
-
-	wrap := wrapper.New(&w, r, host, port, ParamWwwDir, VhostHomeDir)
-
-	// Check if localhost exists
-	if !vhExists(VhostHomeDir) && !strings.HasPrefix(r.URL.Path, "/assets/") {
-		wrap.PrintEnginePageError(errors.New("Folder " + VhostHomeDir + " is not found"))
-		return
-	}
-
-	// Create and start engine
-	wrap.Run(func(wrapper *wrapper.Wrapper) bool {
-		// Actions
-		action := actions.New(wrapper)
-		if action.Run() {
-			wrapper.Session.Save()
-			return true
-		}
-
-		// Pages
-		return handlerPage(wrapper)
-	})
-}

Some files were not shown because too many files changed in this diff