/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Http
/Cookie.php
* @return bool true: cookie was created,
* false: cookie creation failed
*/
public static function set(string $key, string $value, array $options = []): bool
{
// extract options
$lifetime = $options['lifetime'] ?? 0;
$path = $options['path'] ?? '/';
$domain = $options['domain'] ?? null;
$secure = $options['secure'] ?? false;
$httpOnly = $options['httpOnly'] ?? true;
// add an HMAC signature of the value
$value = static::hmac($value) . '+' . $value;
// store that thing in the cookie global
$_COOKIE[$key] = $value;
// store the cookie
return setcookie($key, $value, static::lifetime($lifetime), $path, $domain, $secure, $httpOnly);
}
/**
* Calculates the lifetime for a cookie
*
* @param int $minutes Number of minutes or timestamp
* @return int
*/
public static function lifetime(int $minutes): int
{
if ($minutes > 1000000000) {
// absolute timestamp
return $minutes;
} elseif ($minutes > 0) {
// minutes from now
return time() + ($minutes * 60);
} else {
return 0;
}
}
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Http
/Cookie.php
* @return bool true: cookie was created,
* false: cookie creation failed
*/
public static function set(string $key, string $value, array $options = []): bool
{
// extract options
$lifetime = $options['lifetime'] ?? 0;
$path = $options['path'] ?? '/';
$domain = $options['domain'] ?? null;
$secure = $options['secure'] ?? false;
$httpOnly = $options['httpOnly'] ?? true;
// add an HMAC signature of the value
$value = static::hmac($value) . '+' . $value;
// store that thing in the cookie global
$_COOKIE[$key] = $value;
// store the cookie
return setcookie($key, $value, static::lifetime($lifetime), $path, $domain, $secure, $httpOnly);
}
/**
* Calculates the lifetime for a cookie
*
* @param int $minutes Number of minutes or timestamp
* @return int
*/
public static function lifetime(int $minutes): int
{
if ($minutes > 1000000000) {
// absolute timestamp
return $minutes;
} elseif ($minutes > 0) {
// minutes from now
return time() + ($minutes * 60);
} else {
return 0;
}
}
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Session
/Session.php
if ($this->tokenExpiry !== null) {
$this->newSession = $tokenExpiry . '.' . $tokenId;
$this->commit();
// we are now in the context of the new session
$this->newSession = null;
}
// set new data as instance vars
$this->tokenExpiry = $tokenExpiry;
$this->tokenId = $tokenId;
$this->tokenKey = $tokenKey;
// the new session needs to be written for the first time
$this->writeMode = true;
// (re)transmit session token
if ($this->mode === 'cookie') {
Cookie::set($this->sessions->cookieName(), $this->token(), [
'lifetime' => $this->tokenExpiry,
'path' => Url::index(['host' => null, 'trailingSlash' => true]),
'secure' => Url::scheme() === 'https',
'httpOnly' => true
]);
} else {
$this->needsRetransmission = true;
}
// update cache of the Sessions instance with the new token
$this->sessions->updateCache($this);
}
/**
* Returns whether the session token needs to be retransmitted to the client
* Only relevant in header and manual modes
*
* @return bool
*/
public function needsRetransmission(): bool
{
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Session
/Session.php
}
/**
* Ensures that all pending changes are written to disk before the object is destructed
*/
public function __destruct()
{
$this->commit();
}
/**
* Initially generates the token for new sessions
* Used internally
*
* @return void
*/
public function ensureToken()
{
if ($this->tokenExpiry === null) {
$this->regenerateToken();
}
}
/**
* Puts the session into write mode by acquiring a lock and reloading the data
* Used internally
*
* @return void
*/
public function prepareForWriting()
{
// verify that we need to get into write mode:
// - new sessions are only written to if the token has explicitly been ensured
// using $session->ensureToken() -> lazy session creation
// - destroyed sessions are never written to
// - no need to lock and re-init if we are already in write mode
if ($this->tokenExpiry === null || $this->destroyed === true || $this->writeMode === true) {
return;
}
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Session
/SessionData.php
* @codeCoverageIgnore
* @param \Kirby\Session\Session $session Session object this data belongs to
* @param array $data Currently stored session data
*/
public function __construct(Session $session, array $data)
{
$this->session = $session;
$this->data = $data;
}
/**
* Sets one or multiple session values by key
*
* @param string|array $key The key to define or a key-value array with multiple values
* @param mixed $value The value for the passed key (only if one $key is passed)
* @return void
*/
public function set($key, $value = null)
{
$this->session->ensureToken();
$this->session->prepareForWriting();
if (is_string($key)) {
$this->data[$key] = $value;
} elseif (is_array($key)) {
$this->data = array_merge($this->data, $key);
} else {
throw new InvalidArgumentException([
'data' => ['method' => 'SessionData::set', 'argument' => 'key'],
'translate' => false
]);
}
}
/**
* Increments one or multiple session values by a specified amount
*
* @param string|array $key The key to increment or an array with multiple keys
* @param int $by Increment by which amount?
* @param int $max Maximum amount (value is not incremented further)
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Session
/Session.php
}
/**
* Magic call method that proxies all calls to session data methods
*
* @param string $name Method name (one of set, increment, decrement, get, pull, remove, clear)
* @param array $arguments Method arguments
* @return mixed
*/
public function __call(string $name, array $arguments)
{
// validate that we can handle the called method
if (!in_array($name, ['set', 'increment', 'decrement', 'get', 'pull', 'remove', 'clear'])) {
throw new BadMethodCallException([
'data' => ['method' => 'Session::' . $name],
'translate' => false
]);
}
return $this->data()->$name(...$arguments);
}
/**
* Writes all changes to the session to the session store
*
* @return void
*/
public function commit()
{
// nothing to do if nothing changed or the session has been just created or destroyed
if ($this->writeMode !== true || $this->tokenExpiry === null || $this->destroyed === true) {
return;
}
// collect all data
if ($this->newSession) {
// the token has changed
// we are writing to the old session: it only gets the reference to the new session
// and a shortened expiry time (30 second grace period)
$data = [
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/config
/helpers.php
/**
* Checks / returns a CSRF token
*
* @param string $check Pass a token here to compare it to the one in the session
* @return string|bool Either the token or a boolean check result
*/
function csrf(string $check = null)
{
$session = App::instance()->session();
// check explicitly if there have been no arguments at all;
// checking for null introduces a security issue because null could come
// from user input or bugs in the calling code!
if (func_num_args() === 0) {
// no arguments, generate/return a token
$token = $session->get('csrf');
if (is_string($token) !== true) {
$token = bin2hex(random_bytes(32));
$session->set('csrf', $token);
}
return $token;
} elseif (is_string($check) === true && is_string($session->get('csrf')) === true) {
// argument has been passed, check the token
return hash_equals($session->get('csrf'), $check) === true;
}
return false;
}
/**
* Creates one or multiple CSS link tags
*
* @param string|array $url Relative or absolute URLs, an array of URLs or `@auto` for automatic template css loading
* @param string|array $options Pass an array of attributes for the link tag or a media attribute string
* @return string|null
*/
function css($url, $options = null): ?string
{
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/vendor
/mzur
/kirby-form
/src
/helpers.php
use Kirby\Toolkit\V;
use Jevets\Kirby\Form;
if (!function_exists('csrf_field')) {
/**
* Generate a CSRF token form field.
*
* This function can be called multiple times and will reuse the same token during a
* single request.
*
* @param string $t The CSRF token to use. If empty a new one will be generated and reused for the duration of a request.
*
* @return string
*/
function csrf_field($t = null)
{
// remember the token for multipme function calls
static $token = null;
$token = $token ?: csrf();
// the token parameter overrides the generated token
return '<input type="hidden" name="'.Form::CSRF_FIELD.'" value="'.($t ?: $token).'">';
}
}
if (class_exists(V::class)) {
// Extended validation rules for file uploads.
V::$validators['file'] = function ($value) {
return is_array($value) &&
array_key_exists('name', $value) &&
array_key_exists('type', $value) &&
array_key_exists('size', $value) &&
array_key_exists('tmp_name', $value) &&
array_key_exists('error', $value) &&
($value['error'] === UPLOAD_ERR_OK || $value['error'] === UPLOAD_ERR_NO_FILE);
};
V::$validators['requiredFile'] = function ($value) {
return V::file($value) && $value['error'] === UPLOAD_ERR_OK;
};
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/site
/snippets
/form
/form-register.php
] ); ?>
</div>
<div class="form__field">
<?php snippet('form/fields/input', [
'label' => 'E-Mail',
'name' => 'email',
'type' => 'email',
'required' => true,
] ); ?>
</div>
<div class="form__field">
<?php snippet('form/fields/checkbox', [
'label' => 'Zustimmung zur Datennutzung',
'name' => 'dataprivacy',
'required' => true,
] ); ?><br>
<span style="font-size:0.65rem; line-height: 110%">Ich willige ein, regelmäßig Informationen von Zukunftsinitiative Gastro, Salomon FoodWorld GmbH und FVZ Convenience GmbH zu erhalten. Außerdem erlaube ich SALOMON FoodWorld®, meine Daten für die Erstellung eines Accounts zu verarbeiten und wenn nötig an Partner weiterzugebenen. Details findest du im <a href="/info/datenschutz" target="_blank">Datenschutz</a>.</span><br><br>
</div>
</div>
<?= csrf_field(); ?>
<?= honeypot_field(); ?>
<div class="align-center">
<button type="submit" class="btn btn--primary"><?= t('form-submit', 'Kostenlos Registrieren'); ?></button>
</div>
</div>
<p class="align-center">Sie haben bereits einen Zugang? <em data-hide="#form-register" data-show="#form-login">Zum Login.</em></p>
</form>
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Toolkit
/Tpl.php
/**
* Renders the template
*
* @param string $__file
* @param array $__data
* @return string
*/
public static function load(string $__file = null, array $__data = []): string
{
if (file_exists($__file) === false) {
return '';
}
$exception = null;
ob_start();
extract($__data);
try {
require $__file;
} catch (Throwable $e) {
$exception = $e;
}
$content = ob_get_contents();
ob_end_clean();
if ($exception === null) {
return $content;
}
throw $exception;
}
}
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/config
/components.php
* @param array $data Data array for the snippet
* @return string|null
*/
'snippet' => function (App $kirby, $name, array $data = []): ?string {
$snippets = A::wrap($name);
foreach ($snippets as $name) {
$name = (string)$name;
$file = $kirby->root('snippets') . '/' . $name . '.php';
if (file_exists($file) === false) {
$file = $kirby->extensions('snippets')[$name] ?? null;
}
if ($file) {
break;
}
}
return Snippet::load($file, $data);
},
/**
* Add your own template engine
*
* @param \Kirby\Cms\App $kirby Kirby instance
* @param string $name Template name
* @param string $type Extension type
* @param string $defaultType Default extension type
* @return \Kirby\Cms\Template
*/
'template' => function (App $kirby, string $name, string $type = 'html', string $defaultType = 'html') {
return new Template($name, $type, $defaultType);
},
/**
* Add your own thumb generator
*
* @param \Kirby\Cms\App $kirby Kirby instance
* @param string $src The root of the original file
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Cms
/App.php
if (empty($languageSmartypants) === false) {
$options = array_merge($options, $languageSmartypants);
}
}
return $this->component('smartypants')($this, $text, $options);
}
/**
* Uses the snippet component to create
* and return a template snippet
*
* @internal
* @param mixed $name
* @param array $data
* @return string|null
*/
public function snippet($name, array $data = []): ?string
{
return $this->component('snippet')($this, $name, array_merge($this->data, $data));
}
/**
* System check class
*
* @return \Kirby\Cms\System
*/
public function system()
{
return $this->system = $this->system ?? new System($this);
}
/**
* Uses the template component to initialize
* and return the Template object
*
* @internal
* @return \Kirby\Cms\Template
* @param string $name
* @param string $type
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/config
/helpers.php
function smartypants(string $text = null): string
{
return App::instance()->smartypants($text);
}
/**
* Embeds a snippet from the snippet folder
*
* @param string|array $name
* @param array|object $data
* @param bool $return
* @return string
*/
function snippet($name, $data = [], bool $return = false)
{
if (is_object($data) === true) {
$data = ['item' => $data];
}
$snippet = App::instance()->snippet($name, $data);
if ($return === true) {
return $snippet;
}
echo $snippet;
}
/**
* Includes an SVG file by absolute or
* relative file path.
*
* @param string|\Kirby\Cms\File $file
* @return string|false
*/
function svg($file)
{
// support for Kirby's file objects
if (is_a($file, 'Kirby\Cms\File') === true && $file->extension() === 'svg') {
return $file->read();
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/site
/templates
/tp-home.php
<?php if ($page->quote_author_3()->isNotEmpty()) : ?>
<span><?= $page->quote_author_3(); ?></span>
<?php endif; ?>
</div>
</div>
<?php snippet('content/register') ?>
</section>
<section id="register" class="mdl<?php e(get('authorized') == '0', ' is-open'); ?> / js-mdl">
<div class="mdl__inner">
<header class="mdl__header">
<h6>Zugang</h6>
<button class="mdl__icon js-close-mdl"><svg class="icon">
<use xlink:href="#icon-close" />
</svg></button>
</header>
<div class="mdl__content">
<?php snippet('form/form-register') ?>
<?php snippet('form/form-login') ?>
</div>
</div>
</section>
</main>
<?php snippet('footer') ?>
<?php snippet('foot') ?>
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Toolkit
/Tpl.php
/**
* Renders the template
*
* @param string $__file
* @param array $__data
* @return string
*/
public static function load(string $__file = null, array $__data = []): string
{
if (file_exists($__file) === false) {
return '';
}
$exception = null;
ob_start();
extract($__data);
try {
require $__file;
} catch (Throwable $e) {
$exception = $e;
}
$content = ob_get_contents();
ob_end_clean();
if ($exception === null) {
return $content;
}
throw $exception;
}
}
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Cms
/Template.php
}
}
/**
* Returns the template name
*
* @return string
*/
public function name(): string
{
return $this->name;
}
/**
* @param array $data
* @return string
*/
public function render(array $data = []): string
{
return Tpl::load($this->file(), $data);
}
/**
* Returns the root to the templates directory
*
* @return string
*/
public function root(): string
{
return App::instance()->root($this->store());
}
/**
* Returns the template type
*
* @return string
*/
public function type(): string
{
return $this->type;
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Cms
/Page.php
}
// fetch the page regularly
if ($html === null) {
$kirby->data = $this->controller($data, $contentType);
if ($contentType === 'html') {
$template = $this->template();
} else {
$template = $this->representation($contentType);
}
if ($template->exists() === false) {
throw new NotFoundException([
'key' => 'template.default.notFound'
]);
}
// render the page
$html = $template->render($kirby->data);
// convert the response configuration to an array
$response = $kirby->response()->toArray();
// cache the result
if ($cache !== null) {
$cache->set($cacheId, [
'html' => $html,
'response' => $response
]);
}
}
return $html;
}
/**
* @internal
* @param mixed $type
* @return \Kirby\Cms\Template
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Cms
/App.php
// Empty input
if (empty($input) === true) {
return $this->io(new NotFoundException());
}
// Response Configuration
if (is_a($input, 'Kirby\Cms\Responder') === true) {
return $input->send();
}
// Responses
if (is_a($input, 'Kirby\Http\Response') === true) {
return $input;
}
// Pages
if (is_a($input, 'Kirby\Cms\Page')) {
try {
$html = $input->render();
} catch (ErrorPageException $e) {
return $this->io($e);
}
if ($input->isErrorPage() === true) {
if ($response->code() === null) {
$response->code(404);
}
}
return $response->send($html);
}
// Files
if (is_a($input, 'Kirby\Cms\File')) {
return $response->redirect($input->mediaUrl(), 307)->send();
}
// Simple HTML response
if (is_string($input) === true) {
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/kirby
/src
/Cms
/App.php
$scriptName = $_SERVER['SCRIPT_NAME'];
$scriptFile = basename($scriptName);
$scriptDir = dirname($scriptName);
$scriptPath = $scriptFile === 'index.php' ? $scriptDir : $scriptName;
$requestPath = preg_replace('!^' . preg_quote($scriptPath) . '!', '', $requestUri);
return $this->setPath($requestPath)->path;
}
/**
* Returns the Response object for the
* current request
*
* @param string|null $path
* @param string|null $method
* @return \Kirby\Http\Response
*/
public function render(string $path = null, string $method = null)
{
return $this->io($this->call($path, $method));
}
/**
* Returns the Request singleton
*
* @return \Kirby\Http\Request
*/
public function request()
{
return $this->request = $this->request ?? new Request();
}
/**
* Path resolver for the router
*
* @internal
* @param string $path
* @param string|null $language
* @return mixed
*/
/is
/htdocs
/wp13455541_PZ0EDZVYE9
/www
/sfw-zukunftsinitiative-gastro
/index.php
<?php
require 'kirby/bootstrap.php';
echo (new Kirby)->render();