403Webshell
Server IP : 188.114.96.3  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux sv058.home.net.pl 6.8.2 husak_dirty_pages_fix #1 SMP PREEMPT_DYNAMIC Tue Apr 2 22:06:51 CEST 2024 x86_64
User :  ( 3194769)
PHP Version : 8.5.12
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /polana/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /polana/menu-druk.php
<?php
declare(strict_types=1);

require_once __DIR__ . '/includes/functions.php';
/* POLANA_V15_MENU_PUBLIC */
require_once __DIR__ . '/includes/polana_v15_menu.php';
require_once __DIR__ . '/includes/menu_placeholder.php';

// Druk roboczej karty jest dostępny wyłącznie po zalogowaniu do panelu.
$requestedMenuId = filter_input(INPUT_GET, 'menu_id', FILTER_VALIDATE_INT);
$menuType = polana_menu_type((string)($_GET['kind'] ?? 'food'));
if (isset($_GET['menu_id'])) {
    require_login();
    $viewer = admin_user();
    if (in_array((string)($viewer['role'] ?? ''), ['manager', 'waiter', 'kitchen'], true)) {
        http_response_code(403);
        exit('Brak uprawnień do podglądu roboczej karty menu.');
    }
    if (!$requestedMenuId || $requestedMenuId < 1) {
        http_response_code(404);
        exit('Nie znaleziono wskazanej karty menu.');
    }
    $stmt = db()->prepare('SELECT * FROM menus WHERE id = ? LIMIT 1');
    $stmt->execute([$requestedMenuId]);
    $menu = $stmt->fetch();
    if (!$menu) {
        http_response_code(404);
        exit('Nie znaleziono wskazanej karty menu.');
    }
    // Do not trust URL kind when exporting a saved card: take category from DB.
    $menuType = polana_menu_type((string)($menu['menu_type'] ?? 'food'));
} else {
    render_global_site_splash_if_needed();
    $menu = p15_active_menu($menuType);
}

if ($menu) {
    $menuName = (string)$menu['name'];
    $categories = menu_categories_with_items((int)$menu['id']);
} else {
    $sample = placeholder_menu();
    $menuName = (string)$sample['name'];
    $categories = $menuType === 'food' && p15_menu_lang() === 'pl' ? $sample['categories'] : [];
}

$printCategories = [];
$pendingEnglishReview = false;
foreach ($categories as $category) {
    if (p15_menu_lang() !== 'pl' && !empty($_GET['menu_id']) && empty($category['name_'.p15_menu_lang()])) {
        $pendingEnglishReview = true;
    }
    $items = [];
    foreach ($category['items'] as $item) {
        if (isset($item['active']) && !$item['active']) {
            continue;
        }
        if (p15_menu_lang() !== 'pl' && !empty($_GET['menu_id']) && empty($item['name_'.p15_menu_lang()])) {
            $pendingEnglishReview = true;
        }
        $price = trim((string)($item['price_text'] ?? ''));
        if ($price === '' && array_key_exists('price', $item) && $item['price'] !== null && $item['price'] !== '') {
            $price = number_format((float)$item['price'], 0, ',', ' ');
        }
        $items[] = ['name' => p15_menu_text($item, 'name'), 'price' => $price];
    }
    if ($items) {
        $printCategories[] = ['name' => p15_menu_text($category, 'name'), 'items' => $items];
    }
}

