First version, for githup; UNSTABLE, DO NOT USE!
This commit is contained in:
94
www/intern/scripts/abt_handler.php
Normal file
94
www/intern/scripts/abt_handler.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
if (empty($_SESSION['access_granted_kampfrichter']) || $_SESSION['access_granted_kampfrichter'] !== true || empty($_SESSION['passcodekampfrichter_id']) || $_SESSION['passcodekampfrichter_id'] < 1) {
|
||||
http_response_code(403);
|
||||
exit;
|
||||
}
|
||||
|
||||
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
|
||||
$url = $protocol . $domain;
|
||||
|
||||
if ((isset($_POST['prev_abt'])) && !empty($_POST['prev_abt_submit'])) {
|
||||
$value = get_option('wk_panel_current_abt', 1);
|
||||
if ($value > 1){
|
||||
$value -= 1;
|
||||
update_option('wk_panel_current_abt', $value);
|
||||
}
|
||||
|
||||
header("Location: ".$url."/intern/kampfrichter".$_SERVER['REQUEST_URI']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ((isset($_POST['next_abt'])) && !empty($_POST['next_abt_submit'])) {
|
||||
$value = get_option('wk_panel_current_abt', 1);
|
||||
$maxvalue = $wpdb->get_var( "SELECT abteilung FROM $table_name ORDER BY abteilung DESC LIMIT 1" );
|
||||
|
||||
if ($value < $maxvalue){
|
||||
$value += 1;
|
||||
update_option('wk_panel_current_abt', $value);
|
||||
}
|
||||
header("Location: ".$url."/intern/kampfrichter".$_SERVER['REQUEST_URI']);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (!isset($_SESSION['currentsubabt'])){
|
||||
$_SESSION['currentsubabt'] = 0;
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['last_abt'])){
|
||||
$_SESSION['last_abt'] = get_option('wk_panel_current_abt', 1);
|
||||
}
|
||||
|
||||
if ($_SESSION['last_abt'] !== get_option('wk_panel_current_abt', 1)){
|
||||
$_SESSION['currentsubabt'] = 0;
|
||||
$_SESSION['last_abt'] = get_option('wk_panel_current_abt', 1);
|
||||
}
|
||||
|
||||
if ((isset($_POST['prev_subabt'])) && !empty($_POST['prev_subabt_submit'])) {
|
||||
$value = $_SESSION['currentsubabt'];
|
||||
if ($value > 0){
|
||||
$_SESSION['currentsubabt']--;
|
||||
$_SESSION['last_abt'] = get_option('wk_panel_current_abt', 1);
|
||||
}
|
||||
header("Location: ".$url."/intern/kampfrichter");
|
||||
exit;
|
||||
}
|
||||
if ((isset($_POST['next_subabt'])) && !empty($_POST['next_subabt_submit'])) {
|
||||
|
||||
$value = $_SESSION['currentsubabt'];
|
||||
|
||||
if ($value < 4){
|
||||
$_SESSION['currentsubabt']++;
|
||||
$_SESSION['last_abt'] = get_option('wk_panel_current_abt', 1);
|
||||
}
|
||||
header("Location: ".$url."/intern/kampfrichter");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (
|
||||
isset($_POST['togle_advanced_mode']) &&
|
||||
!empty($_POST['togle_advanced_mode_submit']) &&
|
||||
check_admin_referer('toggle_advanced_mode_action', 'toggle_advanced_mode_nonce')
|
||||
) {
|
||||
$current_value = get_option('option_advanced_mode', false);
|
||||
$new_value = !$current_value;
|
||||
update_option('option_advanced_mode', $new_value);
|
||||
|
||||
hheader("Location: ".$url."/intern/kampfrichter".$_SERVER['REQUEST_URI']);
|
||||
exit;
|
||||
}
|
||||
if (
|
||||
isset($_POST['togle_advanced_mode_admin']) &&
|
||||
!empty($_POST['togle_advanced_mode_admin_submit']) &&
|
||||
check_admin_referer('toggle_advanced_mode_admin_action', 'toggle_advanced_mode_admin_nonce')
|
||||
) {
|
||||
$current_value = get_option('option_advanced_mode_admin', false);
|
||||
$new_value = !$current_value;
|
||||
update_option('option_advanced_mode_admin', $new_value);
|
||||
|
||||
header("Location: ".$url."/intern/kampfrichter".$_SERVER['REQUEST_URI']);
|
||||
exit;
|
||||
}
|
||||
Reference in New Issue
Block a user