Browse Source

Remove backup files

Vova Tkach 6 years ago
parent
commit
a5d06dcd72

+ 0 - 193
engine/fetdata/bak.blog.go

@@ -1,193 +0,0 @@
-package fetdata
-
-// import (
-// 	"math"
-// 	"strconv"
-// 	"strings"
-
-// 	"golang-fave/engine/sqlw"
-// 	"golang-fave/utils"
-// )
-
-// func (this *FERData) postsGetCount(buf string, cat int) (int, int) {
-// 	if cat == 0 {
-// 		var num int
-// 		if err := this.wrap.DB.QueryRow(`
-// 			SELECT
-// 				COUNT(*)
-// 			FROM
-// 				blog_posts
-// 			WHERE
-// 				active = 1
-// 			;
-// 		`).Scan(&num); err == nil {
-// 			pear_page := 2
-// 			max_pages := int(math.Ceil(float64(num) / float64(pear_page)))
-// 			curr_page := 1
-// 			p := this.wrap.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
-// 			return limit_offset, pear_page
-// 		}
-// 	} else {
-// 		var num int
-// 		if err := this.wrap.DB.QueryRow(`
-// 			SELECT
-// 				COUNT(blog_posts.id)
-// 			FROM
-// 				blog_posts
-// 				LEFT JOIN blog_cat_post_rel ON blog_cat_post_rel.post_id = blog_posts.id
-// 			WHERE
-// 				blog_posts.active = 1 AND
-// 				blog_cat_post_rel.category_id = ?
-// 			;
-// 		`, cat).Scan(&num); err == nil {
-// 			pear_page := 2
-// 			max_pages := int(math.Ceil(float64(num) / float64(pear_page)))
-// 			curr_page := 1
-// 			p := this.wrap.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
-// 			return limit_offset, pear_page
-// 		}
-// 	}
-// 	return 0, 0
-// }
-
-// func (this *FERData) postsToBuffer(buf string, cat int, order string) {
-// 	if this.bufferPosts == nil {
-// 		this.bufferPosts = map[string][]*BlogPost{}
-// 	}
-// 	if _, ok := this.bufferPosts[buf]; !ok {
-// 		var posts []*BlogPost
-
-// 		limit_offset, pear_page := this.postsGetCount(buf, cat)
-
-// 		var rows *sqlw.Rows
-// 		var err error
-
-// 		if cat == 0 {
-// 			rows, err = this.wrap.DB.Query(`
-// 				SELECT
-// 					blog_posts.id,
-// 					blog_posts.user,
-// 					blog_posts.name,
-// 					blog_posts.alias,
-// 					blog_posts.content,
-// 					UNIX_TIMESTAMP(blog_posts.datetime) AS datetime,
-// 					blog_posts.active
-// 				FROM
-// 					blog_posts
-// 				WHERE
-// 					blog_posts.active = 1
-// 				ORDER BY
-// 					blog_posts.id `+order+`
-// 				LIMIT ?, ?;
-// 			`, limit_offset, pear_page)
-// 		} else {
-// 			rows, err = this.wrap.DB.Query(`
-// 				SELECT
-// 					blog_posts.id,
-// 					blog_posts.user,
-// 					blog_posts.name,
-// 					blog_posts.alias,
-// 					blog_posts.content,
-// 					UNIX_TIMESTAMP(blog_posts.datetime) AS datetime,
-// 					blog_posts.active
-// 				FROM
-// 					blog_posts
-// 					LEFT JOIN blog_cat_post_rel ON blog_cat_post_rel.post_id = blog_posts.id
-// 				WHERE
-// 					blog_posts.active = 1 AND
-// 					blog_cat_post_rel.category_id = ?
-// 				ORDER BY
-// 					blog_posts.id `+order+`
-// 				LIMIT ?, ?;
-// 			`, cat, limit_offset, pear_page)
-// 		}
-
-// 		if err == nil {
-// 			var f_id int
-// 			var f_user int
-// 			var f_name string
-// 			var f_alias string
-// 			var f_content string
-// 			var f_datetime int
-// 			var f_active int
-// 			for rows.Next() {
-// 				err = rows.Scan(&f_id, &f_user, &f_name, &f_alias, &f_content, &f_datetime, &f_active)
-// 				if err == nil {
-// 					posts = append(posts, &BlogPost{
-// 						id:       f_id,
-// 						user:     f_user,
-// 						name:     f_name,
-// 						alias:    f_alias,
-// 						content:  f_content,
-// 						datetime: f_datetime,
-// 						active:   f_active,
-// 					})
-// 				}
-// 			}
-// 			rows.Close()
-// 		}
-// 		this.bufferPosts[buf] = posts
-// 	}
-// }
-
-// func (this *FERData) BlogPosts() []*BlogPost {
-// 	return this.BlogPostsOrder("DESC")
-// }
-
-// func (this *FERData) BlogPostsOrder(order string) []*BlogPost {
-// 	posts_order := "DESC"
-
-// 	if strings.ToLower(order) == "asc" {
-// 		posts_order = "ASC"
-// 	}
-
-// 	buf := "posts_" + posts_order
-// 	this.postsToBuffer(buf, 0, posts_order)
-// 	return this.bufferPosts[buf]
-// }
-
-// func (this *FERData) BlogPostsOfCat(cat int) []*BlogPost {
-// 	return this.BlogPostsOfCatOrder(cat, "DESC")
-// }
-
-// func (this *FERData) BlogPostsOfCatOrder(cat int, order string) []*BlogPost {
-// 	posts_order := "DESC"
-
-// 	if strings.ToLower(order) == "asc" {
-// 		posts_order = "ASC"
-// 	}
-
-// 	buf := "posts_" + posts_order + "_" + utils.IntToStr(cat)
-// 	this.postsToBuffer(buf, cat, posts_order)
-// 	return this.bufferPosts[buf]
-// }

