Browse Source

Security, CP action audit

Vova Tkach 5 years ago
parent
commit
c1e5d72ec7

+ 4 - 4
modules/module_blog_act_delete.go

@@ -20,18 +20,18 @@ func (this *Modules) RegisterAction_BlogDelete() *Action {
 
 		if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM blog_posts WHERE id = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT id FROM blog_posts WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT post_id FROM blog_cat_post_rel WHERE post_id = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT post_id FROM blog_cat_post_rel WHERE post_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Delete target post with category connection data
-			if _, err := tx.Exec("DELETE FROM blog_cat_post_rel WHERE post_id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM blog_cat_post_rel WHERE post_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM blog_posts WHERE id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM blog_posts WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			return nil

+ 5 - 5
modules/module_blog_act_modify.go

@@ -64,7 +64,7 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 					pf_briefly,
 					pf_content,
 					utils.UnixTimestampToMySqlDateTime(utils.GetCurrentUnixTimestamp()),
-					pf_active,
+					utils.StrToInt(pf_active),
 				)
 				if err != nil {
 					return err
@@ -121,10 +121,10 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 		} else {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
 				// Block rows
-				if _, err := tx.Exec("SELECT id FROM blog_posts WHERE id = ? FOR UPDATE;", pf_id); err != nil {
+				if _, err := tx.Exec("SELECT id FROM blog_posts WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("SELECT post_id FROM blog_cat_post_rel WHERE post_id = ? FOR UPDATE;", pf_id); err != nil {
+				if _, err := tx.Exec("SELECT post_id FROM blog_cat_post_rel WHERE post_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
 
@@ -143,14 +143,14 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 					pf_alias,
 					pf_briefly,
 					pf_content,
-					pf_active,
+					utils.StrToInt(pf_active),
 					utils.StrToInt(pf_id),
 				); err != nil {
 					return err
 				}
 
 				// Delete post and categories relations
-				if _, err := tx.Exec("DELETE FROM blog_cat_post_rel WHERE post_id = ?;", pf_id); err != nil {
+				if _, err := tx.Exec("DELETE FROM blog_cat_post_rel WHERE post_id = ?;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
 

+ 4 - 4
modules/module_blog_categories_act_delete.go

@@ -23,18 +23,18 @@ func (this *Modules) RegisterAction_BlogCategoriesDelete() *Action {
 			if _, err := tx.Exec("SELECT id FROM blog_cats FOR UPDATE;"); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT category_id FROM blog_cat_post_rel WHERE category_id = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT category_id FROM blog_cat_post_rel WHERE category_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Process
-			if _, err := tx.Exec("DELETE FROM blog_cat_post_rel WHERE category_id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM blog_cat_post_rel WHERE category_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT @ml := lft, @mr := rgt FROM blog_cats WHERE id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT @ml := lft, @mr := rgt FROM blog_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM blog_cats WHERE id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM blog_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			if _, err := tx.Exec("UPDATE blog_cats SET lft = lft - 1, rgt = rgt - 1 WHERE lft > @ml AND rgt < @mr;"); err != nil {

+ 8 - 8
modules/module_blog_categories_act_modify.go

@@ -16,7 +16,7 @@ func (this *Modules) blog_ActionCategoryAdd(wrap *wrapper.Wrapper, pf_id, pf_nam
 		}
 
 		// Process
-		if _, err := tx.Exec("SELECT @mr := rgt FROM blog_cats WHERE id = ?;", pf_parent); err != nil {
+		if _, err := tx.Exec("SELECT @mr := rgt FROM blog_cats WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
 			return err
 		}
 		if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt + 2 WHERE rgt > @mr;"); err != nil {
@@ -25,7 +25,7 @@ func (this *Modules) blog_ActionCategoryAdd(wrap *wrapper.Wrapper, pf_id, pf_nam
 		if _, err := tx.Exec("UPDATE blog_cats SET lft = lft + 2 WHERE lft > @mr;"); err != nil {
 			return err
 		}
-		if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt + 2 WHERE id = ?;", pf_parent); err != nil {
+		if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt + 2 WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
 			return err
 		}
 		res, err := tx.Exec("INSERT INTO blog_cats (id, user, name, alias, lft, rgt) VALUES (NULL, ?, ?, ?, @mr, @mr + 1);", wrap.User.A_id, pf_name, pf_alias)
@@ -57,7 +57,7 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				;`,
 				pf_name,
 				pf_alias,
-				pf_id,
+				utils.StrToInt(pf_id),
 			); err != nil {
 				return err
 			}
@@ -76,13 +76,13 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 
 		var parentL int
 		var parentR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, pf_parent).Scan(&parentL, &parentR); err != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, utils.StrToInt(pf_parent)).Scan(&parentL, &parentR); err != nil {
 			return err
 		}
 
 		var targetL int
 		var targetR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, pf_id).Scan(&targetL, &targetR); err != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, utils.StrToInt(pf_id)).Scan(&targetL, &targetR); err != nil {
 			return err
 		}
 
@@ -117,7 +117,7 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt + ? WHERE rgt > ? and rgt < ?;", step, parentR, targetL); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt + ? WHERE id = ?;", step, pf_parent); err != nil {
+				if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt + ? WHERE id = ?;", step, utils.StrToInt(pf_parent)); err != nil {
 					return err
 				}
 
@@ -155,7 +155,7 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 		}
 
 		// Update target cat data
-		if _, err := tx.Exec("UPDATE blog_cats SET name = ?, alias = ? WHERE id = ?;", pf_name, pf_alias, pf_id); err != nil {
+		if _, err := tx.Exec("UPDATE blog_cats SET name = ?, alias = ? WHERE id = ?;", pf_name, pf_alias, utils.StrToInt(pf_id)); err != nil {
 			return err
 		}
 
@@ -208,7 +208,7 @@ func (this *Modules) RegisterAction_BlogCategoriesModify() *Action {
 					id > 1 AND
 					id = ?
 				LIMIT 1;`,
-				pf_parent,
+				utils.StrToInt(pf_parent),
 			).Scan(&parentId)
 			if err != nil {
 				wrap.MsgError(err.Error())

+ 1 - 1
modules/module_index_act_delete.go

@@ -20,7 +20,7 @@ func (this *Modules) RegisterAction_IndexDelete() *Action {
 
 		err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
 			// Process
-			if _, err := tx.Exec("DELETE FROM pages WHERE id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM pages WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			return nil

+ 2 - 2
modules/module_index_act_modify.go

@@ -67,7 +67,7 @@ func (this *Modules) RegisterAction_IndexModify() *Action {
 					pf_meta_keywords,
 					pf_meta_description,
 					utils.UnixTimestampToMySqlDateTime(utils.GetCurrentUnixTimestamp()),
-					pf_active,
+					utils.StrToInt(pf_active),
 				)
 				if err != nil {
 					return err
@@ -104,7 +104,7 @@ func (this *Modules) RegisterAction_IndexModify() *Action {
 					pf_meta_title,
 					pf_meta_keywords,
 					pf_meta_description,
-					pf_active,
+					utils.StrToInt(pf_active),
 					utils.StrToInt(pf_id),
 				)
 				if err != nil {

+ 8 - 8
modules/module_shop_act_delete.go

@@ -22,16 +22,16 @@ func (this *Modules) RegisterAction_ShopDelete() *Action {
 
 		if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT product_id FROM shop_cat_product_rel WHERE product_id = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT product_id FROM shop_cat_product_rel WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT product_id FROM shop_filter_product_values WHERE product_id = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT product_id FROM shop_filter_product_values WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT product_id FROM shop_product_images WHERE product_id = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT product_id FROM shop_product_images WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
@@ -62,18 +62,18 @@ func (this *Modules) RegisterAction_ShopDelete() *Action {
 					}
 				}
 			}
-			if _, err := tx.Exec("DELETE FROM shop_product_images WHERE product_id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM shop_product_images WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Delete target product with category connection data
-			if _, err := tx.Exec("DELETE FROM shop_filter_product_values WHERE product_id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM shop_filter_product_values WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM shop_cat_product_rel WHERE product_id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM shop_cat_product_rel WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM shop_products WHERE id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM shop_products WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			return nil

+ 3 - 3
modules/module_shop_act_modify.go

@@ -116,7 +116,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 					pf_briefly,
 					pf_content,
 					utils.UnixTimestampToMySqlDateTime(utils.GetCurrentUnixTimestamp()),
-					pf_active,
+					utils.StrToInt(pf_active),
 				)
 				if err != nil {
 					return err
@@ -225,14 +225,14 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 					utils.StrToInt(pf_category),
 					pf_briefly,
 					pf_content,
-					pf_active,
+					utils.StrToInt(pf_active),
 					utils.StrToInt(pf_id),
 				); err != nil {
 					return err
 				}
 
 				// Delete product and categories relations
-				if _, err := tx.Exec("DELETE FROM shop_cat_product_rel WHERE product_id = ?;", pf_id); err != nil {
+				if _, err := tx.Exec("DELETE FROM shop_cat_product_rel WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
 

+ 3 - 3
modules/module_shop_act_upload_delete.go

@@ -29,15 +29,15 @@ func (this *Modules) RegisterAction_ShopUploadDelete() *Action {
 
 		if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT product_id FROM shop_product_images WHERE product_id = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT product_id FROM shop_product_images WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Delete row
-			if _, err := tx.Exec("DELETE FROM shop_product_images WHERE product_id = ? AND filename = ?;", pf_id, pf_file); err != nil {
+			if _, err := tx.Exec("DELETE FROM shop_product_images WHERE product_id = ? AND filename = ?;", utils.StrToInt(pf_id), pf_file); err != nil {
 				return err
 			}
 

+ 6 - 6
modules/module_shop_categories_act_delete.go

@@ -23,26 +23,26 @@ func (this *Modules) RegisterAction_ShopCategoriesDelete() *Action {
 			if _, err := tx.Exec("SELECT id FROM shop_cats FOR UPDATE;"); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT category_id FROM shop_cat_product_rel WHERE category_id = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT category_id FROM shop_cat_product_rel WHERE category_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT id FROM shop_products WHERE category = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT id FROM shop_products WHERE category = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Set root category
-			if _, err := tx.Exec("UPDATE shop_products SET category = 1 WHERE category = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("UPDATE shop_products SET category = 1 WHERE category = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Process
-			if _, err := tx.Exec("DELETE FROM shop_cat_product_rel WHERE category_id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM shop_cat_product_rel WHERE category_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT @ml := lft, @mr := rgt FROM shop_cats WHERE id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT @ml := lft, @mr := rgt FROM shop_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM shop_cats WHERE id = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM shop_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			if _, err := tx.Exec("UPDATE shop_cats SET lft = lft - 1, rgt = rgt - 1 WHERE lft > @ml AND rgt < @mr;"); err != nil {

+ 8 - 8
modules/module_shop_categories_act_modify.go

@@ -16,7 +16,7 @@ func (this *Modules) shop_ActionCategoryAdd(wrap *wrapper.Wrapper, pf_id, pf_nam
 		}
 
 		// Process
-		if _, err := tx.Exec("SELECT @mr := rgt FROM shop_cats WHERE id = ?;", pf_parent); err != nil {
+		if _, err := tx.Exec("SELECT @mr := rgt FROM shop_cats WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
 			return err
 		}
 		if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt + 2 WHERE rgt > @mr;"); err != nil {
@@ -25,7 +25,7 @@ func (this *Modules) shop_ActionCategoryAdd(wrap *wrapper.Wrapper, pf_id, pf_nam
 		if _, err := tx.Exec("UPDATE shop_cats SET lft = lft + 2 WHERE lft > @mr;"); err != nil {
 			return err
 		}
-		if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt + 2 WHERE id = ?;", pf_parent); err != nil {
+		if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt + 2 WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
 			return err
 		}
 		res, err := tx.Exec("INSERT INTO shop_cats (id, user, name, alias, lft, rgt) VALUES (NULL, ?, ?, ?, @mr, @mr + 1);", wrap.User.A_id, pf_name, pf_alias)
@@ -57,7 +57,7 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				;`,
 				pf_name,
 				pf_alias,
-				pf_id,
+				utils.StrToInt(pf_id),
 			); err != nil {
 				return err
 			}
@@ -76,13 +76,13 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 
 		var parentL int
 		var parentR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, pf_parent).Scan(&parentL, &parentR); err != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, utils.StrToInt(pf_parent)).Scan(&parentL, &parentR); err != nil {
 			return err
 		}
 
 		var targetL int
 		var targetR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, pf_id).Scan(&targetL, &targetR); err != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, utils.StrToInt(pf_id)).Scan(&targetL, &targetR); err != nil {
 			return err
 		}
 
@@ -117,7 +117,7 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt + ? WHERE rgt > ? and rgt < ?;", step, parentR, targetL); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt + ? WHERE id = ?;", step, pf_parent); err != nil {
+				if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt + ? WHERE id = ?;", step, utils.StrToInt(pf_parent)); err != nil {
 					return err
 				}
 
@@ -155,7 +155,7 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 		}
 
 		// Update target cat data
-		if _, err := tx.Exec("UPDATE shop_cats SET name = ?, alias = ? WHERE id = ?;", pf_name, pf_alias, pf_id); err != nil {
+		if _, err := tx.Exec("UPDATE shop_cats SET name = ?, alias = ? WHERE id = ?;", pf_name, pf_alias, utils.StrToInt(pf_id)); err != nil {
 			return err
 		}
 
@@ -208,7 +208,7 @@ func (this *Modules) RegisterAction_ShopCategoriesModify() *Action {
 					id > 1 AND
 					id = ?
 				LIMIT 1;`,
-				pf_parent,
+				utils.StrToInt(pf_parent),
 			).Scan(&parentId)
 			if err != nil {
 				wrap.MsgError(err.Error())

+ 1 - 1
modules/module_shop_currencies_act_modify.go

@@ -77,7 +77,7 @@ func (this *Modules) RegisterAction_ShopCurrenciesModify() *Action {
 		} else {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
 				// Block rows
-				if _, err := tx.Exec("SELECT id FROM shop_currencies WHERE id = ? FOR UPDATE;", pf_id); err != nil {
+				if _, err := tx.Exec("SELECT id FROM shop_currencies WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
 

+ 8 - 8
modules/module_users_act_delete.go

@@ -20,30 +20,30 @@ func (this *Modules) RegisterAction_UsersDelete() *Action {
 
 		err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM blog_cats WHERE user = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT id FROM blog_cats WHERE user = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT id FROM blog_posts WHERE user = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT id FROM blog_posts WHERE user = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT id FROM pages WHERE user = ? FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT id FROM pages WHERE user = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT id FROM users WHERE id = ? and id > 1 FOR UPDATE;", pf_id); err != nil {
+			if _, err := tx.Exec("SELECT id FROM users WHERE id = ? and id > 1 FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Process
-			if _, err := tx.Exec("UPDATE blog_cats SET user = 1 WHERE user = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("UPDATE blog_cats SET user = 1 WHERE user = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("UPDATE blog_posts SET user = 1 WHERE user = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("UPDATE blog_posts SET user = 1 WHERE user = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("UPDATE pages SET user = 1 WHERE user = ?;", pf_id); err != nil {
+			if _, err := tx.Exec("UPDATE pages SET user = 1 WHERE user = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM users WHERE id = ? and id > 1;", pf_id); err != nil {
+			if _, err := tx.Exec("DELETE FROM users WHERE id = ? and id > 1;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			return nil

+ 2 - 2
modules/module_users_act_modify.go

@@ -72,7 +72,7 @@ func (this *Modules) RegisterAction_UsersModify() *Action {
 					pf_email,
 					pf_password,
 					pf_admin,
-					pf_active,
+					utils.StrToInt(pf_active),
 				)
 				if err != nil {
 					return err
@@ -106,7 +106,7 @@ func (this *Modules) RegisterAction_UsersModify() *Action {
 						pf_last_name,
 						pf_email,
 						pf_admin,
-						pf_active,
+						utils.StrToInt(pf_active),
 						utils.StrToInt(pf_id),
 					)
 					if err != nil {