38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
require_once 'core.php';
|
|
init_class();
|
|
|
|
try {
|
|
$loader = new \Twig\Loader\FilesystemLoader('templates');
|
|
} catch (Exception $e) {
|
|
$loader = new \Twig\Loader\FilesystemLoader('../templates');
|
|
}
|
|
$twig = new \Twig\Environment($loader, [
|
|
//'cache' => 'compilation'
|
|
]);
|
|
$template = NULL;
|
|
function loadtemplate($templatename, $data, $requirelogin=true){
|
|
global $user, $twig, $template;
|
|
if($requirelogin){
|
|
$user->requirelogin();
|
|
}
|
|
$data['owner'] = owner;
|
|
$data['urlsoftware'] = WEB_URL;
|
|
$data['user'] = $user->info();
|
|
$data['enable_technical_support'] = ENABLE_TECHNICAL_SUPPORT;
|
|
$data['technical_support_key'] = TECHNICAL_SUPPORT_KEY;
|
|
$data['technical_support_open'] = isset($_COOKIE["chat"]);
|
|
if(USE_CUSTOM_ERROR_SOUND){
|
|
$data['error_sound'] = "custom-error.mp3";
|
|
} else {
|
|
$data['error_sound'] = "error.mp3";
|
|
}
|
|
if(USE_CUSTOM_ERROR_IMAGE){
|
|
$data['error_image'] = "custom-error.gif";
|
|
} else {
|
|
$data['error_image'] = "error.gif";
|
|
}
|
|
$template = $twig->load($templatename);
|
|
echo $template->render($data);
|
|
}
|