+ 0 - 44
engine/fetdata/bak.blog_post.go

@@ -1,44 +0,0 @@
-package fetdata
-
-// import (
-// 	"html/template"
-// 	"time"
-// )
-
-// type BlogPost struct {
-// 	id       int
-// 	user     int
-// 	name     string
-// 	alias    string
-// 	content  string
-// 	datetime int
-// 	active   int
-// }
-
-// func (this *BlogPost) Id() int {
-// 	return this.id
-// }
-
-// func (this *BlogPost) Name() string {
-// 	return this.name
-// }
-
-// func (this *BlogPost) Alias() string {
-// 	return this.alias
-// }
-
-// func (this *BlogPost) Permalink() string {
-// 	return "/blog/" + this.alias + "/"
-// }
-
-// func (this *BlogPost) Content() template.HTML {
-// 	return template.HTML(this.content)
-// }
-
-// func (this *BlogPost) DateTime() int {
-// 	return this.datetime
-// }
-
-// func (this *BlogPost) DateTimeFormat(format string) string {
-// 	return time.Unix(int64(this.datetime), 0).Format(format)
-// }

+ 0 - 110
engine/fetdata/bak.content.go

@@ -1,110 +0,0 @@
-package fetdata
-
-// import (
-// 	"html/template"
-// 	"time"
-
-// 	"golang-fave/utils"
-// )
-
-// func (this *FERData) Id() int {
-// 	if this.dataRow != nil {
-// 		if this.wrap.CurrModule == "index" {
-// 			return this.dataRow.(*utils.MySql_page).A_id
-// 		} else if this.wrap.CurrModule == "blog" {
-// 			if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
-// 				// Blog category
-// 				return this.dataRow.(*utils.MySql_blog_category).A_id
-// 			} else {
-// 				// Blog post
-// 				return this.dataRow.(*utils.MySql_blog_posts).A_id
-// 			}
-// 		}
-// 	}
-// 	return 0
-// }
-
-// func (this *FERData) Name() string {
-// 	if this.dataRow != nil {
-// 		if this.wrap.CurrModule == "index" {
-// 			return this.dataRow.(*utils.MySql_page).A_name
-// 		} else if this.wrap.CurrModule == "blog" {
-// 			if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
-// 				// Blog category
-// 				return this.dataRow.(*utils.MySql_blog_category).A_name
-// 			} else {
-// 				// Blog post
-// 				return this.dataRow.(*utils.MySql_blog_posts).A_name
-// 			}
-// 		}
-// 	}
-// 	return ""
-// }
-
-// func (this *FERData) Alias() string {
-// 	if this.dataRow != nil {
-// 		if this.wrap.CurrModule == "index" {
-// 			return this.dataRow.(*utils.MySql_page).A_alias
-// 		} else if this.wrap.CurrModule == "blog" {
-// 			if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
-// 				// Blog category
-// 				return this.dataRow.(*utils.MySql_blog_category).A_alias
-// 			} else {
-// 				// Blog post
-// 				return this.dataRow.(*utils.MySql_blog_posts).A_alias
-// 			}
-// 		}
-// 	}
-// 	return ""
-// }
-
-// func (this *FERData) Content() template.HTML {
-// 	if this.dataRow != nil {
-// 		if this.wrap.CurrModule == "index" {
-// 			return template.HTML(this.dataRow.(*utils.MySql_page).A_content)
-// 		} else if this.wrap.CurrModule == "blog" {
-// 			if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
-// 				// Blog category
-// 				return template.HTML("")
-// 			} else {
-// 				// Blog post
-// 				return template.HTML(this.dataRow.(*utils.MySql_blog_posts).A_content)
-// 			}
-// 		}
-// 	}
-// 	return template.HTML("")
-// }
-
-// func (this *FERData) DateTime() int {
-// 	if this.dataRow != nil {
-// 		if this.wrap.CurrModule == "index" {
-// 			return this.dataRow.(*utils.MySql_page).A_datetime
-// 		} else if this.wrap.CurrModule == "blog" {
-// 			if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
-// 				// Blog category
-// 				return 0
-// 			} else {
-// 				// Blog post
-// 				return this.dataRow.(*utils.MySql_blog_posts).A_datetime
-// 			}
-// 		}
-// 	}
-// 	return 0
-// }
-
-// func (this *FERData) DateTimeFormat(format string) string {
-// 	if this.dataRow != nil {
-// 		if this.wrap.CurrModule == "index" {
-// 			return time.Unix(int64(this.dataRow.(*utils.MySql_page).A_datetime), 0).Format(format)
-// 		} else if this.wrap.CurrModule == "blog" {
-// 			if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
-// 				// Blog category
-// 				return ""
-// 			} else {
-// 				// Blog post
-// 				return time.Unix(int64(this.dataRow.(*utils.MySql_blog_posts).A_datetime), 0).Format(format)
-// 			}
-// 		}
-// 	}
-// 	return ""
-// }

