= $maxRequests) {
$_SESSION['voucher_create_times'] = $timestamps;
return true;
}
$timestamps[] = $now;
$_SESSION['voucher_create_times'] = $timestamps;
return false;
}
/**
* Optionales Tageslimit pro (Nicht-Admin-)Benutzer (Setting
* user_daily_voucher_limit, 0 = aus). Verhindert übermäßige Erstellung.
*/
function userDailyLimitExceeded($db, $auth, $additional = 1) {
if (!$auth->isLoggedIn() || $auth->isAdmin()) {
return false;
}
$limit = (int)$db->getSetting('user_daily_voucher_limit', 0);
if ($limit <= 0) {
return false;
}
$uid = $_SESSION['user_id'] ?? 0;
$today = (int)($db->fetchOne(
"SELECT COUNT(*) c FROM vouchers WHERE user_id=? AND DATE(created_at)=CURDATE()",
[$uid]
)['c'] ?? 0);
return ($today + $additional) > $limit;
}
$appTitle = $db->getSetting('app_title', 'UniFi Voucher System');
$logoUrl = $db->getSetting('logo_url', '');
$instructionHeader = $db->getSetting('instruction_header', '');
$instructionText = $db->getSetting('instruction_text', '');
$publicAccess = $db->getSetting('public_access', 0);
$smtpEnabled = $db->getSetting('smtp_enabled', '0') === '1';
$printTemplate = $db->getSetting('print_template', '
= htmlspecialchars($appTitle) ?>
= __('app_subtitle') ?>
= htmlspecialchars($error) ?>
= buildPrintCard($printTemplate, $voucherData, $instructionHeader, $instructionText, $appTitle) ?>
= __('voucher_success_title') ?>
= htmlspecialchars($voucherCode) ?>
= __('voucher_copy_hint') ?>
= str_replace('{minutes}', $voucherData['expire_min'], __('voucher_validity')) ?>
= htmlspecialchars($voucherData['site_name']) ?>
= (int)$voucherData['max_uses'] ?> = __('label_devices') ?>
= __('voucher_qr_label') ?>
= htmlspecialchars($instructionHeader) ?>
= $instructionText ?>
= str_replace('{count}', count($bulkVouchers), __('bulk_results')) ?>
= __('bulk_results_hint') ?>
$bv): ?>
= buildPrintCard($printTemplate, $bv, $instructionHeader, $instructionText, $appTitle) ?>
| # |
= __('label_code') ?> |
= __('label_site') ?> |
= __('label_expires') ?> |
$bv): ?>
| = $i + 1 ?> |
= htmlspecialchars($bv['code']) ?>
|
= htmlspecialchars($bv['site_name']) ?> |
= $bv['expiry_date'] ?> = $bv['expiry_time'] ?> |
= __('voucher_copy_hint') ?>
isLoggedIn()): ?>
= htmlspecialchars($instructionHeader) ?>
= $instructionText ?>