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-karta.php
<?php
declare(strict_types=1);

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

function svg_e(string $value): string
{
    return htmlspecialchars($value, ENT_QUOTES | ENT_XML1 | ENT_SUBSTITUTE, 'UTF-8');
}

function polana_svg_strlen(string $text): int
{
    if (function_exists('mb_strlen')) return mb_strlen($text, 'UTF-8');
    if (function_exists('iconv_strlen')) return (int) iconv_strlen($text, 'UTF-8');
    return (int)(preg_match_all('/./us', $text) ?: strlen($text));
}

function wrap_svg_text(string $text, int $maxChars = 56): array
{
    $text = trim(preg_replace('/\s+/u', ' ', $text) ?? $text);

    if (polana_svg_strlen($text) <= $maxChars) {
        return [$text];
    }

    $words = preg_split('/\s+/u', $text) ?: [];
    $lines = [];
    $line = '';

    foreach ($words as $word) {
        $candidate = $line === '' ? $word : $line . ' ' . $word;

        if (polana_svg_strlen($candidate) <= $maxChars) {
            $line = $candidate;
            continue;
        }

        if ($line !== '') {
            $lines[] = $line;
        }

        $line = $word;
    }

    if ($line !== '') {
        $lines[] = $line;
    }

    return $lines ?: [$text];
}

$menuType = polana_menu_type((string)($_GET['kind'] ?? 'food'));
$dbMenu = p15_active_menu($menuType);

if ($dbMenu) {
    $menuName = $dbMenu['name'];
    $dbCategories = menu_categories_with_items((int)$dbMenu['id']);

    $categories = [];
    foreach ($dbCategories as $category) {
        $items = [];
        foreach ($category['items'] as $item) {
            $price = '';

            if (!empty($item['price_text'])) {
                $price = $item['price_text'];
            } elseif ($item['price'] !== null && $item['price'] !== '') {
                $price = number_format((float)$item['price'], 0, ',', ' ');
            }

            $items[] = [
                'name' => p15_menu_text($item, 'name'),
                'price' => $price,
            ];
        }

        if ($items) {
            $categories[] = [
                'name' => p15_menu_text($category, 'name'),
                'items' => $items,
            ];
        }
    }
} else {
    $placeholder = placeholder_menu();
    $menuName = $placeholder['name'];
    $categories = [];

    foreach ($menuType === 'food' && p15_menu_lang() === 'pl' ? $placeholder['categories'] : [] as $category) {
        $items = [];
        foreach ($category['items'] as $item) {
            $items[] = [
                'name' => p15_menu_text($item, 'name'),
                'price' => number_format((float)$item['price'], 0, ',', ' '),
            ];
        }

        $categories[] = [
            'name' => p15_menu_text($category, 'name'),
            'items' => $items,
        ];
    }
}

$logoFile = __DIR__ . '/assets/img/logo.png';
$logoData = '';

if (is_file($logoFile)) {
    $raw = file_get_contents($logoFile);
    if ($raw !== false) {
        $logoData = 'data:image/png;base64,' . base64_encode($raw);
    }
}

$signatureFile = __DIR__ . '/assets/img/podpis-andrzej-polan.png';
$signatureData = '';
if (is_file($signatureFile)) {
    $signatureBytes = file_get_contents($signatureFile);
    if ($signatureBytes !== false) {
        $signatureData = 'data:image/png;base64,' . base64_encode($signatureBytes);
    }
}

$width = 760;
$center = $width / 2;
$top = 52;
$logoHeight = 170;
$titleBlock = 38;
$categoryGap = 44;
$itemLineHeight = 24;
$itemGap = 10;
$footerHeight = 245;

$height = $top + $logoHeight + $titleBlock;

foreach ($categories as $category) {
    $height += $categoryGap + 28;

    foreach ($category['items'] as $item) {
        $lineText = trim($item['name'] . ' ' . $item['price']);
        $wrapped = wrap_svg_text($lineText, 56);
        $height += count($wrapped) * $itemLineHeight + $itemGap;
    }
}

$height += $footerHeight;

header('Content-Type: image/svg+xml; charset=UTF-8');
header('Cache-Control: no-cache, no-store, must-revalidate');

echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<svg xmlns="http://www.w3.org/2000/svg"
     width="<?= $width ?>"
     height="<?= $height ?>"
     viewBox="0 0 <?= $width ?> <?= $height ?>"
     role="img"
     aria-labelledby="title desc">

    <title id="title"><?= svg_e(p15_menu_type_label($menuType)) ?> – Moja Polana Smaków</title>
    <desc id="desc"><?= svg_e(p15_menu_lang() === 'en' ? 'Current restaurant menu by Andrzej Polan.' : 'Aktualna karta restauracji Moja Polana Smaków Andrzeja Polana.') ?></desc>

    <rect x="0" y="0" width="<?= $width ?>" height="<?= $height ?>" fill="#ffffff"/>

    <?php $y = $top; ?>

    <?php if ($logoData !== ''): ?>
        <?php $logoWidth = 250; $x = ($width - $logoWidth) / 2; ?>
        <image href="<?= svg_e($logoData) ?>"
               x="<?= $x ?>"
               y="<?= $y ?>"
               width="<?= $logoWidth ?>"
               height="<?= $logoHeight ?>"
               preserveAspectRatio="xMidYMid meet"/>
        <?php $y += $logoHeight + 18; ?>
    <?php endif; ?>

    <?php if (!$categories): ?>
        <text x="<?= $center ?>" y="<?= $y + 65 ?>" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="20" fill="#666"><?= svg_e(p15_menu_lang() === 'en' ? 'This menu is being prepared' : 'Karta w przygotowaniu') ?></text>
    <?php endif; ?>
    <?php foreach ($categories as $category): ?>
        <text x="<?= $center ?>"
              y="<?= $y ?>"
              text-anchor="middle"
              font-family="Arial, Helvetica, sans-serif"
              font-size="22"
              font-weight="700"
              fill="#000000"><?= svg_e($category['name']) ?></text>

        <?php $y += 36; ?>

        <?php foreach ($category['items'] as $item): ?>
            <?php $wrapped = wrap_svg_text(trim($item['name'] . ' ' . $item['price']), 56); ?>
            <?php foreach ($wrapped as $line): ?>
                <text x="<?= $center ?>"
                      y="<?= $y ?>"
                      text-anchor="middle"
                      font-family="Arial, Helvetica, sans-serif"
                      font-size="16"
                      font-weight="400"
                      fill="#111111"><?= svg_e($line) ?></text>
                <?php $y += $itemLineHeight; ?>
            <?php endforeach; ?>
            <?php $y += $itemGap; ?>
        <?php endforeach; ?>

        <?php $y += 18; ?>
    <?php endforeach; ?>

    <?php if ($signatureData !== ''): ?>
        <image href="<?= svg_e($signatureData) ?>"
               x="<?= ($width - 280) / 2 ?>"
               y="<?= $y + 8 ?>"
               width="280" height="130"
               preserveAspectRatio="xMidYMid meet"/>
    <?php else: ?>
        <text x="<?= $center ?>" y="<?= $y + 55 ?>" text-anchor="middle"
              font-family="Georgia, serif" font-size="28" font-style="italic" fill="#222">Andrzej Polan</text>
    <?php endif; ?>

    <circle cx="<?= $center ?>" cy="<?= $y + 151 ?>" r="11" fill="#9ACD32"/>
    <circle cx="<?= $center ?>" cy="<?= $y + 151 ?>" r="5" fill="#D62828"/>
</svg>

Youez - 2016 - github.com/yon3zu
LinuXploit