72 lines
1.9 KiB
PHP
72 lines
1.9 KiB
PHP
<?php
|
|
global $c;
|
|
|
|
UserAuth::require("is_admin");
|
|
|
|
$varUser = UserAuth::getUser();
|
|
$strId = Request::getArg(0);
|
|
|
|
if ($strId == null || strlen($strId) < 1)
|
|
$strId = "none";
|
|
|
|
if (Request::posts("content"))
|
|
Settings::set($strId, Request::getPosted("content"));
|
|
|
|
$strContent = Settings::get($strId, "");
|
|
?>
|
|
|
|
<style>
|
|
textarea {
|
|
font-family: monospace;
|
|
}
|
|
</style>
|
|
|
|
<form method="post">
|
|
<div class="navbar navbar-expand bg-body-tertiary d-flex px-3 sticky-top">
|
|
<div class="container justify-content-between">
|
|
<div class="navbar-nav d-inline-flex align-items-center">
|
|
<span class="navbar-brand">Setting</span>
|
|
|
|
<span class="nav-item text-nowrap me-2">Name</span>
|
|
<input class="form-control me-2" type="text" name="location" value="<?= $strId; ?>" readonly disabled />
|
|
|
|
<a class="btn btn-outline-success text-nowrap" onclick="fnSave();"><i class="fa fa-fw fa-save"></i> Save</a>
|
|
</div>
|
|
|
|
<div class="navbar-nav d-inline-flex">
|
|
<?php BootstrapRender::message(); ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php /**/ ?>
|
|
<div class="container my-5">
|
|
<div class="row">
|
|
<textarea
|
|
class="form-control border-0 shadow-none"
|
|
name="content"
|
|
placeholder="Enter content here..."
|
|
oninput="fnResize(this);"
|
|
autocomplete="off"
|
|
autocorrect="off"
|
|
autocapitalize="off"
|
|
spellcheck="false"><?= $strContent; ?></textarea>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<script>
|
|
$(function() {
|
|
fnSave = function() {
|
|
$("form").first().submit();
|
|
};
|
|
|
|
fnResize = function(x) {
|
|
x.style.height = "auto";
|
|
x.style.height = x.scrollHeight + "px";
|
|
};
|
|
|
|
fnResize($("textarea").first()[0]);
|
|
});
|
|
</script>
|