You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
6.7 KiB
PHTML

<?php
require_once realpath(__DIR__ . '/../includes/engelsystem_provider.php');
14 years ago
$free_pages = [
'admin_event_config',
'angeltypes',
'api',
'atom',
'credits',
'ical',
'login',
'rooms',
'shifts',
'shifts_json_export',
'shifts_json_export_all',
'stats',
'users',
'user_driver_licenses',
8 years ago
'user_password_recovery'
];
// Gewünschte Seite/Funktion
$page = '';
$title = '';
$content = '';
$page = $request->input('p');
if (empty($page)) {
$page = isset($user) ? 'news' : 'login';
}
8 years ago
if (
preg_match('/^\w*$/i', $page)
8 years ago
&& (
in_array($page, $free_pages)
|| (isset($privileges) && in_array($page, $privileges))
8 years ago
)
) {
8 years ago
$title = $page;
8 years ago
if ($page == 'api') {
error('Api disabled temporarily.');
redirect(page_link_to());
8 years ago
require_once realpath(__DIR__ . '/../includes/controller/api.php');
api_controller();
} elseif ($page == 'ical') {
8 years ago
require_once realpath(__DIR__ . '/../includes/pages/user_ical.php');
user_ical();
} elseif ($page == 'atom') {
8 years ago
require_once realpath(__DIR__ . '/../includes/pages/user_atom.php');
user_atom();
} elseif ($page == 'shifts_json_export') {
8 years ago
require_once realpath(__DIR__ . '/../includes/controller/shifts_controller.php');
shifts_json_export_controller();
} elseif ($page == 'shifts_json_export_all') {
8 years ago
require_once realpath(__DIR__ . '/../includes/controller/shifts_controller.php');
shifts_json_export_all_controller();
} elseif ($page == 'stats') {
8 years ago
require_once realpath(__DIR__ . '/../includes/pages/guest_stats.php');
guest_stats();
} elseif ($page == 'user_password_recovery') {
8 years ago
require_once realpath(__DIR__ . '/../includes/controller/users_controller.php');
$title = user_password_recovery_title();
$content = user_password_recovery_controller();
} elseif ($page == 'angeltypes') {
8 years ago
list($title, $content) = angeltypes_controller();
} elseif ($page == 'shifts') {
8 years ago
list($title, $content) = shifts_controller();
} elseif ($page == 'users') {
8 years ago
list($title, $content) = users_controller();
} elseif ($page == 'user_angeltypes') {
8 years ago
list($title, $content) = user_angeltypes_controller();
} elseif ($page == 'user_driver_licenses') {
8 years ago
list($title, $content) = user_driver_licenses_controller();
} elseif ($page == 'shifttypes') {
8 years ago
list($title, $content) = shifttypes_controller();
} elseif ($page == 'admin_event_config') {
8 years ago
list($title, $content) = event_config_edit_controller();
} elseif ($page == 'rooms') {
8 years ago
list($title, $content) = rooms_controller();
} elseif ($page == 'news') {
8 years ago
$title = news_title();
$content = user_news();
} elseif ($page == 'news_comments') {
8 years ago
require_once realpath(__DIR__ . '/../includes/pages/user_news.php');
$title = user_news_comments_title();
$content = user_news_comments();
} elseif ($page == 'user_meetings') {
8 years ago
$title = meetings_title();
$content = user_meetings();
} elseif ($page == 'user_myshifts') {
8 years ago
$title = myshifts_title();
$content = user_myshifts();
} elseif ($page == 'user_shifts') {
8 years ago
$title = shifts_title();
$content = user_shifts();
} elseif ($page == 'user_messages') {
8 years ago
$title = messages_title();
$content = user_messages();
} elseif ($page == 'user_questions') {
8 years ago
$title = questions_title();
$content = user_questions();
} elseif ($page == 'user_settings') {
8 years ago
$title = settings_title();
$content = user_settings();
} elseif ($page == 'login') {
8 years ago
$title = login_title();
$content = guest_login();
} elseif ($page == 'register') {
8 years ago
$title = register_title();
$content = guest_register();
} elseif ($page == 'logout') {
8 years ago
$title = logout_title();
$content = guest_logout();
} elseif ($page == 'admin_questions') {
8 years ago
$title = admin_questions_title();
$content = admin_questions();
} elseif ($page == 'admin_user') {
8 years ago
$title = admin_user_title();
$content = admin_user();
} elseif ($page == 'admin_arrive') {
8 years ago
$title = admin_arrive_title();
$content = admin_arrive();
} elseif ($page == 'admin_active') {
8 years ago
$title = admin_active_title();
$content = admin_active();
} elseif ($page == 'admin_free') {
8 years ago
$title = admin_free_title();
$content = admin_free();
} elseif ($page == 'admin_news') {
8 years ago
require_once realpath(__DIR__ . '/../includes/pages/admin_news.php');
$content = admin_news();
} elseif ($page == 'admin_rooms') {
8 years ago
$title = admin_rooms_title();
$content = admin_rooms();
} elseif ($page == 'admin_groups') {
8 years ago
$title = admin_groups_title();
$content = admin_groups();
} elseif ($page == 'admin_import') {
8 years ago
$title = admin_import_title();
$content = admin_import();
} elseif ($page == 'admin_shifts') {
8 years ago
$title = admin_shifts_title();
$content = admin_shifts();
} elseif ($page == 'admin_log') {
8 years ago
$title = admin_log_title();
$content = admin_log();
} elseif ($page == 'credits') {
8 years ago
require_once realpath(__DIR__ . '/../includes/pages/guest_credits.php');
$title = credits_title();
$content = guest_credits();
} else {
require_once realpath(__DIR__ . '/../includes/pages/guest_start.php');
$content = guest_start();
}
14 years ago
} else {
8 years ago
// Wenn schon eingeloggt, keine-Berechtigung-Seite anzeigen
8 years ago
if (isset($user)) {
$title = _('No Access');
$content = _('You don\'t have permission to view this page . You probably have to sign in or register in order to gain access!');
8 years ago
} else {
// Sonst zur Loginseite leiten
redirect(page_link_to('login'));
8 years ago
}
14 years ago
}
$event_config = EventConfig();
echo view(__DIR__ . '/../templates/layout.html', [
'theme' => isset($user) ? $user['color'] : config('theme'),
8 years ago
'title' => $title,
'atom_link' => ($page == 'news' || $page == 'user_meetings')
? ' <link href="' . page_link_to('atom') . (($page == 'user_meetings') ? '&meetings=1' : '')
. '&amp;key=' . (isset($user) ? $user['api_key'] : '')
. '" type = "application/atom+xml" rel = "alternate" title = "Atom Feed">'
: '',
8 years ago
'menu' => make_menu(),
'content' => msg() . $content,
'header_toolbar' => header_toolbar(),
'faq_url' => config('faq_url'),
'contact_email' => config('contact_email'),
8 years ago
'locale' => locale(),
'event_info' => EventConfig_info($event_config) . ' <br />'
]);