improve channel date query

This commit is contained in:
Mario Vavti 2019-04-27 23:01:05 +02:00
parent 73248aadd5
commit 405e07f0a2

View File

@ -310,10 +310,6 @@ class Channel extends Controller {
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2)))); $sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
} }
if($datequery || $datequery2) {
$sql_extra2 .= " and item.item_thread_top != 0 ";
}
if($order === 'post') if($order === 'post')
$ordering = "created"; $ordering = "created";
else else
@ -342,7 +338,7 @@ class Channel extends Controller {
AND (abook.abook_blocked = 0 or abook.abook_flags is null) AND (abook.abook_blocked = 0 or abook.abook_flags is null)
AND item.item_wall = 1 AND item.item_thread_top = 1 AND item.item_wall = 1 AND item.item_thread_top = 1
$sql_extra $sql_extra2 $sql_extra $sql_extra2
ORDER BY $ordering DESC $pager_sql ", ORDER BY $ordering DESC, item_id $pager_sql ",
intval(App::$profile['profile_uid']) intval(App::$profile['profile_uid'])
); );
} }