Skip to content

Commit

Permalink
fix: unset sortOrder var
Browse files Browse the repository at this point in the history
  • Loading branch information
ellite authored Jul 14, 2024
1 parent ca74f1c commit a1fab4d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion endpoints/cronjobs/sendnotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
require __DIR__ . '/../../libs/PHPMailer/SMTP.php';
require __DIR__ . '/../../libs/PHPMailer/Exception.php';

$date = new DateTime('now');
echo "\n" . $date->format('Y-m-d') . " " . $date->format('H:i:s') . "<br />\n";

// Get all user ids
$query = "SELECT id, username FROM user";
$stmt = $db->prepare($query);
$usersToNotify = $stmt->execute();

while ($userToNotify = $usersToNotify->fetchArray(SQLITE3_ASSOC)) {
$userId = $userToNotify['id'];
echo "For user: " . $userToNotify['username'] . "<br />";
echo "\nFor user: " . $userToNotify['username'] . "<br />";

$days = 1;
$emailNotificationsEnabled = false;
Expand Down
1 change: 1 addition & 0 deletions endpoints/subscriptions/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
$sort = "next_payment";
$sortOrder = $sort;
$order = "ASC";
$sql = "SELECT * FROM subscriptions ORDER BY next_payment ASC, inactive ASC";
if (isset($_COOKIE['sortOrder']) && $_COOKIE['sortOrder'] != "") {
Expand Down
2 changes: 1 addition & 1 deletion includes/version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
$version = "v2.19.0";
$version = "v2.19.1";
?>
3 changes: 2 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
include_once 'includes/list_subscriptions.php';

$sort = "next_payment";
$sortOrder = $sort;
$sql = "SELECT * FROM subscriptions WHERE user_id = :userId ORDER BY next_payment ASC, inactive ASC";
if (isset($_COOKIE['sortOrder']) && $_COOKIE['sortOrder'] != "") {
$sort = $_COOKIE['sortOrder'];
Expand All @@ -22,7 +23,7 @@
}

$sql = "SELECT * FROM subscriptions WHERE user_id = :userId";
$sql .= " ORDER BY LOWER($sort) $order";
$sql .= " ORDER BY $sort $order";
if ($sort != "next_payment") {
$sql .= ", next_payment ASC";
}
Expand Down

0 comments on commit a1fab4d

Please sign in to comment.