rules = array_merge( ['roster/?$' => 'index.php?wowpress_page=roster'], ['raids/?$' => 'index.php?wowpress_page=raids&year=' . date('Y') . "&month=" . date('m')], ['raids/(\d+)/(\d+)?$' => 'index.php?wowpress_page=raids&year=$matches[1]&month=$matches[2]'], ['raid/(\d+)/?$' => 'index.php?wowpress_page=raid&raid_id=$matches[1]'], ['request/?$' => 'index.php?wowpress_page=form_request'], ['sks/?$' => 'index.php?wowpress_page=sks'], ['sks/([A-Za-z-0-9 ]+)?$' => 'index.php?wowpress_page=sks&list_name=$matches[1]'], ['logs/?$' => 'index.php?wowpress_page=logs'], ['db/?$' => 'index.php?wowpress_page=db'], ['kummerkasten/?$' => 'index.php?wowpress_page=complaints'], ['kummerkasten/(\d+)/?$' => 'index.php?wowpress_page=complaints&complaint_id=$matches[1]'], ['lists/?$' => 'index.php?wowpress_page=lists'], ['list/(\d+)/?$' => 'index.php?wowpress_page=lists&list_id=$matches[1]'], $wp_rewrite->rules ); }); add_filter('query_vars', function ($query_vars) { $query_vars[] = 'wowpress_page'; $query_vars[] = 'year'; $query_vars[] = 'month'; $query_vars[] = 'raid_id'; $query_vars[] = 'list_name'; $query_vars[] = 'list_id'; $query_vars[] = 'complaint_id'; return $query_vars; }); add_action('template_redirect', function () { $page = get_query_var('wowpress_page'); setGlobalUser(); switch ($page) { case 'db': isAllowed('wowpress_edit_site'); wowpress_database(); header('Location: /'); die; break; case 'lists': $list = get_query_var('list_id'); $list = CharacterList::find($list); if ($list) { $GLOBALS['wowpress']['page_title'] = $list->list_name; include plugin_dir_path(__FILE__) . '../pages/single_charlist.php'; } else { $GLOBALS['wowpress']['page_title'] = "Charakterlisten"; include plugin_dir_path(__FILE__) . '../pages/charlists.php'; } die; break; case 'complaints': isAllowed('wowpress_view_complaints'); $GLOBALS['wowpress']['page_title'] = "Kummerkasten"; include plugin_dir_path(__FILE__) . '../pages/complaints.php'; die; break; case 'roster': $GLOBALS['wowpress']['page_title'] = "Gildenverzeichnis"; include plugin_dir_path(__FILE__) . '../pages/roster.php'; die; break; case 'sks': isAllowed('wowpress_view_raids'); $GLOBALS['wowpress']['page_title'] = "SKS-Liste"; $GLOBALS['wowpress']['liste'] = get_query_var('list_name', null); include plugin_dir_path(__FILE__) . '../pages/sks.php'; die; break; case 'logs': # $cl = new CharacterList(); # $cl->list_name = "Strike-Liste TWW Season 1"; # $cl->border_color = "red"; # $cl->max_count = 6; # $cl->notify = true; # $cl->save(); $cl = CharacterList::find(14); $char = Character::first(); #$char = Character::find(8); $cl->addItem($char,'Richtig Dumm','2024-09-26'); dd($cl->characters); exit; isAllowed('wowpress_edit_raids'); $GLOBALS['wowpress']['page_title'] = "Logs"; echo "
"; echo '
'; foreach (Log::all() as $log) { ?>
Message: message ?>
Action: action ?>
Logged: created_at, "dd.MM.YY HH:mm") ?>

"; die; break; case 'raids': # isAllowed('wowpress_view_raids'); $GLOBALS['wowpress']['page_title'] = "Raids"; $GLOBALS['wowpress']['raids']['year'] = get_query_var('year'); $GLOBALS['wowpress']['raids']['month'] = get_query_var('month'); include plugin_dir_path(__FILE__) . '../pages/raids.php'; die; break; case 'raid': isAllowed('wowpress_view_raids'); $raid = Raid::find(get_query_var('raid_id')); $GLOBALS['wowpress']['raid'] = $raid; $GLOBALS['wowpress']['page_title'] = $raid->title; include plugin_dir_path(__FILE__) . '../pages/single_raid.php'; die; break; case 'form_request': include plugin_dir_path(__FILE__) . '../request.php'; die; default: // DO NOTHING break; } });