Esempio n. 1
0
                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->content(h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2]]));
} else {
    $a->buttons = false;
    $groups_ids = $Group->get_all();
    $groups_list = [];
    foreach ($groups_ids as $id) {
        $id = $id['id'];
        $group_data = $Group->get($id);
        $groups_list[] = [h::{'a.cs-button-compact'}(h::icon('pencil'), ['href' => "{$a->action}/edit/{$id}", 'data-title' => $L->edit_group_information]) . ($id != User::ADMIN_GROUP_ID && $id != User::USER_GROUP_ID && $id != User::BOT_GROUP_ID ? h::{'a.cs-button-compact'}(h::icon('trash-o'), ['href' => "{$a->action}/delete/{$id}", 'data-title' => $L->delete]) : '') . h::{'a.cs-button-compact'}(h::icon('key'), ['href' => "{$a->action}/permissions/{$id}", 'data-title' => $L->edit_group_permissions]), $id, $group_data['title'], $group_data['description']];
    }
    unset($id, $group_data, $groups_ids);
    $a->content(h::{'table.cs-table.cs-center-all'}(h::{'thead tr th'}($L->action, 'id', $L->group_name, $L->description) . h::{'tbody tr| td'}($groups_list)) . h::{'p.cs-left a.cs-button'}($L->add_group, ['href' => "admin/System/{$rc['0']}/{$rc['1']}/add"]));
}
Esempio n. 2
0
     $uniqid = uniqid('module_info_');
     $Page->replace($uniqid, $tag == 'pre' ? prepare_attr_value(file_get_contents($file)) : file_get_contents($file));
     $addition_state .= h::{'div.uk-modal.cs-left'}(h::{"{$tag}.uk-modal-dialog-large"}($uniqid), ['id' => "{$module_name}_readme", 'title' => "{$module_name} » {$L->information_about_module}"]) . h::{'icon.cs-pointer'}('exclamation', ['data-title' => $L->information_about_module . h::br() . $L->click_to_view_details, 'onClick' => "\$('#{$module_name}_readme').cs().modal('show');"]);
     unset($uniqid);
 }
 unset($tag, $file);
 /**
  * License
  */
 if (file_exists($file = MODULES . "/{$module_name}/license.txt") || file_exists($file = MODULES . "/{$module_name}/license.html")) {
     if (substr($file, -3) == 'txt') {
         $tag = 'pre';
     } else {
         $tag = 'div';
     }
     $addition_state .= h::{'div.uk-modal.cs-left'}(h::{"{$tag}.uk-modal-dialog-large"}(file_get_contents($file)), ['id' => "{$module_name}_license", 'title' => "{$module_name} » {$L->license}"]) . h::{'icon.cs-pointer'}('legal', ['data-title' => $L->license . h::br() . $L->click_to_view_details, 'onClick' => "\$('#{$module_name}_license').cs().modal('show');"]);
 }
 unset($tag, $file);
 /**
  * Setting default module
  */
 if ($module_data['active'] == 1 && $module_name != $Config->core['default_module'] && (file_exists(MODULES . "/{$module_name}/index.php") || file_exists(MODULES . "/{$module_name}/index.html") || file_exists(MODULES . "/{$module_name}/index.json"))) {
     $action .= h::{'a.cs-button-compact'}(h::icon('home'), ['href' => "{$a->action}/default_module/{$module_name}", 'data-title' => $L->make_default_module]);
 }
 /**
  * DataBases settings
  */
 if (!$Config->core['simple_admin_mode'] && file_exists(MODULES . "/{$module_name}/meta/db.json") && count($Config->db) > 1) {
     $action .= h::{'a.cs-button-compact'}(h::icon('gears'), ['href' => "{$a->action}/db/{$module_name}", 'data-title' => $L->databases]);
 }
 /**
Esempio n. 3
0
     $content_ = [];
     for ($i = 0; $i < $count; $i += 2) {
         $content_[] = $groups_content[$i] . $groups_content[$i + 1];
     }
     $groups_content = $content_;
     unset($count, $content_);
     $users_list = $User->db()->qfa(["SELECT\n\t\t\t\t\t`id`,\n\t\t\t\t\t`value`\n\t\t\t\tFROM `[prefix]users_permissions`\n\t\t\t\tWHERE `permission` = '%s'", $permission]);
     $users_content = [];
     foreach ($users_list as &$user) {
         $value = $user['value'];
         $user = $user['id'];
         $users_content[] = h::th($User->username($user)) . h::{'td input[type=radio]'}(['name' => 'users[' . $user . ']', 'checked' => $value, 'value' => [-1, 0, 1], 'in' => [$L->inherited, $L->deny, $L->allow]]);
     }
     unset($user, $value);
     $Page->title($L->permissions_for_block(get_block_title($rc[3])));
     $a->content(h::{'p.lead.cs-center'}($L->permissions_for_block(get_block_title($rc[3]))) . h::{'ul.cs-tabs li'}($L->groups, $L->users) . h::div(h::{'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-allow-all'}($L->allow_all) . h::{'button.cs-permissions-deny-all'}($L->deny_all)), $groups_content) . h::{'table.cs-table-borderless.cs-center-all tr'}([h::{'td.cs-left-all'}(h::{'button.cs-permissions-invert'}($L->invert) . h::{'button.cs-permissions-allow-all'}($L->allow_all) . h::{'button.cs-permissions-deny-all'}($L->deny_all)), h::{'td table#cs-block-users-changed-permissions.cs-table-borderless.cs-center-all tr'}($users_content), h::{'td input#block_users_search[type=search]'}(['autocomplete' => 'off', 'permission' => $permission, 'placeholder' => $L->type_username_or_email_press_enter, 'style' => 'width: 100%']), h::{'td#block_users_search_results'}()])) . h::{'input#cs-block-users-search-found[type=hidden]'}(['value' => implode(',', $users_list)]) . h::br() . h::{'input[type=hidden]'}([[['name' => 'block[id]', 'value' => $rc[3]]], [['name' => 'mode', 'value' => $rc[2]]]]));
     break;
 case 'search_users':
     $form = false;
     $a->generate_auto = false;
     interface_off();
     $users_list = $User->search_users($_POST['search_phrase']);
     $found_users = explode(',', $_POST['found_users']);
     $permission = (int) $_POST['permission'];
     $content = [];
     foreach ($users_list as $user) {
         if (in_array($user, $found_users)) {
             continue;
         }
         $found_users[] = $user;
         $value = $User->db()->qfs(["SELECT `value`\n\t\t\t\t\tFROM `[prefix]users_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'", $user, $permission]);
Esempio n. 4
0
            $uniqid = uniqid('module_info_');
            $Page->replace($uniqid, $tag == 'pre' ? prepare_attr_value(file_get_contents($file)) : file_get_contents($file));
            $addition_state .= h::{'div.uk-modal.cs-left'}(h::{"{$tag}.uk-modal-dialog-large"}($uniqid), ['id' => "{$plugin}_readme", 'title' => "{$plugin} -> {$L->information_about_plugin}"]) . h::{'icon.cs-pointer'}('exclamation', ['data-title' => $L->information_about_plugin . h::br() . $L->click_to_view_details, 'onClick' => "\$('#{$plugin}_readme').cs().modal('show');"]);
            unset($uniqid);
        }
        unset($tag, $file);
        /**
         * License
         */
        if (file_exists($file = PLUGINS . "/{$plugin}/license.txt") || file_exists($file = PLUGINS . "/{$plugin}/license.html")) {
            if (substr($file, -3) == 'txt') {
                $tag = 'pre';
            } else {
                $tag = 'div';
            }
            $addition_state .= h::{'div.uk-modal.cs-left'}(h::{"{$tag}.uk-modal-dialog-large"}($tag == 'pre' ? prepare_attr_value(file_get_contents($file)) : file_get_contents($file)), ['id' => "{$plugin}_license", 'title' => "{$plugin} -> {$L->license}"]) . h::{'icon.cs-pointer'}('legal', ['data-title' => $L->license . h::br() . $L->click_to_view_details, 'onClick' => "\$('#{$plugin}_license').cs().modal('show');"]);
        }
        unset($tag, $file);
        $state = in_array($plugin, $Config->components['plugins']);
        $action .= h::{'a.cs-button-compact'}(h::icon($state ? 'minus' : 'check'), ['href' => $a->action . ($state ? '/disable/' : '/enable/') . $plugin, 'data-title' => $state ? $L->disable : $L->enable]);
        $plugin_info = false;
        if (file_exists(PLUGINS . "/{$plugin}/meta.json")) {
            $plugin_meta = file_get_json(PLUGINS . "/{$plugin}/meta.json");
            $plugin_info = $L->plugin_info($plugin_meta['package'], $plugin_meta['version'], $plugin_meta['description'], $plugin_meta['author'], isset($plugin_meta['website']) ? $plugin_meta['website'] : $L->none, $plugin_meta['license'], isset($plugin_meta['provide']) ? implode(', ', (array) $plugin_meta['provide']) : $L->none, isset($plugin_meta['require']) ? implode(', ', (array) $plugin_meta['require']) : $L->none, isset($plugin_meta['conflict']) ? implode(', ', (array) $plugin_meta['conflict']) : $L->none, isset($plugin_meta['optional']) ? implode(', ', (array) $plugin_meta['optional']) : $L->none, isset($plugin_meta['multilingual']) && in_array('interface', $plugin_meta['multilingual']) ? $L->yes : $L->no, isset($plugin_meta['multilingual']) && in_array('content', $plugin_meta['multilingual']) ? $L->yes : $L->no, isset($plugin_meta['languages']) ? implode(', ', $plugin_meta['languages']) : $L->none);
        }
        unset($plugin_meta);
        $plugins_list[] = [h::span($L->{$plugin}, ['data-title' => $plugin_info]), h::icon($state ? 'check' : 'minus', ['data-title' => $state ? $L->enabled : $L->disabled]) . $addition_state, $action];
        unset($plugin_info);
    }
    unset($plugin, $state, $addition_state, $action);
}
Esempio n. 5
0
 /**
  * Substitutes header information about user, sign in/sign up forms, etc.
  *
  * @return Page
  */
 protected function get_header_info()
 {
     $L = Language::instance();
     $User = User::instance(true);
     $this->user_avatar_image = $User->avatar();
     if ($User->user()) {
         $this->header_info = h::{'div.cs-header-user-block'}(h::b("{$L->hello}, " . $User->username() . '! ' . h::{'icon.cs-header-sign-out-process'}('sign-out', ['style' => 'cursor: pointer;', 'data-title' => $L->sign_out])) . h::div(h::a($L->profile, ['href' => path($L->profile) . "/{$User->login}"]) . ' | ' . h::a($L->settings, ['href' => path($L->profile) . '/' . path($L->settings)])) . $this->header_info);
         Trigger::instance()->run('System/Page/get_header_info');
     } else {
         $external_systems_list = '';
         Trigger::instance()->run('System/Page/external_sign_in_list', ['list' => &$external_systems_list]);
         $this->header_info = h::{'div.cs-header-guest-form'}(h::b("{$L->hello}, {$L->guest}!") . h::div(h::{'button.cs-header-sign-in-slide.cs-button-compact.uk-icon-sign-in'}($L->sign_in) . h::{'button.cs-header-registration-slide.cs-button-compact.uk-icon-pencil'}($L->sign_up, ['data-title' => $L->quick_registration_form]))) . h::{'div.cs-header-restore-password-form'}(h::{'input.cs-no-ui.cs-header-restore-password-email[tabindex=1]'}(['placeholder' => $L->login_or_email, 'autocapitalize' => 'off', 'autocorrect' => 'off']) . h::br() . h::{'button.cs-header-restore-password-process.cs-button-compact.uk-icon-question[tabindex=2]'}($L->restore_password) . h::{'button.cs-button-compact.cs-header-back[tabindex=3]'}(h::icon('chevron-down'), ['data-title' => $L->back]), ['style' => 'display: none;']) . h::{'div.cs-header-registration-form'}(h::{'input.cs-no-ui.cs-header-registration-email[type=email][tabindex=1]'}(['placeholder' => $L->email, 'autocapitalize' => 'off', 'autocorrect' => 'off']) . h::br() . h::{'button.cs-header-registration-process.cs-button-compact.uk-icon-pencil[tabindex=2]'}($L->sign_up) . h::{'button.cs-button-compact.cs-header-back[tabindex=4]'}(h::icon('chevron-down'), ['data-title' => $L->back]), ['style' => 'display: none;']) . h::{'form.cs-header-sign-in-form.cs-no-ui'}(h::{'input.cs-no-ui.cs-header-sign-in-email[tabindex=1]'}(['placeholder' => $L->login_or_email, 'autocapitalize' => 'off', 'autocorrect' => 'off']) . h::{'input.cs-no-ui.cs-header-user-password[type=password][tabindex=2]'}(['placeholder' => $L->password]) . h::br() . h::{'button.cs-button-compact.uk-icon-sign-in[tabindex=3][type=submit]'}($L->sign_in) . h::{'button.cs-button-compact.cs-header-back[tabindex=5]'}(h::icon('chevron-down'), ['data-title' => $L->back]) . h::{'button.cs-button-compact.cs-header-restore-password-slide[tabindex=4]'}(h::icon('question'), ['data-title' => $L->restore_password]), ['style' => 'display: none;']) . $external_systems_list;
     }
     return $this;
 }
