8 isset(
$user) or require
$_SERVER[
'DOCUMENT_ROOT'] .
'/page/404.php';
10 if (!($row = Wrong\Models\Crontabs::find($_GET[
'id']))) {
11 exit(
'<script>errorToast("Ошибка!");</script>');
17 <div
class=
"modal fade" id=
"<?= $basename ?>" tabindex=
"-1" data-backdrop=
"static" data-keyboard=
"false">
18 <div
class=
"modal-dialog modal-xl modal-dialog-centered" role=
"document">
19 <div
class=
"modal-content">
20 <div
class=
"modal-header">
21 <h5
class=
"modal-title">Настройка потоков и нагрузки</h5>
22 <button type=
"button" class=
"close" data-dismiss=
"modal" aria-label=
"Close">
23 <span aria-hidden=
"true">×</span>
26 <div
class=
"modal-body pt-2">
27 <form action=
"<?= Wrong\Models\Actions::find(47)->request ?>">
28 <input type=
"hidden" name=
"id" value=
"<?= $row->id ?>">
29 <div
class=
"input-group input-group-sm">
30 <div
class=
"input-group-prepend w-25">
31 <span
class=
"input-group-text w-100">Минимум <b></b> потоков</span>
33 <div
class=
"flex-fill bg-light-info border d-flex align-items-center px-2 rounded-right">
34 <input type=
"range" name=
"min" class=
"form-control-range" value=
"<?= $threads['min'] ?>" min=
"1" max=
"1000" required>
37 <div
class=
"input-group input-group-sm mt-2">
38 <div
class=
"input-group-prepend w-25">
39 <span
class=
"input-group-text w-100">Максимум <b></b> потоков</span>
41 <div
class=
"flex-fill bg-light-info border d-flex align-items-center px-2 rounded-right">
42 <input type=
"range" name=
"max" class=
"form-control-range" value=
"<?= $threads['max'] ?>" min=
"1" max=
"1000" required>
45 <div
class=
"input-group input-group-sm mt-2">
46 <div
class=
"input-group-prepend w-25">
47 <span
class=
"input-group-text w-100">Предельная нагрузка сервера <b></b>%</span>
49 <div
class=
"flex-fill bg-light-info border d-flex align-items-center px-2 rounded-right">
50 <input type=
"range" name=
"load" class=
"form-control-range" value=
"<?= $threads['load'] ?>" min=
"1" max=
"1000" required>
53 <div
class=
"bg-light-info border mt-2 px-2 py-1 rounded">
54 <div
class=
"custom-control custom-checkbox small">
55 <input type=
"checkbox" name=
"fixed" class=
"custom-control-input" id=
"fixed-threads" <?=
$threads[
'fixed'] ?
'checked' :
'' ?>>
56 <label
class=
"custom-control-label" for=
"fixed-threads">Держать <span
id=
"fixed-min"></span> постоянно</label>
59 <button type=
"submit" class=
"btn btn-sm btn-block btn-success mt-3">Сохранить</button>
65 $(
"#<?= $basename ?> form").submit(
function(e) {
66 lockSubmit($(
"#<?= $basename ?> form [type=submit]"));
70 url: $(
this).attr(
"action"),
71 data: $(
this).serialize(),
80 errorToast(response.error);
83 $(
'.dataTable').DataTable().ajax.reload(
null,
false);
84 $(
'.toast').toast(
'hide');
85 successToast(response.message);
86 $(
"#<?= $basename ?>").modal(
"hide");
89 unlockSubmit($(
"#<?= $basename ?> form [type=submit]"));
93 $(
"#<?= $basename ?> [type=range]").on(
'input',
function() {
94 if ($(
this).attr(
"name") ==
"min" && +this.value > +$(
"#<?= $basename ?> [name=max]").val()) {
95 $(
"#<?= $basename ?> [name=max]").val(this.value).trigger(
'input');
97 if ($(
this).attr(
"name") ==
"max" && +this.value < +$(
"#<?= $basename ?> [name=min]").val()) {
98 $(
"#<?= $basename ?> [name=min]").val(this.value).trigger(
'input');
100 $(
"#fixed-min").html(
"<b>" + $(
"#<?= $basename ?> [name=min]").val() +
"</b> поток" + (
function(n) {
103 let arr = [
"",
"а",
"ов"];
104 return (s == 1 && n != 11) ? arr[0] : (s < 5 && s > 1 && n != 12 && n != 13 && n != 14 ? arr[1] : arr[2]);
105 })($(
"#<?= $basename ?> [name=min]").val()));
106 $(
this).parent().prev().find(
'b').html(
' ' + this.value +
' ');
if(!($row=Wrong\Models\Crontabs::find($_POST['id']))) if(! $user->access() ->write($row)) if($_POST['min']< 1|| $_POST['min'] > 100000|| $_POST['max']< 1|| $_POST['max'] > 100000|| $_POST['load']< 1|| $_POST['load'] > 1000) $threads
const DEFAULT_THERADS_SET
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' $_SERVER['HTTP_HOST']
if(($dbh=Connect::getInstance(true) ->dbh) && $dbh->query("SHOW TABLES") ->fetchAll() && $dbh->query("SELECT COUNT(*) FROM `users`") ->fetchColumn()) if(!empty($_POST)) exit