-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replacement for disabled subscriptions, to more accurately calc…
…ulate savings
- Loading branch information
Showing
32 changed files
with
219 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
<?php | ||
require_once '../../includes/connect_endpoint.php'; | ||
|
||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) { | ||
if ($_SERVER["REQUEST_METHOD"] === "DELETE") { | ||
$subscriptionId = $_GET["id"]; | ||
$deleteQuery = "DELETE FROM subscriptions WHERE id = :subscriptionId AND user_id = :userId"; | ||
$deleteStmt = $db->prepare($deleteQuery); | ||
$deleteStmt->bindParam(':subscriptionId', $subscriptionId, SQLITE3_INTEGER); | ||
$deleteStmt->bindParam(':userId', $userId, SQLITE3_INTEGER); | ||
|
||
if ($deleteStmt->execute()) { | ||
http_response_code(204); | ||
} else { | ||
http_response_code(500); | ||
echo json_encode(array("message" => translate('error_deleting_subscription', $i18n))); | ||
} | ||
require_once '../../includes/connect_endpoint.php'; | ||
|
||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) { | ||
if ($_SERVER["REQUEST_METHOD"] === "DELETE") { | ||
$subscriptionId = $_GET["id"]; | ||
$deleteQuery = "DELETE FROM subscriptions WHERE id = :subscriptionId AND user_id = :userId"; | ||
$deleteStmt = $db->prepare($deleteQuery); | ||
$deleteStmt->bindParam(':subscriptionId', $subscriptionId, SQLITE3_INTEGER); | ||
$deleteStmt->bindParam(':userId', $userId, SQLITE3_INTEGER); | ||
|
||
if ($deleteStmt->execute()) { | ||
$query = "UPDATE subscriptions SET replacement_subscription_id = NULL WHERE replacement_subscription_id = :subscriptionId AND user_id = :userId"; | ||
$stmt = $db->prepare($query); | ||
$stmt->bindParam(':subscriptionId', $subscriptionId, SQLITE3_INTEGER); | ||
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER); | ||
$stmt->execute(); | ||
|
||
http_response_code(204); | ||
} else { | ||
http_response_code(405); | ||
echo json_encode(array("message" => translate('invalid_request_method', $i18n))); | ||
http_response_code(500); | ||
echo json_encode(array("message" => translate('error_deleting_subscription', $i18n))); | ||
} | ||
} else { | ||
http_response_code(405); | ||
echo json_encode(array("message" => translate('invalid_request_method', $i18n))); | ||
} | ||
$db->close(); | ||
} | ||
$db->close(); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<?php | ||
$version = "v2.32.0"; | ||
$version = "v2.33.0"; | ||
?> |
Oops, something went wrong.