I don't think this one will get merged upstream...

This commit is contained in:
ThaMunsta
2024-11-12 22:08:50 -05:00
parent da9b31bccd
commit 238308fa6d

View File

@@ -16,7 +16,7 @@ unset($get_copy['order']);
// Paging // Paging
if (isset($_GET['page'])) { if (isset($_GET['page'])) {
$page = intval($_GET['page']); $page = intval($_GET['page']);
$record_from = (($page)-1)*$user_config_records_per_page; $record_from = (($page) - 1) * $user_config_records_per_page;
$record_to = $user_config_records_per_page; $record_to = $user_config_records_per_page;
} else { } else {
$record_from = 0; $record_from = 0;
@@ -33,7 +33,7 @@ if (isset($_GET['order'])) {
$order = "DESC"; $order = "DESC";
$disp = "ASC"; $disp = "ASC";
} }
} elseif(isset($order)) { } elseif (isset($order)) {
if ($order == "ASC") { if ($order == "ASC") {
$disp = "DESC"; $disp = "DESC";
} else { } else {
@@ -66,8 +66,16 @@ if (empty($_GET['canned_date'])) {
$_GET['canned_date'] = 'custom'; $_GET['canned_date'] = 'custom';
} }
// Date Filter // Date Filter
if ($_GET['canned_date'] == "custom" && !empty($_GET['dtf'])) { $row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_config_calendar_first_day FROM user_settings WHERE user_id = $session_user_id"));
if (intval($row['user_config_calendar_first_day']) == 1) {
$user_config_calendar_first_day = "monday";
} else {
$user_config_calendar_first_day = "sunday";
}
if ($_GET['canned_date'] == "custom" && !empty($_GET['dtf']) || !empty($_GET['dtt'])) {
$dtf = sanitizeInput($_GET['dtf']); $dtf = sanitizeInput($_GET['dtf']);
$dtt = sanitizeInput($_GET['dtt']); $dtt = sanitizeInput($_GET['dtt']);
} elseif ($_GET['canned_date'] == "today") { } elseif ($_GET['canned_date'] == "today") {
@@ -77,26 +85,26 @@ if ($_GET['canned_date'] == "custom" && !empty($_GET['dtf'])) {
$dtf = date('Y-m-d', strtotime("yesterday")); $dtf = date('Y-m-d', strtotime("yesterday"));
$dtt = date('Y-m-d', strtotime("yesterday")); $dtt = date('Y-m-d', strtotime("yesterday"));
} elseif ($_GET['canned_date'] == "thisweek") { } elseif ($_GET['canned_date'] == "thisweek") {
$dtf = date('Y-m-d', strtotime("monday this week")); $dtf = date('Y-m-d', strtotime("last $user_config_calendar_first_day"));
$dtt = date('Y-m-d'); $dtt = date('Y-m-d', strtotime("last $user_config_calendar_first_day + 6 days"));
} elseif ($_GET['canned_date'] == "lastweek") { } elseif ($_GET['canned_date'] == "lastweek") {
$dtf = date('Y-m-d', strtotime("monday last week")); $dtf = date('Y-m-d', strtotime("last $user_config_calendar_first_day -7 days"));
$dtt = date('Y-m-d', strtotime("sunday last week")); $dtt = date('Y-m-d', strtotime("last $user_config_calendar_first_day - 1 days"));
} elseif ($_GET['canned_date'] == "thismonth") { } elseif ($_GET['canned_date'] == "thismonth") {
$dtf = date('Y-m-01'); $dtf = date('Y-m-01');
$dtt = date('Y-m-d'); $dtt = date('Y-m-d', strtotime("last day of this month"));
} elseif ($_GET['canned_date'] == "lastmonth") { } elseif ($_GET['canned_date'] == "lastmonth") {
$dtf = date('Y-m-d', strtotime("first day of last month")); $dtf = date('Y-m-d', strtotime("first day of last month"));
$dtt = date('Y-m-d', strtotime("last day of last month")); $dtt = date('Y-m-d', strtotime("last day of last month"));
} elseif ($_GET['canned_date'] == "thisyear") { } elseif ($_GET['canned_date'] == "thisyear") {
$dtf = date('Y-01-01'); $dtf = date('Y-01-01');
$dtt = date('Y-m-d'); $dtt = date('Y-m-d', strtotime("last day of december this year"));
} elseif ($_GET['canned_date'] == "lastyear") { } elseif ($_GET['canned_date'] == "lastyear") {
$dtf = date('Y-m-d', strtotime("first day of january last year")); $dtf = date('Y-m-d', strtotime("first day of january last year"));
$dtt = date('Y-m-d', strtotime("last day of december last year")); $dtt = date('Y-m-d', strtotime("last day of december last year"));
} else { } else {
$dtf = "NULL"; $dtf = "NULL";
$dtt = date('Y-m-d'); $dtt = date('Y-m-d', strtotime("last day of this month"));
} }
// Archived // Archived
@@ -107,7 +115,7 @@ if (isset($_GET['archived'])) {
$archived = intval($_GET['archived']); $archived = intval($_GET['archived']);
} }
if ($archived == 1){ if ($archived == 1) {
$archive_query = "archived_at IS NOT NULL"; $archive_query = "archived_at IS NOT NULL";
} else { } else {
$archive_query = "archived_at IS NULL"; $archive_query = "archived_at IS NULL";