header('Content-Type: text/html; charset=UTF-8');
header('Cache-Control: private, no-store');
header('X-Robots-Tag: noindex, nofollow');
$printAuto = ($_GET['auto'] ?? '') === '1';
?>
<!doctype html>
<html lang="<?= e(p15_menu_lang()) ?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex,nofollow">
<title><?= e(p15_menu_type_label($menuType)) ?> – Andrzej Polan – PDF</title>
<style>
:root{color-scheme:light}
*{box-sizing:border-box}
body{margin:0;color:#151414;background:#efeee9;font-family:Arial,Helvetica,sans-serif}
.toolbar{position:sticky;top:0;z-index:4;display:flex;justify-content:center;align-items:center;gap:12px;flex-wrap:wrap;padding:12px;background:#232323}
.toolbar button,.toolbar a{font:700 14px Arial,sans-serif;border:0;border-radius:24px;padding:12px 22px;background:#9acd32;color:#111;cursor:pointer;text-decoration:none}
.toolbar a{background:#fff}
.paper{width:min(210mm,100%);min-height:297mm;margin:20px auto;padding:16mm 17mm 22mm;background:white;box-shadow:0 18px 45px #0002;text-align:center}
.brand{display:block;width:210px;max-height:135px;object-fit:contain;margin:0 auto 4mm}
.category{margin:0 auto 9mm;break-inside:avoid-page;page-break-inside:avoid}
.category h2{font-size:18pt;line-height:1.24;margin:0 0 5mm}
.dish{font-size:12pt;line-height:1.5;margin:0 0 4mm;overflow-wrap:anywhere}
.end-signature{margin:14mm auto 0;break-inside:avoid-page;page-break-inside:avoid}
.end-signature img{display:block;width:76mm;height:auto;max-width:100%;margin:0 auto}
.brand-dot{width:11px;height:11px;border-radius:50%;background:#d62828;box-shadow:0 0 0 6px #9acd32;margin:4mm auto 0}
.en-review-warning{border:2px solid #b42318;padding:10px 12px;font-size:12px;line-height:1.5;color:#b42318;font-weight:700;margin:0 auto 8mm;text-align:center}
@page{size:A4 portrait;margin:14mm 12mm}
@media print{
 html,body{margin:0!important;padding:0!important;background:#fff!important;print-color-adjust:exact;-webkit-print-color-adjust:exact}
 .toolbar{display:none!important}
 .paper{width:100%;min-height:0;margin:0;padding:0;box-shadow:none}
 .category{break-inside:avoid-page;page-break-inside:avoid}
 .end-signature{break-inside:avoid-page;page-break-inside:avoid}
}
@media(max-width:600px){.paper{min-height:0;padding:26px 18px}.brand{width:180px}.category h2{font-size:19px}.dish{font-size:15px}}
</style>

<!-- TKLM-TRACKING-AUTO -->
<script defer src="/assets/tklm-tracking.js?v=2"></script>
<!-- /TKLM-TRACKING-AUTO -->
</head>
<body>
<div class="toolbar"><button type="button" onclick="window.print()"><?= p15_menu_ui('Drukuj / zapisz PDF') ?></button><a href="<?= e(p15_menu_url('/menu',$menuType)) ?>"><?= p15_menu_ui('Wróć do menu') ?></a></div>
<main class="paper">
    <img class="brand" src="/assets/img/logo.png" alt="Polana Smaków">
    <?php if ($pendingEnglishReview): ?>
      <p class="en-review-warning">Some menu translations need review before printing.</p>
    <?php endif; ?>
    <?php if (!$printCategories): ?><p><?= polana_ui('Karta w przygotowaniu.') ?></p><?php endif; ?>
    <?php foreach ($printCategories as $category): ?>
    <section class="category">
        <h2><?= e($category['name']) ?></h2>
        <?php foreach ($category['items'] as $item): ?>
        <p class="dish"><?= e(trim($item['name'] . ' ' . $item['price'])) ?></p>
        <?php endforeach; ?>
    </section>
    <?php endforeach; ?>
    <footer class="end-signature">
        <img src="/assets/img/podpis-andrzej-polan.png" alt="Podpis Andrzeja Polana">
        <div class="brand-dot" aria-hidden="true"></div>
    </footer>
</main>
<?php if ($printAuto): ?>
<script>
window.addEventListener('load', () => { window.setTimeout(() => window.print(), 400); });
</script>
<?php endif; ?>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit