@@ -134,20 +134,21 @@ protected function applyFilterVars($filter)
134134 );
135135
136136 // apply struct column placeholder (we support only one!)
137+ // or apply date formula, given as strtotime
137138 if (preg_match ('/^(.*?)(?:\$STRUCT\.(.*?)\$)(.*?)$/ ' , $ filter , $ match )) {
138139 $ filter = $ this ->applyFilterVarsStruct ($ match );
139140 } elseif (preg_match ('/^(.*?)(?:\$USER\.(.*?)\$)(.*?)$/ ' , $ filter , $ match )) {
140141 $ 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 )) {
145143 $ 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 ));
149150 } else {
150- $ filter = str_replace ($ filter ,date ('Y-m-d ' ,$ timestamp ),$ filter );
151+ $ filter = str_replace ($ filter , date ('Y-m-d ' , $ timestamp ), $ filter );
151152 }
152153 }
153154
0 commit comments