<?php
include_once('./_common.php');

header('Content-Type: text/html; charset=utf-8');

$thema = isset($_GET['thema']) ? preg_replace('/[^a-zA-Z0-9_-]/', '', (string)$_GET['thema']) : '';
if (!$thema) {
	$thema = isset($config['as_'.MOBILE_.'thema']) && $config['as_'.MOBILE_.'thema'] ? $config['as_'.MOBILE_.'thema'] : 'Basic';
}

$target_url = isset($_GET['url']) ? strip_tags((string)$_GET['url']) : '';
if ($target_url !== '') {
	$urlencode = urlencode($target_url);
}

if (IS_YC && function_exists('thema_member') && !isset($member['cart'])) {
	thema_member('cart');
}

$widget_rel_path = '/thema/'.$thema.'/widget/basic-outlogin';
$widget_path = G5_PATH.$widget_rel_path;
$widget_url = G5_URL.$widget_rel_path;

if (!is_file($widget_path.'/widget.php')) {
	$widget_rel_path = '/thema/Basic/widget/basic-outlogin';
	$widget_path = G5_PATH.$widget_rel_path;
	$widget_url = G5_URL.$widget_rel_path;
}

if (!is_file($widget_path.'/widget.php')) {
	http_response_code(404);
	exit;
}

$wset = array();
include($widget_path.'/widget.php');
?>