8 isset(
$user) or require
$_SERVER[
'DOCUMENT_ROOT'] .
'/page/404.php';
10 header(
"Content-type: application/json");
14 $columns = [
'id',
'threads',
'cli',
'request',
'user_id',
'shedule',
'method',
'headers',
'data',
'owner_group',
'run_at',
'note',
'act'];
17 $order_dir = isset($_GET[
'order'][0][
'dir']) && $_GET[
'order'][0][
'dir'] ==
'asc' ?
'ASC' :
'DESC';
18 $start = abs(intval($_GET[
'start']));
21 $query =
"SELECT " . implode(
', ',
$columns) .
" FROM `$table_name` ORDER BY `$order_column` $order_dir";
27 foreach (
$arr as $key => $item) {
29 $threads[
'curr'] = intval(shell_exec(
"ps aux | grep 'php -f " . dirname(__DIR__, 3) .
"/cron\.php " . $item[0] .
"' | wc -l"));
30 $text =
"{$threads['curr']} / {$threads['min']} / {$threads['max']} / {$threads['load']}% / " . (
$threads[
'fixed'] ?
'+' :
'-');
31 $title =
'<div class=\'text-left small\'>Потоков в работе: <b>' .
$threads[
'curr'] .
'</b><br>Минимум потоков: <b>' .
$threads[
'min'] .
'</b><br>Максимум потоков: <b>' .
$threads[
'max'] .
'</b><br>Предел нагрузки: <b>' .
$threads[
'load'] .
'%</b><br>Держать потоки: <b>' . (
$threads[
'fixed'] ?
'да' :
'нет') .
'</b></div>';
32 $arr[$key][1] =
'<div title="' . $title .
'" class="edit-wrapper editable-act" data-toggle="modal" data-target="#edit-threads" data-id="' . $item[0] .
'">' . $text .
'<i class="fa fa-edit"></i></div>';
33 $arr[$key][2] = htmlspecialchars($item[2], ENT_QUOTES);
34 $arr[$key][2] =
'<div title="' . $item[2] .
'" class="edit-wrapper editable-act" data-id="' . $item[0] .
'" data-target="#edit-cli" data-toggle="modal" data-table="' .
$table_name .
'">' . $item[2] .
'<i class="fa fa-edit"></i></div>';
42 if (!empty($_GET[
'search'][
'value'])) {
43 $searchable_columns = [];
45 foreach ($_GET[
'columns'] as $key => $item) {
46 if ($item[
'searchable']) {
47 $searchable_columns[] = $key;
51 if ($searchable_columns) {
52 foreach (
$arr as $key => $item) {
53 $arr_search = array_intersect_key($item, $searchable_columns);
54 foreach ($arr_search as $word) {
55 if (mb_stripos(strip_tags($word), $_GET[
'search'][
'value']) !==
false) {
72 $response[
'uptime'] = shell_exec(
'uptime');
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
static formatter($arr, $columns, $table)
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
if(!empty($_GET['search']['value'])) $response
catch(\Throwable $th) $request