<?php
declare(strict_types=1);

/**
ET-Chat Copyright by SEDesign | ET-Chat v3.x.x Lizenz: CCPL | Autor: Evgeni Tcherkasski (info@s-e-d.de)
ET-Chat_T-FISH-MOD Weiterentwicklungen, Optimierungen und Ergänzungen am Code sind das geistige Eigentum von Tommy (Thomas Kuhn) und Harlekin (Bernd Witte).

Die darauf folgende Optimierungen und Ergänzungen am Code sind das Geistige Eigentum von Powermen (Christian K.)
und wird unter der Namenserweiterung M.C.v.x.x.x. geführt. 
PHP 8/9 Ready, XML Parser, PDO Prepared Statements Get Set sicherheit usw.
 */
ob_start();

function e($v) {
    return htmlspecialchars((string)$v, ENT_QUOTES, 'UTF-8');
}

$prefix = 'etchat_' . $this->_prefix;
?>

<form action="./?AdminUpdateConfigTab" method="post" class="admin-form-box">

<input type="hidden" name="csrf_token" value="<?=e($csrfToken)?>">

<div class="kachel-grid">
<!-- ===================================================== -->
<div class="section">
<h3>Allgemein</h3>

Wartung:
<select name="wartung">
<option value="1" <?=($_SESSION[$prefix.'wartung']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'wartung']==0?'selected':'')?>>Aus</option>
</select>

Gastzugang:
<select name="gast_zugang">
<option value="1" <?=($_SESSION[$prefix.'gast_zugang']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'gast_zugang']==0?'selected':'')?>>Aus</option>
</select>

Registrierung:
<select name="reg_an_aus">
<option value="1" <?=($_SESSION[$prefix.'reg_an_aus']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'reg_an_aus']==0?'selected':'')?>>Aus</option>
</select>

</div>


<!-- ===================================================== -->
<div class="section">
<h3>System</h3>

Tab Away in Sek.:
<input type="number" min="150" max="3600" step="1" name="tab_away_delay" value="<?=e($_SESSION[$prefix.'tab_away_delay'])?>">
<sup><small>(Zwischen 150 (2,5min.) bis 1200 (20min.) ist sinnvoll)</sup></small>

</div>



<!-- ===================================================== -->
<div class="section">
<h3>Privilegien Farben</h3>

<?php
function colorRow($label,$name,$value,$letter, $tooltip = ''){
?>
<div class="color-wrapper">
<span class="kreis-buchstabe" style="background: <?=e($value)?>"><?=$letter?></span>
<?=$label?>
<?php if($tooltip): ?>
<span class="info-tooltip" title="<?=e($tooltip)?>">ⓘ:</span>
<?php endif; ?>
<input class="color-input" name="<?=$name?>" value="<?=e($value)?>">
<input class="real-color-input" type="color" value="<?=e($value)?>">
<div class="color-preview" style="background: <?=e($value)?>"></div>
</div>
<?php
}

colorRow('Orgateam ', 'c_admin', $_SESSION[$prefix.'admin_color'], 'A', $lang->admin[0]->tagData);
colorRow($lang->mod[0]->tagData,'c_mod',$_SESSION[$prefix.'mod_color'],'M');
colorRow($lang->user[0]->tagData,'c_user',$_SESSION[$prefix.'user_color'],'U');
colorRow($lang->gast[0]->tagData,'c_gast',$_SESSION[$prefix.'gast_color'],'G');
?>

</div>


<!-- ===================================================== -->
<div class="section">
<h3>Chat Optionen</h3>

<h4>Im Chat</h4>

Smileys pro. Messages:
<input type="number" min="4" max="100" step="1"  name="chat_anzsmily" value="<?=e($_SESSION[$prefix.'chat_anzsmily'])?>">

</div>


<!-- ===================================================== -->
<div class="section">
<h3>Chat Features (Button)</h3>

Bild:
<select name="bi">
<option value="1" <?=($_SESSION[$prefix.'bi']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'bi']==0?'selected':'')?>>Aus</option>
</select>

Youtube:
<select name="yo">
<option value="1" <?=($_SESSION[$prefix.'yo']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'yo']==0?'selected':'')?>>Aus</option>
</select>

Vollbild:
<select name="vb">
<option value="1" <?=($_SESSION[$prefix.'vollbild']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'vollbild']==0?'selected':'')?>>Aus</option>
</select>

Bild Upload & Gallery:
<select name="biup">
<option value="1" <?=($_SESSION[$prefix.'biup']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'biup']==0?'selected':'')?>>Aus</option>
</select>

</div>

<div class="section">
<h3>Usereinstellungen Anzeige</h3>
Profil:
<select name="pro">
<option value="1" <?=($_SESSION[$prefix.'pro']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'pro']==0?'selected':'')?>>Aus</option>
</select>

Avatar:
<select name="av">
<option value="1" <?=($_SESSION[$prefix.'av']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'av']==0?'selected':'')?>>Aus</option>
</select>

Avataranzeige im Chat:
<select name="pic_chat">
<option value="1" <?=($_SESSION[$prefix.'chat_pic']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'chat_pic']==0?'selected':'')?>>Aus</option>
</select>

Avataranzeige im Profil:
<select name="pic_ben_info">
<option value="1" <?=($_SESSION[$prefix.'be_info_pic']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'be_info_pic']==0?'selected':'')?>>Aus</option>
</select>

</div>

<!-- ===================================================== -->
<div class="section">
<h3>Würfel</h3>

Würfel:
<select name="wu">
<option value="1" <?=($_SESSION[$prefix.'wu']==1?'selected':'')?>>An</option>
<option value="0" <?=($_SESSION[$prefix.'wu']==0?'selected':'')?>>Aus</option>
</select>

Augenanzahl:
<input type="number" name="wuan" min="6" max="999" step="1" value="<?=e($_SESSION[$prefix.'wuan'])?>">

Würfeln max.:
<input type="number" name="wuza" min="1" max="25" step="1" value="<?=e($_SESSION[$prefix.'wuza'])?>">

Pause in Min.:
<input type="number" name="wupau" min="1" max="30" step="1" value="<?=e($_SESSION[$prefix.'wupau'])?>">
</div>

</div>

<input type="submit" value="Speichern">

</form>

<script>
document.querySelectorAll('.color-wrapper').forEach(w=>{
let t=w.querySelector('.color-input');
let c=w.querySelector('.real-color-input');
let p=w.querySelector('.color-preview');

t.onclick=()=>c.click();

c.oninput=()=>{
t.value=c.value;
p.style.background=c.value;
};

t.oninput=()=>{
if(/^#[0-9a-f]{6}$/i.test(t.value)){
c.value=t.value;
p.style.background=t.value;
}
};
});
</script>

<?php
$content = ob_get_clean();

$pageTitle = 'Allgemeine Einstellungen';
$backLink  = './?AdminIndex';
$footerNote = $lang->note[0]->tagData ?? '';

include "admin_master_template.php";
?>