Skip to content

Commit 3f27070

Browse files
author
bugfish\bugfishtm
committed
3.36
1 parent 6e837b9 commit 3f27070

File tree

5 files changed

+65
-16
lines changed

5 files changed

+65
-16
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
4+
## [3.36] - 2025-01-13
5+
### Changes
6+
- x_class_mail_template: Now contains Database Key for Language (Reinstallation Required of Table)
7+
- x_class_mail_template: name_exists($name) function now gives back ID instead of true.
8+
- x_class_mail_template: Changes in different functions to use languages keys for templates. (Multi Language)
9+
- x_class_user: Added Additional Table fields for SuitefishCMS (No Reinstallation required, fields are just optional for use with suitefish-cms)
10+
- x_class_user: New User Table Fields: user_firstname, user_lastname, user_street, user_company, user_postcode, user_country, user_city, user_region, user_tel
11+
312
## [3.35] - 2024-11-29
413
### Changes
514
- Changes on the Documentation

_framework/classes/x_class_mail_template.php

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class x_class_mail_template {
3131
private $mysql = false; // MySQL for Templates
3232
private $table = false; // Table for Templates
3333
private $section = false; // Section for Templates
34+
private $lang = false; // Section for Templates
3435

3536
// Set Header
3637
public $header = "";
@@ -49,7 +50,9 @@ public function set_template($name) {
4950
$bind[0]["type"] = "s";
5051
$bind[1]["value"] = $this->section;
5152
$bind[1]["type"] = "s";
52-
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE name = ? AND section = ?", false, $bind);
53+
$bind[2]["value"] = $this->lang;
54+
$bind[2]["type"] = "s";
55+
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE name = ? AND section = ? AND lang = ?", false, $bind);
5356
if(is_array($ar)) {
5457
$this->subject = $ar["subject"];
5558
$this->content = $ar["content"];
@@ -65,17 +68,19 @@ private function create_table() {
6568
`subject` text NULL COMMENT 'Template Subject',
6669
`description` text NULL COMMENT 'Template Description',
6770
`content` text DEFAULT NULL COMMENT 'Template Content',
71+
`lang` VARCHAR(32) DEFAULT '' COMMENT 'Language Key',
6872
`section` VARCHAR(128) DEFAULT NULL COMMENT 'Related Section',
6973
`creation` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation',
7074
`modification` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Modification | Auto - Set',
7175
PRIMARY KEY (`id`),
72-
UNIQUE KEY `x_class_mail_template` (`name`, `section`));");}
76+
UNIQUE KEY `x_class_mail_template` (`name`, `lang`, `section`));");}
7377

7478
// Construct
75-
function __construct($mysql, $table, $section = "") {
79+
function __construct($mysql, $table, $section = "", $lang = "") {
7680
$this->mysql = $mysql;
7781
$this->table = @substr(trim($table ?? ''), 0, 256);
7882
$this->section = @substr(trim($section ?? ''), 0, 127);
83+
$this->lang = @substr(trim($lang ?? ''), 0, 127);
7984
if(!$this->mysql->table_exists($table)) { $this->create_table(); $this->mysql->free_all(); }}
8085

8186
// Substitutions
@@ -114,12 +119,14 @@ public function get_subject($substitute = false) {
114119
}
115120

116121
// Setup new Mail template
117-
public function setup($name, $subject, $content, $description = "", $overwrite = false) {
122+
public function setup($name, $subject, $content, $description = "", $overwrite = false, $lang = "") {
118123
$bind[0]["value"] = $name;
119124
$bind[0]["type"] = "s";
120125
$bind[1]["value"] = $this->section;
121126
$bind[1]["type"] = "s";
122-
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE name = ? AND section = ?", false, $bind);
127+
$bind[2]["value"] = $this->lang;
128+
$bind[2]["type"] = "s";
129+
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE name = ? AND section = ? AND lang = ?", false, $bind);
123130
if(is_array($ar)) {
124131
if($overwrite) {
125132
$bind[0]["value"] = $name;
@@ -134,7 +141,9 @@ public function setup($name, $subject, $content, $description = "", $overwrite =
134141
$bind[4]["type"] = "s";
135142
$bind[5]["type"] = "s";
136143
$bind[5]["value"] = $this->section;
137-
$this->mysql->query("UPDATE `".$this->table."` SET name = ?, subject = ?, content = ?, description = ? WHERE name = ? AND section = ?", $bind);
144+
$bind[6]["type"] = "s";
145+
$bind[6]["value"] = $this->lang;
146+
$this->mysql->query("UPDATE `".$this->table."` SET name = ?, subject = ?, content = ?, description = ? WHERE name = ? AND section = ? AND lang = ?", $bind);
138147
}
139148
} else {
140149
$bind[0]["value"] = $name;
@@ -147,7 +156,9 @@ public function setup($name, $subject, $content, $description = "", $overwrite =
147156
$bind[3]["type"] = "s";
148157
$bind[4]["type"] = "s";
149158
$bind[4]["value"] = $this->section;
150-
$this->mysql->query("INSERT IGNORE INTO `".$this->table."` (name, subject, content, description, section) VALUES(?, ?, ?, ?, ?);", $bind);
159+
$bind[5]["type"] = "s";
160+
$bind[5]["value"] = $this->lang;
161+
$this->mysql->query("INSERT IGNORE INTO `".$this->table."` (name, subject, content, description, section, lang) VALUES(?, ?, ?, ?, ?, ?);", $bind);
151162
return $this->mysql->insert_id;
152163
}
153164
}
@@ -169,7 +180,9 @@ public function change($id, $name, $subject, $content, $description = "") {
169180
$bind[3]["value"] = $name;
170181
$bind[4]["type"] = "s";
171182
$bind[4]["value"] = $this->section;
172-
$this->mysql->query("UPDATE `".$this->table."` SET subject = ?, content = ?, description = ?, name = ? WHERE id = '".$id."' AND section = ?", $bind);
183+
$bind[5]["type"] = "s";
184+
$bind[5]["value"] = $this->lang;
185+
$this->mysql->query("UPDATE `".$this->table."` SET subject = ?, content = ?, description = ?, name = ? WHERE id = '".$id."' AND section = ? AND lang = ?", $bind);
173186
}
174187
}
175188

@@ -178,9 +191,11 @@ public function name_exists($name) {
178191
$bind[0]["type"] = "s";
179192
$bind[1]["type"] = "s";
180193
$bind[1]["value"] = $this->section;
181-
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE name = ? AND section = ?", false, $bind);
194+
$bind[2]["type"] = "s";
195+
$bind[2]["value"] = $this->lang;
196+
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE name = ? AND section = ? AND lang = ?", false, $bind);
182197
if(is_array($ar)) {
183-
return true;
198+
return $ar["id"];
184199
} else {
185200
return false;
186201
}
@@ -190,7 +205,9 @@ public function get_name_by_id($id) {
190205
if(!is_numeric($id)) { return false; }
191206
$b[0]["type"] = "s";
192207
$b[0]["value"] = $this->section;
193-
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE id = '".$id."' AND section = ?", false, $b);
208+
$b[1]["type"] = "s";
209+
$b[1]["value"] = $this->lang;
210+
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE id = '".$id."' AND section = ? AND lang = ?", false, $b);
194211
if(is_array($ar)) {
195212
return $ar["name"];
196213
} else {
@@ -202,7 +219,9 @@ public function id_exists($id) {
202219
if(!is_numeric($id)) { return false; }
203220
$b[0]["type"] = "s";
204221
$b[0]["value"] = $this->section;
205-
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE id = '".$id."' AND section = ?", false, $b);
222+
$b[1]["type"] = "s";
223+
$b[1]["value"] = $this->lang;
224+
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE id = '".$id."' AND section = ? AND lang = ?", false, $b);
206225
if(is_array($ar)) {
207226
return true;
208227
} else {
@@ -214,14 +233,26 @@ public function id_delete($id) {
214233
if(!is_numeric($id)) { return false; }
215234
$b[0]["type"] = "s";
216235
$b[0]["value"] = $this->section;
217-
return $this->mysql->query("DELETE FROM `".$this->table."` WHERE id = '".$id."' AND section = ?", $b);
236+
$b[1]["type"] = "s";
237+
$b[1]["value"] = $this->lang;
238+
return $this->mysql->query("DELETE FROM `".$this->table."` WHERE id = '".$id."' AND section = ? AND lang = ?", $b);
239+
}
240+
241+
public function name_delete($name) {
242+
$b[0]["type"] = "s";
243+
$b[0]["value"] = $name;
244+
$b[1]["type"] = "s";
245+
$b[1]["value"] = $this->section;
246+
return $this->mysql->query("DELETE FROM `".$this->table."` WHERE name = ? AND id = '".$id."' AND section = ?", $b);
218247
}
219248

220249
public function get_full($id) {
221250
if(!is_numeric($id)) { return false; }
222251
$b[0]["type"] = "s";
223252
$b[0]["value"] = $this->section;
224-
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE id = '".$id."' AND section = ?", false, $b);
253+
$b[1]["type"] = "s";
254+
$b[1]["value"] = $this->lang;
255+
$ar = $this->mysql->select("SELECT * FROM `".$this->table."` WHERE id = '".$id."' AND section = ? AND lang = ?", false, $b);
225256
if(is_array($ar)) {
226257
return $ar;
227258
} else {

_framework/classes/x_class_user.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,15 @@ private function create_table($initial = false, $initialpass = "changeme", $init
472472
`user_shadow` varchar(512) DEFAULT NULL COMMENT 'Users Store for Mail if Renew',
473473
`user_rank` int(9) NULL DEFAULT NULL COMMENT 'Users Rank',
474474
`user_confirmed` tinyint(1) DEFAULT '0' COMMENT 'User Activation Status',
475+
`user_firstname` TEXT NULL COMMENT 'Users First Name',
476+
`user_lastname` TEXT NULL COMMENT 'Users Last Name',
477+
`user_street` TEXT NULL COMMENT 'Users Street',
478+
`user_company` TEXT NULL COMMENT 'Users Company Name',
479+
`user_postcode` TEXT NULL COMMENT 'Users Postcode',
480+
`user_country` TEXT NULL COMMENT 'Users Country',
481+
`user_city` TEXT NULL COMMENT 'Users City',
482+
`user_region` TEXT NULL COMMENT 'Users Region',
483+
`user_tel` TEXT NULL COMMENT 'Users Mobile',
475484
`req_activation` datetime DEFAULT NULL COMMENT 'Activation Date Counter for new Requests',
476485
`last_activation` datetime DEFAULT NULL COMMENT 'Activation Date Counter for new Requests',
477486
`user_disabled` int(1) DEFAULT 0 COMMENT '1 - User is Disabled',
@@ -518,7 +527,7 @@ private function create_table($initial = false, $initialpass = "changeme", $init
518527
$bind[2]["value"] = $this->password_crypt($initialpass);
519528
$this->mysql->query("INSERT INTO `".$this->dt_users."` (user_name, user_mail, user_confirmed, user_pass, user_rank, user_initial)
520529
VALUES(?, ?, 1, ?, '".$initialrank."', 1);", $bind);}}
521-
530+
522531
######################################################################################################################################################
523532
/* . ____ .__
524533
| | ____ ____ |__| ____

_framework/classes/x_class_version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ class x_class_version {
3030
public $contact = "[email protected]";
3131
public $website = "https://www.bugfish.eu";
3232
public $github = "https://github.com/bugfishtm";
33-
public $version = "3.35";
33+
public $version = "3.36";
3434
public $beta = false;
3535
}

_releases/3.36.zip

1.56 MB
Binary file not shown.

0 commit comments

Comments
 (0)