$a->apply_button = false; $a->cancel_button_back = true; $permissions = Permission::instance()->get_all(); $group_permissions = $Group->get_permissions($rc[3]); $tabs = []; $tabs_content = ''; $blocks = []; foreach ($Config->components['blocks'] as $block) { $blocks[$block['index']] = $block['title']; } unset($block); foreach ($permissions as $group => $list) { $tabs[] = h::a($group, ['href' => '#permissions_group_' . strtr($group, '/', '_')]); $content = []; foreach ($list as $label => $id) { $content[] = h::th($group == 'Block' ? Text::instance()->process($Config->module('System')->db('texts'), $blocks[$label]) : $label) . h::{'td input[type=radio]'}(['name' => "permission[{$id}]", 'checked' => isset($group_permissions[$id]) ? $group_permissions[$id] : -1, 'value' => [-1, 0, 1], 'in' => [$L->not_specified, $L->deny, $L->allow]]); } if (count($list) % 2) { $content[] = h::{'td[colspan=2]'}(); } $count = count($content); $content_ = []; for ($i = 0; $i < $count; $i += 2) { $content_[] = $content[$i] . $content[$i + 1]; } $tabs_content .= h::{'div#permissions_group_' . strtr($group, '/', '_') . ' table.cs-table-borderless.cs-center-all tr'}(h::{'td.cs-left-all[colspan=4]'}(h::{'button.cs-permissions-invert'}($L->invert) . h::{'button.cs-permissions-deny-all'}($L->deny_all) . h::{'button.cs-permissions-allow-all'}($L->allow_all)), $content_); } unset($content, $content_, $count, $i, $permissions, $group, $list, $label, $id, $blocks); $Page->title($L->permissions_for_group($Group->get($rc[3], 'title'))); $a->content(h::{'p.lead.cs-center'}($L->permissions_for_group($Group->get($rc[3], 'title'))) . h::{'ul.cs-tabs li'}($tabs) . h::div($tabs_content) . h::br() . h::{'input[type=hidden]'}(['name' => 'id', 'value' => $rc[3]])); break;
$a->apply_button = false; $a->cancel_button_back = true; $permissions = Permission::instance()->get_all(); $user_permissions = $User->get_permissions($rc[3]); $tabs = []; $tabs_content = ''; $blocks = []; foreach ($Config->components['blocks'] as $block) { $blocks[$block['index']] = $block['title']; } unset($block); foreach ($permissions as $group => $list) { $tabs[] = h::a($group, ['href' => '#permissions_group_' . strtr($group, '/', '_')]); $content = []; foreach ($list as $label => $id) { $content[] = h::th($group != 'Block' ? $label : Text::instance()->process($Config->module('System')->db('texts'), $blocks[$label])) . h::{'td input[type=radio]'}(['name' => "permission[{$id}]", 'checked' => isset($user_permissions[$id]) ? $user_permissions[$id] : -1, 'value' => [-1, 0, 1], 'in' => [$L->inherited . ' (' . (isset($user_permissions[$id]) && !$user_permissions[$id] ? '-' : '+') . ')', $L->deny, $L->allow]]); } if (count($list) % 2) { $content[] = h::{'td[colspan=2]'}(); } $count = count($content); $content_ = []; for ($i = 0; $i < $count; $i += 2) { $content_[] = $content[$i] . $content[$i + 1]; } $tabs_content .= h::{'div#permissions_group_' . strtr($group, '/', '_') . ' table.cs-table-borderless.cs-center-all'}(h::{'tr td.cs-left-all[colspan=4]'}(h::{'button.cs-permissions-invert'}($L->invert) . h::{'button.cs-permissions-deny-all'}($L->deny_all) . h::{'button.cs-permissions-allow-all'}($L->allow_all)) . h::tr($content_)); } unset($content, $content_, $count, $i, $permissions, $group, $list, $label, $id, $blocks); $Page->title($L->{$is_bot ? 'permissions_for_bot' : 'permissions_for_user'}($User->username($rc[3]))); $a->content(h::{'p.lead.cs-center'}($L->{$is_bot ? 'permissions_for_bot' : 'permissions_for_user'}($User->username($rc[3]))) . h::{'ul.cs-tabs li'}($tabs) . h::div($tabs_content) . h::br() . h::{'input[type=hidden]'}(['name' => 'id', 'value' => $rc[3]])); break;
function get_block_content($id) { $Config = Config::instance(); return Text::instance()->process($Config->module('System')->db('texts'), $Config->components['blocks'][$id]['content']); }
break; } $a->content(h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2]])); } else { $a->buttons = false; $permissions = $Permission->get_all(); $permissions_list = [h::th([$L->action, 'id', $L->group, $L->label]), h::th([$L->action, 'id', $L->group, $L->label])]; $count = 0; $blocks = []; foreach ($Config->components['blocks'] as $block) { $blocks[$block['index']] = $block['title']; } unset($block); foreach ($permissions as $group => $list) { foreach ($list as $label => $id) { ++$count; $permissions_list[] = h::{'td.cs-left-all'}([h::{'a.cs-button-compact'}(h::icon('pencil'), ['href' => "{$a->action}/edit/{$id}", 'data-title' => $L->edit]) . h::{'a.cs-button-compact'}(h::icon('trash-o'), ['href' => "{$a->action}/delete/{$id}", 'data-title' => $L->delete]), $id, h::span($group), h::span($label, ['data-title' => $group == 'Block' ? Text::instance()->process($Config->module('System')->db('texts'), $blocks[$label]) : false])]); } } if ($count % 2) { $permissions_list[] = h::{'td[colspan=4]'}(); } unset($permissions, $group, $list, $label, $id, $blocks); $count = count($permissions_list); $permissions_list_ = ''; for ($i = 0; $i < $count; $i += 2) { $permissions_list_ .= h::tr($permissions_list[$i] . $permissions_list[$i + 1]); } unset($permissions_list); $a->content(h::{'table.cs-table.cs-center-all'}($permissions_list_) . h::{'p.cs-left a.cs-button'}($L->add_permission, ['href' => "admin/System/{$rc['0']}/{$rc['1']}/add"])); }
/** * Blocks processing */ protected function blocks_processing() { $Config = Config::instance(); $Page = Page::instance(); $Text = Text::instance(); $blocks_array = ['top' => '', 'left' => '', 'right' => '', 'bottom' => '']; foreach ($Config->components['blocks'] as $block) { if (!$block['active'] || $block['expire'] != 0 && $block['expire'] < TIME || $block['start'] > TIME || !User::instance()->get_permission('Block', $block['index'])) { continue; } $block['title'] = $Text->process($Config->module('System')->db('texts'), $block['title'], true, true); if (Trigger::instance()->run('System/Index/block_render', ['block' => $block['index'], 'blocks_array' => &$blocks_array])) { switch ($block['type']) { default: $content = ob_wrapper(function () use($block) { include BLOCKS . "/block.{$block['type']}.php"; }); break; case 'html': case 'raw_html': $content = $Text->process($Config->module('System')->db('texts'), $block['content'], true, true); break; } $template = TEMPLATES . '/blocks/block.' . (file_exists(TEMPLATES . "/blocks/block.{$block['template']}") ? $block['template'] : 'default.html'); $content = str_replace(['<!--id-->', '<!--title-->', '<!--content-->'], [$block['index'], $block['title'], $content], ob_wrapper(function () use($template) { _include($template); })); if ($block['position'] == 'floating') { $Page->replace("<!--block#{$block['index']}-->", $content); } else { $blocks_array[$block['position']] .= $content; } } } $Page->Top .= $blocks_array['top']; $Page->Left .= $blocks_array['left']; $Page->Right .= $blocks_array['right']; $Page->Bottom .= $blocks_array['bottom']; }
private function ml_del($group, $label) { return Text::instance()->del($this->cdb(), $group, $label); }
/** * Get multilingual value from $Config->core array * * @param string $item * * @return bool|string */ function get_core_ml_text($item) { $Config = Config::instance(true); if (!$Config) { return false; } return Text::instance()->process($Config->module('System')->db('texts'), $Config->core[$item], true, true); }
function set_core_ml_text($item, $text) { return Text::instance()->set(Config::instance()->module('System')->db('texts'), 'System/Config/core', $item, $text); }