X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/42bd3e809b0fa95d3a463462e242caf40d98bf79..7d6cb9a3d58687e0bf3ca3c30882782fe7ae12b8:/web/image_minmax.php diff --git a/web/image_minmax.php b/web/image_minmax.php index dfa66d2..edc1708 100644 --- a/web/image_minmax.php +++ b/web/image_minmax.php @@ -48,8 +48,7 @@ if ($type and $param) { } $q = $db -> prepare( - 'select st.st_fill_color_top,st.st_fill_color_bottom,st.st_description,u.id,u.unit_group from st_parameters st,units u where st.id='.$param.' and st.st_unit=u.id -' + 'select st.st_fill_color_top,st.st_fill_color_bottom,st.st_description,u.id,u.unit_group from st_parameters st,units u where st.id='.$param.' and st.st_unit=u.id' ); $q -> execute(); @@ -84,23 +83,27 @@ if ($type and $param) { $next_year = $year; $next_month = $month+1; - if ($month==13) { + if ($month==12) { $next_year++; $next_month=1; - + } $curr = date("Ym"); + $ym=sprintf('%04d%02d',$next_year,$next_month); - if ($curr>$next_year.$next_month) { + if ($curr>$ym) { $cachefilename='meteo.month.'.$sensor.'.'.$param.'.'.$to_unit.'.'.$year.'-'.$month.'.'.$img_format; } + $datestr=sprintf("%04d%02d01",$year,$month); + $nextdatestr=sprintf("%04d%02d01",$next_year,$next_month); + $q = $db -> prepare( - ' + ' select x, unitconv(min(min),'.$from_unit.','.$to_unit.') min_value, @@ -113,14 +116,14 @@ if ($type and $param) { from sensors_ranges where - day>=str_to_date(\''.$year.$month.'\',\'%Y%m\') - and day=STR_TO_DATE(\''.$datestr.'\',\'%Y%m%d\') + and day prepare( ' select @@ -149,8 +155,8 @@ if ($type and $param) { from sensors_ranges where - day>=str_to_date(\''.$year.'\',\'%Y\') - and day=STR_TO_DATE(\''.$datestr.'\',\'%Y%m%d\') + and daygraph_theme = null;