File tree Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Original file line number Diff line number Diff line change 4
4
5
5
function str_to_bool ($ str ): string
6
6
{
7
- if ($ str ) {
8
- return 'true ' ;
9
- }
10
- return 'false ' ;
7
+ return $ str ? 'true ' : 'false ' ;
11
8
}
12
9
13
10
function get_db_field ($ table , $ field_name ) {
14
- $ old_field = [];
15
-
16
11
$ cols = sql_query ("SHOW FULL COLUMNS FROM ` " . escape ($ table ) . "` " );
17
12
18
13
foreach ($ cols as $ field ) {
19
- if ($ field ['Field ' ] == underscored ($ field_name )) {
20
- $ db_field = $ field ['Type ' ];
21
- $ null = $ field ['Null ' ] === 'NO ' ? 'NOT NULL ' : '' ;
22
- $ old_field = $ field ;
23
- break ;
14
+ if ($ field ['Field ' ] === underscored ($ field_name )) {
15
+ return $ field ;
24
16
}
25
17
}
26
-
27
- return $ old_field ;
28
18
}
29
19
30
20
global $ last_modified ,
@@ -214,7 +204,7 @@ function get_db_field($table, $field_name) {
214
204
}
215
205
216
206
$ db_field = $ old_field ['Type ' ] ?: $ cms ->form_to_db ($ _POST ['type ' ]);
217
- $ null = $ old_field ['Null ' ] === 'NO ' ? 'NOT NULL ' : '' ;
207
+ $ null = $ old_field ['Null ' ] === 'YES ' ? '' : 'NOT NULL ' ;
218
208
$ extra = ($ old_field ['Extra ' ] === 'auto_increment ' || $ column === 'id ' ) ? 'AUTO_INCREMENT ' : '' ;
219
209
220
210
$ default = $ default ?: $ old_field ['Default ' ];
Original file line number Diff line number Diff line change 2
2
3
3
class cms
4
4
{
5
- const VERSION = '4.0.14 ' ;
5
+ const VERSION = '4.0.15 ' ;
6
6
7
7
/**
8
8
* @var string
You can’t perform that action at this time.
0 commit comments