Semi-stable version with old variable names
This commit is contained in:
@@ -10,11 +10,11 @@ if ($userid > 0) {
|
||||
$result = $stmt->get_result();
|
||||
|
||||
if ($result) {
|
||||
$dbarray = $result->fetch_assoc(); // $programme is an array
|
||||
$dbarray = $result->fetch_assoc();
|
||||
}
|
||||
|
||||
$freigabe_json = $dbarray['freigabe'];
|
||||
$username = $dbarray['username'];
|
||||
$freigabe_json = $dbarray['freigabe'] ?? '';
|
||||
$username = $dbarray['username'] ?? '';
|
||||
|
||||
$stmt->close();
|
||||
|
||||
@@ -24,27 +24,26 @@ if ($userid > 0) {
|
||||
$arrayfreigaben = $arrayfreigaben['freigabenKampfrichter'] ?? [];
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfreigaben)) {
|
||||
|
||||
$key = array_search('admin', $arrayfreigaben, true);
|
||||
if ($key !== false) {
|
||||
unset($arrayfreigaben[$key]);
|
||||
array_unshift($arrayfreigaben, 'admin');
|
||||
$arrayfreigaben = array_values($arrayfreigaben);
|
||||
}
|
||||
|
||||
$selectedfreigabe = $_SESSION['selectedFreigabeKampfrichter'] ?? $arrayfreigaben[0];
|
||||
|
||||
if (!in_array($selectedfreigabe, $arrayfreigaben, true)) {
|
||||
$selectedfreigabe = $arrayfreigaben[0];
|
||||
}
|
||||
|
||||
$_SESSION['selectedFreigabeKampfrichter'] = $selectedfreigabe;
|
||||
} else {
|
||||
if (empty($arrayfreigaben)) {
|
||||
echo 'Keine gültigen Freigaben! Sie wurden abgemeldet.';
|
||||
$_SESSION['access_granted_kampfrichter'] = false;
|
||||
$_SESSION['logoDisplay'] = true;
|
||||
exit;
|
||||
}
|
||||
|
||||
$selecteduser = $selectedfreigabe;
|
||||
$key = array_search("A", $arrayfreigaben, true);
|
||||
if ($key !== false) {
|
||||
unset($arrayfreigaben[$key]);
|
||||
array_unshift($arrayfreigaben, "A");
|
||||
$arrayfreigaben = array_values($arrayfreigaben);
|
||||
}
|
||||
|
||||
$selectedFreigabeId = $_SESSION['selectedFreigabeIdKampfrichter'] ?? $arrayfreigaben[0];
|
||||
|
||||
if (!in_array($selectedFreigabeId, $arrayfreigaben, true)) {
|
||||
$selectedFreigabeId = $arrayfreigaben[0];
|
||||
}
|
||||
|
||||
$_SESSION['selectedFreigabeIdKampfrichter'] = $selectedFreigabeId;
|
||||
|
||||
$isAdmin = $selectedFreigabeId === 'A';
|
||||
|
||||
@@ -4,44 +4,57 @@
|
||||
$form_message = $_SESSION['form_message'] ?? '';
|
||||
unset($_SESSION['form_message']);
|
||||
|
||||
if ((isset($_POST['prev_abt'])) && !empty($_POST['prev_abt_submit'])) {
|
||||
if (isset($_POST['prev_abt_submit'])) {
|
||||
verify_csrf();
|
||||
$value = $aktabt;
|
||||
if ($value > 1){
|
||||
$value -= 1;
|
||||
$name = 'wk_panel_current_abt';
|
||||
|
||||
$stmt = $mysqli->prepare("INSERT INTO $tableVar (`name`, `value`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `value` = VALUE(`value`)");
|
||||
|
||||
$stmt->bind_param("ss", $name, $value);
|
||||
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
db_update_variable($mysqli, $tableVar, ['wk_panel_current_abt', $value]);
|
||||
}
|
||||
header("Location: /intern/kampfrichter");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ((isset($_POST['next_abt'])) && !empty($_POST['next_abt_submit'])) {
|
||||
if (isset($_POST['next_abt_submit'])) {
|
||||
verify_csrf();
|
||||
$value = $aktabt;
|
||||
$maxvalue = db_get_var($mysqli, "SELECT name FROM $tableAbt ORDER BY name DESC LIMIT 1");
|
||||
$maxvalue = (int) (db_get_var($mysqli, "SELECT name FROM $tableAbt ORDER BY name DESC LIMIT 1") ?? 1);
|
||||
|
||||
if ($value < $maxvalue){
|
||||
$value += 1;
|
||||
$name = 'wk_panel_current_abt';
|
||||
|
||||
$stmt = $mysqli->prepare("INSERT INTO $tableVar (`name`, `value`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `value` = VALUE(`value`)");
|
||||
|
||||
$stmt->bind_param("ss", $name, $value);
|
||||
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
db_update_variable($mysqli, $tableVar, ['wk_panel_current_abt', $value]);
|
||||
}
|
||||
header("Location: /intern/kampfrichter");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['prev_subabt_admin_submit']) && $isAdmin) {
|
||||
verify_csrf();
|
||||
$value = $akt_subabt_admin;
|
||||
if ($value > 1){
|
||||
$value -= 1;
|
||||
db_update_variable($mysqli, $tableVar, ['wk_panel_current_subabt_admin', $value]);
|
||||
$_SESSION['ws_Message_json'] = json_encode(['type' => 'UPDATE_RANKLIVE_C_SUBABT', 'payload' => []]);
|
||||
}
|
||||
header("Location: /intern/kampfrichter");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['next_subabt_admin_submit']) && $isAdmin) {
|
||||
verify_csrf();
|
||||
$value = $akt_subabt_admin;
|
||||
$max_value_admin_subabt = count($disciplines);
|
||||
|
||||
if ($value < $max_value_admin_subabt){
|
||||
$value += 1;
|
||||
db_update_variable($mysqli, $tableVar, ['wk_panel_current_subabt_admin', $value]);
|
||||
$_SESSION['ws_Message_json'] = json_encode(['type' => 'UPDATE_RANKLIVE_C_SUBABT', 'payload' => []]);
|
||||
}
|
||||
|
||||
header("Location: /intern/kampfrichter");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (!isset($_SESSION['currentsubabt'])){
|
||||
$_SESSION['currentsubabt'] = 1;
|
||||
@@ -56,7 +69,7 @@ if ($_SESSION['last_abt'] !== $aktabt){
|
||||
$_SESSION['last_abt'] = $aktabt;
|
||||
}
|
||||
|
||||
if ((isset($_POST['prev_subabt'])) && !empty($_POST['prev_subabt_submit'])) {
|
||||
if (isset($_POST['prev_subabt_submit'])) {
|
||||
verify_csrf();
|
||||
$value = $_SESSION['currentsubabt'];
|
||||
if ($value > 1){
|
||||
@@ -68,10 +81,10 @@ if ((isset($_POST['prev_subabt'])) && !empty($_POST['prev_subabt_submit'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ((isset($_POST['next_subabt'])) && !empty($_POST['next_subabt_submit'])) {
|
||||
if (isset($_POST['next_subabt_submit'])) {
|
||||
verify_csrf();
|
||||
$value = $_SESSION['currentsubabt'];
|
||||
if ($value < $maxsubabt){
|
||||
if ($value < $max_subabt){
|
||||
$_SESSION['currentsubabt']++;
|
||||
$_SESSION['currentEditId'] = false;
|
||||
$_SESSION['last_abt'] = $aktabt;
|
||||
@@ -80,12 +93,28 @@ if ((isset($_POST['next_subabt'])) && !empty($_POST['next_subabt_submit'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( isset($_POST['togle_advanced_mode_admin']) && !empty($_POST['togle_advanced_mode_admin_submit']) && !empty($_POST['csrf_token'])) {
|
||||
if (isset($_POST['prog_view_admin_submit'])) {
|
||||
verify_csrf();
|
||||
$current_value = $focus_view_admin;
|
||||
$new_value = !$current_value;
|
||||
|
||||
$_SESSION['abtViewAdmin'] = $new_value;
|
||||
$_SESSION['view_type_admin'] = 'prog';
|
||||
|
||||
header("Location: /intern/kampfrichter");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['abt_view_admin_submit'])) {
|
||||
verify_csrf();
|
||||
|
||||
$_SESSION['view_type_admin'] = 'abt';
|
||||
|
||||
header("Location: /intern/kampfrichter");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['live_view_admin_submit'])) {
|
||||
verify_csrf();
|
||||
|
||||
$_SESSION['view_type_admin'] = 'live';
|
||||
|
||||
header("Location: /intern/kampfrichter");
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user