@@ -134,20 +134,21 @@ protected function applyFilterVars($filter)
134
134
);
135
135
136
136
// apply struct column placeholder (we support only one!)
137
+ // or apply date formula, given as strtotime
137
138
if (preg_match ('/^(.*?)(?:\$STRUCT\.(.*?)\$)(.*?)$/ ' , $ filter , $ match )) {
138
139
$ filter = $ this ->applyFilterVarsStruct ($ match );
139
140
} elseif (preg_match ('/^(.*?)(?:\$USER\.(.*?)\$)(.*?)$/ ' , $ filter , $ match )) {
140
141
$ filter = $ this ->applyFilterVarsUser ($ match );
141
- }
142
-
143
- // apply date formula, given as strtotime
144
- if (preg_match ('/^(.*?)(?:\$DATE\((.*?)\)\$?)(.*?)$/ ' , $ filter , $ match )) {
142
+ } elseif (preg_match ('/^(.*?)(?:\$DATE\((.*?)\)\$?)(.*?)$/ ' , $ filter , $ match )) {
145
143
$ toparse = $ match [2 ];
146
- if ($ toparse == '' ) $ toparse = 'now ' ;
147
- if (($ timestamp = strtotime ($ toparse )) === false ) {
148
- throw new StructException ('datefilter ' ,hsc ($ toparse ));
144
+ if ($ toparse == '' ) {
145
+ $ toparse = 'now ' ;
146
+ }
147
+ $ timestamp = strtotime ($ toparse );
148
+ if ($ timestamp === false ) {
149
+ throw new StructException ('datefilter ' , hsc ($ toparse ));
149
150
} else {
150
- $ filter = str_replace ($ filter ,date ('Y-m-d ' ,$ timestamp ),$ filter );
151
+ $ filter = str_replace ($ filter , date ('Y-m-d ' , $ timestamp ), $ filter );
151
152
}
152
153
}
153
154
0 commit comments