Skip to content

Commit

Permalink
fix mod_nwi_get_news_items
Browse files Browse the repository at this point in the history
...for sorting according to published_until out of droplet code
  • Loading branch information
mrbaseman committed Sep 26, 2024
1 parent 01b6d5f commit 39a29ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2165,7 +2165,7 @@ function mod_nwi_display_news_items(
$strip_tags = true, // true:=remove tags from short and long text (default:=true); false:=don´t strip tags
$allowed_tags = '<p><a><img>', // tags not striped off (default:='<p><a><img>')
$custom_placeholder = false, // false:= none (default), array('MY_VAR_1' => '%TAG%#', ... 'MY_VAR_N' => '#regex_N#' ...)
$sort_by = 1, // 1:=position (default), 2:=posted_when, 3:=published_when, 4:=random order
$sort_by = 1, // 1:=position (default), 2:=posted_when, 3:=published_when, 4:=random order 5:=published_until
$sort_order = 1, // 1:=descending (default), 2:=ascending
$not_older_than = 0, // 0:=disabled (default), 0-999 (only show news `published_when` date <=x days; 12 hours:=0.5)
$is_not_older_than = 0, // alias for not_older_than
Expand Down Expand Up @@ -2216,7 +2216,7 @@ function mod_nwi_get_news_items($options=array())
'max_news_length' => -1, // maximum length of the short news text shown (default:=-1 => full news length)
'strip_tags' => true, // true:=remove tags from short and long text (default:=true); false:=dont strip tags
'allowed_tags' => '<p><a><img>', // tags not striped off (default:='<p><a><img>')
'sort_by' => 1, // 1:=position (default), 2:=posted_when, 3:=published_when, 4:=random order 5:=rand() 6:=published_until
'sort_by' => 1, // 1:=position (default), 2:=posted_when, 3:=published_when, 4:=random order 5:=published_until
'sort_order' => 1, // 1:=descending (default), 2:=ascending
'not_older_than' => 0, // 0:=disabled (default), 0-999 (only show news `published_when` date <=x days; 12 hours:=0.5)
'is_not_older_than' => 0,
Expand Down Expand Up @@ -2250,7 +2250,7 @@ function mod_nwi_get_news_items($options=array())
mod_nwi_sanitize_input($max_news_length, 'i{-1;0;250}');
mod_nwi_sanitize_input($strip_tags, 'b');
mod_nwi_sanitize_input($allowed_tags, 's{TRIM}');
mod_nwi_sanitize_input($sort_by, 'i{1;1;6}');
mod_nwi_sanitize_input($sort_by, 'i{1;1;5}');
mod_nwi_sanitize_input($sort_order, 'i{1;1;2}');
mod_nwi_sanitize_input($not_older_than, 'd{0;0;999}');
mod_nwi_sanitize_input($is_not_older_than, 'd{0;0;999}');
Expand Down Expand Up @@ -2362,7 +2362,7 @@ function mod_nwi_get_news_items($options=array())
}

// ---------- sort order ---------------------------------------------------
$order_by_options = array('t1.`position`', 't1.`posted_when`', 't1.`published_when`', 'RAND()', 't1.`published_until`');
$order_by_options = array('t1.`position`', 't1.`posted_when`', 't1.`published_when`', 'RAND()', 't1.`published_until`');
$sql_order_by = $order_by_options[$sort_by - 1];
$sql_sort_order = ($sort_order == 1) ? 'DESC' : 'ASC';

Expand Down

0 comments on commit 39a29ab

Please sign in to comment.