$memberId) { $params[":member{$key}"] = $memberId; } } if (isset($_GET['category'])) { $categoryIds = explode(',', $_GET['category']); $placeholders = array_map(function ($key) { return ":category{$key}"; }, array_keys($categoryIds)); $sql .= " AND category_id IN (" . implode(',', $placeholders) . ")"; foreach ($categoryIds as $key => $categoryId) { $params[":category{$key}"] = $categoryId; } } if (isset($_GET['payment'])) { $paymentIds = explode(',', $_GET['payment']); $placeholders = array_map(function ($key) { return ":payment{$key}"; }, array_keys($paymentIds)); $sql .= " AND payment_method_id IN (" . implode(',', $placeholders) . ")"; foreach ($paymentIds as $key => $paymentId) { $params[":payment{$key}"] = $paymentId; } } if (!isset($settings['hideDisabledSubscriptions']) || $settings['hideDisabledSubscriptions'] !== 'true') { if (isset($_GET['state']) && $_GET['state'] != "") { $sql .= " AND inactive = :inactive"; $params[':inactive'] = $_GET['state']; } } $orderByClauses = []; if ($settings['disabledToBottom'] === 'true') { if (in_array($sort, ["payer_user_id", "category_id", "payment_method_id"])) { $orderByClauses[] = "$sort $order"; $orderByClauses[] = "inactive ASC"; } else { $orderByClauses[] = "inactive ASC"; $orderByClauses[] = "$sort $order"; } } else { $orderByClauses[] = "$sort $order"; if ($sort != "inactive") { $orderByClauses[] = "inactive ASC"; } } if ($sort != "next_payment") { $orderByClauses[] = "next_payment ASC"; } $sql .= " ORDER BY " . implode(", ", $orderByClauses); $stmt = $db->prepare($sql); $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER); if (!empty($params)) { foreach ($params as $key => $value) { $stmt->bindValue($key, $value, SQLITE3_INTEGER); } } $result = $stmt->execute(); if ($result) { $subscriptions = array(); while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $subscriptions[] = $row; } } foreach ($subscriptions as $subscription) { $memberId = $subscription['payer_user_id']; $members[$memberId]['count']++; $categoryId = $subscription['category_id']; $categories[$categoryId]['count']++; $paymentMethodId = $subscription['payment_method_id']; $payment_methods[$paymentMethodId]['count']++; } if ($sortOrder == "category_id") { usort($subscriptions, function ($a, $b) use ($categories) { return $categories[$a['category_id']]['order'] - $categories[$b['category_id']]['order']; }); } if ($sortOrder == "payment_method_id") { usort($subscriptions, function ($a, $b) use ($payment_methods) { return $payment_methods[$a['payment_method_id']]['order'] - $payment_methods[$b['payment_method_id']]['order']; }); } $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden"; ?>
:
Running in Demo Mode, certain actions and settings are disabled.
The database will be reset every 120 minutes.
format($next_payment_timestamp); $print[$id]['next_payment'] = $formatted_date; $paymentIconFolder = (strpos($payment_methods[$paymentMethodId]['icon'], 'images/uploads/icons/') !== false) ? "" : "images/uploads/logos/"; $print[$id]['payment_method_icon'] = $paymentIconFolder . $payment_methods[$paymentMethodId]['icon']; $print[$id]['payment_method_name'] = $payment_methods[$paymentMethodId]['name']; $print[$id]['payment_method_id'] = $paymentMethodId; $print[$id]['category_id'] = $subscription['category_id']; $print[$id]['payer_user_id'] = $subscription['payer_user_id']; $print[$id]['price'] = floatval($subscription['price']); $print[$id]['progress'] = getSubscriptionProgress($cycle, $frequency, $subscription['next_payment']); $print[$id]['inactive'] = $subscription['inactive']; $print[$id]['url'] = $subscription['url']; $print[$id]['notes'] = $subscription['notes']; $print[$id]['replacement_subscription_id'] = $subscription['replacement_subscription_id']; if (isset($settings['convertCurrency']) && $settings['convertCurrency'] === 'true' && $currencyId != $mainCurrencyId) { $print[$id]['price'] = getPriceConverted($print[$id]['price'], $currencyId, $db); $print[$id]['currency_code'] = $currencies[$mainCurrencyId]['code']; } if (isset($settings['showMonthlyPrice']) && $settings['showMonthlyPrice'] === 'true') { $print[$id]['price'] = getPricePerMonth($cycle, $frequency, $print[$id]['price']); } if (isset($settings['showOriginalPrice']) && $settings['showOriginalPrice'] === 'true') { $print[$id]['original_price'] = floatval($subscription['price']); $print[$id]['original_currency_code'] = $currencies[$subscription['currency_id']]['code']; } } if ($sortOrder == "alphanumeric") { usort($print, function ($a, $b) { return strnatcmp(strtolower($a['name']), strtolower($b['name'])); }); if ($settings['disabledToBottom'] === 'true') { usort($print, function ($a, $b) { return $a['inactive'] - $b['inactive']; }); } } if (isset($print)) { printSubscriptions($print, $sort, $categories, $members, $i18n, $colorTheme, "", $settings['disabledToBottom'], $settings['mobileNavigation'], $settings['showSubscriptionProgress'], $currencies, $lang); } $db->close(); if (count($subscriptions) == 0) { ?>
<?= translate('empty_page', $i18n) ?>