$dbsname[] = $db['name']; } } unset($i, $db); } $a->action = "admin/System/{$rc['0']}/{$rc['1']}"; /** * @var array $dbsname * @var array $dbs * @var array $database * @var string $name */ $Page->title($rc[2] == 'edit' ? $L->editing_the_database($name) : $L->addition_of_db); $a->content(h::{'p.lead.cs-center'}($rc[2] == 'edit' ? $L->editing_the_database($name) : $L->addition_of_db) . h::{'table.cs-table.cs-center-all tr'}(\cs\modules\System\form_rows_to_cols([array_map(function ($in) { return h::{'th info'}($in); }, [$rc[2] == 'add' ? 'db_mirror' : false, 'db_host', 'db_type', 'db_prefix', 'db_name', 'db_user', 'db_password', 'db_charset']), array_map(function ($in) { return h::td($in); }, [$rc[2] == 'add' ? h::select(['in' => $dbsname, 'value' => $dbs], ['name' => 'db[mirror]', 'selected' => isset($rc[3]) ? $rc[3] : -1, 'size' => 5]) : false, h::input(['name' => 'db[host]', 'value' => $rc[2] == 'edit' ? $database['host'] : $Core->db_host]), h::select(['in' => _mb_substr(get_files_list(ENGINES . '/DB', '/^[^_].*?\\.php$/i', 'f'), 0, -4)], ['name' => 'db[type]', 'selected' => $rc[2] == 'edit' ? $database['type'] : $Core->db_type, 'size' => 5]), h::input(['name' => 'db[prefix]', 'value' => $rc[2] == 'edit' ? $database['prefix'] : $Core->db_prefix]), h::input(['name' => 'db[name]', 'value' => $rc[2] == 'edit' ? $database['name'] : '']), h::input(['name' => 'db[user]', 'value' => $rc[2] == 'edit' ? $database['user'] : '']), h::input(['name' => 'db[password]', 'value' => $rc[2] == 'edit' ? $database['password'] : '']), h::input(['name' => 'db[charset]', 'value' => $rc[2] == 'edit' ? $database['charset'] : $Core->db_charset]) . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2] == 'edit' ? 'edit' : 'add']) . (isset($rc[3]) ? h::{'input[type=hidden]'}(['name' => 'database', 'value' => $rc[3]]) : '') . (isset($rc[4]) ? h::{'input[type=hidden]'}(['name' => 'mirror', 'value' => $rc[4]]) : '')])])) . h::{'p button'}($L->test_connection, ['onMouseDown' => "cs.db_test('{$a->action}/test');"])); break; case 'delete': $a->buttons = false; $content = []; if (!isset($rc[4])) { foreach ($Config->components['modules'] as $module => &$mdata) { if (isset($mdata['db']) && is_array($mdata['db'])) { foreach ($mdata['db'] as $db_name) { if ($db_name == $rc[3]) { $content[] = h::b($module); break; } }
return h::td($in); }, [h::select(array_merge(['html', 'raw_html'], _mb_substr(get_files_list(BLOCKS, '/^block\\..*?\\.php$/i', 'f'), 6, -4)), ['name' => 'block[type]', 'size' => 5, 'onchange' => 'cs.block_switch_textarea(this)']), h::input(['name' => 'block[title]']), h::{'div input[type=radio]'}(['name' => 'block[active]', 'value' => [1, 0], 'in' => [$L->yes, $L->no]]), h::select(_mb_substr(get_files_list(TEMPLATES . '/blocks', '/^block\\..*?\\.(php|html)$/i', 'f'), 6), ['name' => 'block[template]', 'size' => 5]), h::{'input[type=datetime-local]'}(['name' => 'block[start]', 'value' => date('Y-m-d\\TH:i', TIME)]), h::{'input[type=radio]'}(['name' => 'block[expire][state]', 'value' => [0, 1], 'in' => [$L->never, $L->as_specified]]) . h::br(2) . h::{'input[type=datetime-local]'}(['name' => 'block[expire][date]', 'value' => date('Y-m-d\\TH:i', TIME)])])]), [h::{'td[colspan=6] textarea.EDITOR'}('', ['name' => 'block[html]']), ['id' => 'cs-block-content-html']], [h::{'td[colspan=6] textarea'}('', ['name' => 'block[raw_html]']), ['style' => 'display: none;', 'id' => 'cs-block-content-raw-html']]) . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2]])); break; case 'edit': if (!isset($rc[3], $Config->components['blocks'][$rc[3]])) { break; } $form = false; $a->apply_button = false; $a->cancel_button_back = true; $a->form_atributes[] = 'formnovalidate'; $block =& $Config->components['blocks'][$rc[3]]; $Page->title($L->editing_a_block(get_block_title($rc[3]))); $a->content(h::{'p.lead.cs-center'}($L->editing_a_block(get_block_title($rc[3]))) . h::{'table.cs-table-borderless.cs-center-all tr'}(\cs\modules\System\form_rows_to_cols([array_map(function ($in) { return h::{'th info'}($in); }, ['block_title', 'block_active', 'block_template', 'block_start', 'block_expire']), array_map(function ($in) { return h::td($in); }, [h::input(['name' => 'block[title]', 'value' => get_block_title($rc[3])]), h::{'div input[type=radio]'}(['name' => 'block[active]', 'checked' => $block['active'], 'value' => [1, 0], 'in' => [$L->yes, $L->no]]), h::select(['in' => _mb_substr(get_files_list(TEMPLATES . '/blocks', '/^block\\..*?\\.(php|html)$/i', 'f'), 6)], ['name' => 'block[template]', 'selected' => $block['template'], 'size' => 5]), h::{'input[type=datetime-local]'}(['name' => 'block[start]', 'value' => date('Y-m-d\\TH:i', $block['start'] ?: TIME)]), h::{'input[type=radio]'}(['name' => 'block[expire][state]', 'checked' => $block['expire'] != 0, 'value' => [0, 1], 'in' => [$L->never, $L->as_specified]]) . h::br(2) . h::{'input[type=datetime-local]'}(['name' => 'block[expire][date]', 'value' => date('Y-m-d\\TH:i', $block['expire'] ?: TIME)])])]), $block['type'] == 'html' ? h::{'td[colspan=5] textarea.EDITOR'}(get_block_content($rc[3]), ['name' => 'block[html]']) : ($block['type'] == 'raw_html' ? h::{'td[colspan=5] textarea'}(get_block_content($rc[3]), ['name' => 'block[raw_html]']) : '')) . h::{'input[type=hidden]'}([[['name' => 'block[id]', 'value' => $rc[3]]], [['name' => 'mode', 'value' => $rc[2]]]])); break; case 'permissions': if (!isset($rc[3], $Config->components['blocks'][$rc[3]])) { break; } $form = false; $a->apply_button = false; $a->cancel_button_back = true; $permission = Permission::instance()->get(null, 'Block', $Config->components['blocks'][$rc[3]]['index'])[0]['id']; $groups = Group::instance()->get_all(); $groups_content = []; foreach ($groups as $group) { $group_permission = $User->db()->qfs(["SELECT `value`\n\t\t\t\t\tFROM `[prefix]groups_permissions`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`id`\t\t\t= '%s' AND\n\t\t\t\t\t\t`permission`\t= '%s'", $group['id'], $permission]);
$a->apply_button = false; $a->cancel_button_back = true; switch ($rc[2]) { case 'add': case 'edit': if ($rc[2] == 'edit' && isset($rc[3])) { $storage =& $Config->storage[$rc[3]]; } /** * @var array $storage */ $a->action = "admin/System/{$rc['0']}/{$rc['1']}"; $Page->title($rc[2] == 'edit' ? $L->editing_of_storage($Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection']) : $L->adding_of_storage); $a->content(h::{'p.lead.cs-center'}($rc[2] == 'edit' ? $L->editing_of_storage($Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection']) : $L->adding_of_storage) . h::{'table.cs-table-borderless.cs-center-all tr'}(\cs\modules\System\form_rows_to_cols([array_map(function ($in) { return h::{'th info'}($in); }, ['storage_url', 'storage_host', 'storage_connection', 'storage_user', 'storage_pass']), array_map(function ($in) { return h::td($in); }, [h::input(['name' => 'storage[url]', 'value' => $rc[2] == 'edit' ? $storage['url'] : '']), h::input(['name' => 'storage[host]', 'value' => $rc[2] == 'edit' ? $storage['host'] : '']), h::select(['in' => _mb_substr(get_files_list(ENGINES . '/Storage', '/^[^_].*?\\.php$/i', 'f'), 0, -4)], ['name' => 'storage[connection]', 'selected' => $rc[2] == 'edit' ? $storage['connection'] : '', 'size' => 5]), h::input(['name' => 'storage[user]', 'value' => $rc[2] == 'edit' ? $storage['user'] : '']), h::input(['name' => 'storage[password]', 'value' => $rc[2] == 'edit' ? $storage['password'] : '']) . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2] == 'edit' ? 'edit' : 'add']) . (isset($rc[3]) ? h::{'input[type=hidden]'}(['name' => 'storage_id', 'value' => $rc[3]]) : '')])])) . h::button($L->test_connection, ['onMouseDown' => "cs.storage_test('{$a->action}/test');"])); break; case 'delete': $a->buttons = false; $modules = []; foreach ($Config->components['modules'] as $module => &$mdata) { if (isset($mdata['storage']) && is_array($mdata['storage'])) { foreach ($mdata['storage'] as $storage_name) { if ($storage_name == $rc[3]) { $modules[] = h::b($module); break; } } }