+ 0 - 65
engine/fetdata/bak.meta_data.go

@@ -1,65 +0,0 @@
-package fetdata
-
-// import (
-// 	"golang-fave/utils"
-// )
-
-// func (this *FERData) MetaTitle() string {
-// 	if this.dataRow != nil {
-// 		if this.wrap.CurrModule == "index" {
-// 			return this.dataRow.(*utils.MySql_page).A_meta_title
-// 		} else if this.wrap.CurrModule == "blog" {
-// 			if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
-// 				// Blog category
-// 				return ""
-// 			} else if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] != "" {
-// 				// Blog post
-// 				return ""
-// 			} else {
-// 				// Blog
-// 				return ""
-// 			}
-// 		}
-// 	}
-// 	return ""
-// }
-
-// func (this *FERData) MetaKeywords() string {
-// 	if this.dataRow != nil {
-// 		if this.wrap.CurrModule == "index" {
-// 			return this.dataRow.(*utils.MySql_page).A_meta_keywords
-// 		} else if this.wrap.CurrModule == "blog" {
-// 			if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
-// 				// Blog category
-// 				return ""
-// 			} else if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] != "" {
-// 				// Blog post
-// 				return ""
-// 			} else {
-// 				// Blog
-// 				return ""
-// 			}
-// 		}
-// 	}
-// 	return ""
-// }
-
-// func (this *FERData) MetaDescription() string {
-// 	if this.dataRow != nil {
-// 		if this.wrap.CurrModule == "index" {
-// 			return this.dataRow.(*utils.MySql_page).A_meta_description
-// 		} else if this.wrap.CurrModule == "blog" {
-// 			if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
-// 				// Blog category
-// 				return ""
-// 			} else if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] != "" {
-// 				// Blog post
-// 				return ""
-// 			} else {
-// 				// Blog
-// 				return ""
-// 			}
-// 		}
-// 	}
-// 	return ""
-// }

+ 0 - 74
engine/fetdata/bak.user.go

@@ -1,74 +0,0 @@
-package fetdata
-
-// import (
-// 	"golang-fave/utils"
-// )
-
-// func (this *FERData) userToBuffer() {
-// 	if this.bufferUser == nil {
-// 		user := utils.MySql_user{}
-// 		if this.wrap.S.GetInt("UserId", 0) > 0 {
-// 			err := this.wrap.DB.QueryRow(`
-// 				SELECT
-// 					id,
-// 					first_name,
-// 					last_name,
-// 					email,
-// 					admin,
-// 					active
-// 				FROM
-// 					users
-// 				WHERE
-// 					id = ?
-// 				LIMIT 1;`,
-// 				this.wrap.S.GetInt("UserId", 0),
-// 			).Scan(
-// 				&user.A_id,
-// 				&user.A_first_name,
-// 				&user.A_last_name,
-// 				&user.A_email,
-// 				&user.A_admin,
-// 				&user.A_active,
-// 			)
-// 			if err != nil {
-// 				this.wrap.LogError(err.Error())
-// 			}
-// 		}
-// 		this.bufferUser = &user
-// 	}
-// }
-
-// func (this *FERData) UserIsLoggedIn() bool {
-// 	this.userToBuffer()
-// 	return this.bufferUser.A_id > 0
-// }
-
-// func (this *FERData) UserID() int {
-// 	this.userToBuffer()
-// 	return this.bufferUser.A_id
-// }
-
-// func (this *FERData) UserFirstName() string {
-// 	this.userToBuffer()
-// 	return this.bufferUser.A_first_name
-// }
-
-// func (this *FERData) UserLastName() string {
-// 	this.userToBuffer()
-// 	return this.bufferUser.A_last_name
-// }
-
-// func (this *FERData) UserEmail() string {
-// 	this.userToBuffer()
-// 	return this.bufferUser.A_email
-// }
-
-// func (this *FERData) UserIsAdmin() bool {
-// 	this.userToBuffer()
-// 	return this.bufferUser.A_admin > 0
-// }
-
-// func (this *FERData) UserIsActive() bool {
-// 	this.userToBuffer()
-// 	return this.bufferUser.A_active > 0
-// }