Esempio n. 6
0
     $user_data = $User->get($columns, $id);
     if ($is_root && isset($user_data['password_hash'])) {
         $user_data['password_hash'] = '*****';
     }
     if (isset($user_data['reg_ip'])) {
         $user_data['reg_ip'] = hex2ip($user_data['reg_ip'], 10);
         if ($user_data['reg_ip'][1]) {
             $user_data['reg_ip'] = $user_data['reg_ip'][0] . h::br() . $user_data['reg_ip'][1];
         } else {
             $user_data['reg_ip'] = $user_data['reg_ip'][0];
         }
     }
     if (isset($user_data['last_ip'])) {
         $user_data['last_ip'] = hex2ip($user_data['last_ip'], 10);
         if ($user_data['last_ip'][1]) {
             $user_data['last_ip'] = $user_data['last_ip'][0] . h::br() . $user_data['last_ip'][1];
         } else {
             $user_data['last_ip'] = $user_data['last_ip'][0];
         }
     }
     if (in_array(User::ADMIN_GROUP_ID, $groups)) {
         $type = h::info('a');
     } elseif (in_array(User::USER_GROUP_ID, $groups)) {
         $type = h::info('u');
     } elseif ($is_bot) {
         $type = h::info('b');
     } else {
         $type = h::info('g');
     }
     $users_list[] = array_values([$buttons, $type] + $user_data);
 }
Esempio n. 7
0
<?php

/**
 * @package		CleverStyle CMS
 * @subpackage	System module
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs;

use h;
$Config = Config::instance();
$L = Language::instance();
Index::instance()->content(h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr'}([h::td([h::info('key_expire'), h::{'input[type=number]'}(['name' => 'core[key_expire]', 'value' => $Config->core['key_expire'], 'min' => 1]) . $L->seconds]), h::td([h::info('ip_black_list'), h::textarea($Config->core['ip_black_list'], ['name' => 'core[ip_black_list]'])]), h::td([h::info('ip_admin_list_only'), h::{'input[type=radio]'}(['name' => 'core[ip_admin_list_only]', 'checked' => $Config->core['ip_admin_list_only'], 'value' => [0, 1], 'in' => [$L->off, $L->on]])]), h::td([h::info('ip_admin_list'), h::textarea($Config->core['ip_admin_list'], ['name' => 'core[ip_admin_list]']) . h::br() . $L->current_ip . ': ' . h::b(User::instance()->ip)])]));