コード例 #1
0
ファイル: blocks.php プロジェクト: hypnomez/opir.org
            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]);
                $content[] = h::th($User->username($user)) . h::{'td input[type=radio]'}(['name' => 'users[' . $user . ']', 'checked' => $value !== false ? $value : -1, 'value' => [-1, 0, 1], 'in' => [$L->inherited . ' (' . ($value !== false && !$value ? '-' : '+') . ')', $L->deny, $L->allow]]);
            }
            $Page->content(h::{'table.cs-table-borderless.cs-center-all tr'}($content));
            break;
    }
}
if ($form) {
    $a->reset_button = false;
    $a->post_buttons .= h::{'button.cs-reload-button'}($L->reset);
    $blocks_array = ['top' => '', 'left' => '', 'floating' => '', 'right' => '', 'bottom' => ''];
    if (!empty($Config->components['blocks'])) {
        foreach ($Config->components['blocks'] as $id => $block) {
            $blocks_array[$block['position']] .= h::li(h::{'div.cs-blocks-items-title'}("#{$block['index']} " . get_block_title($id)) . h::a([h::{'div icon'}('pencil'), ['href' => "{$a->action}/edit/{$id}", 'data-title' => $L->edit]], [h::{'div icon'}('key'), ['href' => "{$a->action}/permissions/{$id}", 'data-title' => $L->edit_permissions]], [h::{'div icon'}($block['active'] ? 'minus' : 'check'), ['href' => "{$a->action}/" . ($block['active'] ? 'disable' : 'enable') . "/{$id}", 'data-title' => $L->{$block['active'] ? 'disable' : 'enable'}]], [h::{'div icon'}('trash-o'), ['href' => "{$a->action}/delete/{$id}", 'data-title' => $L->delete]]), ['id' => "block{$id}", 'class' => $block['active'] ? 'uk-button-success' : 'uk-button-default']);
            unset($block_data);
        }
        unset($id, $block);
コード例 #2
0
ファイル: groups.php プロジェクト: hypnomez/opir.org
 $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;
コード例 #3
0
ファイル: example.php プロジェクト: AndruxaSazonov/htmlgen
    });
    h::body(function () {
        h::div(array("id" => "wrapper"), function () {
            h::h1("Hello, World", array("class" => "title"));
            h::comment("navigation");
            h::ul(array("class" => "links"), function () {
                foreach (array(1, 2, 3) as $x) {
                    h::li(function () use($x) {
                        h::a("Link {$x}", "#{$x}");
                    });
                }
            });
            h::comment("let's see some text");
            h::p("Lorem ipsum dolor sit amet, consectetur adipisicing elit...");
            h::comment("now for a table");
            h::table(function () {
                $table_data = h::get_variable('table_data', array());
                h::tr(array("class" => "header"), function () {
                    h::th("key");
                    h::th("value");
                });
                foreach ($table_data as $k => $v) {
                    h::tr(array("class" => h::cycle(array("odd", "even"))), function () use($k, $v) {
                        h::td($k);
                        h::td($v);
                    });
                }
            });
        });
    });
});
コード例 #4
0
ファイル: users.php プロジェクト: hypnomez/opir.org
function row($col1, $col2)
{
    return h::th($col1) . h::td($col2);
}
コード例 #5
0
ファイル: permissions.php プロジェクト: hypnomez/opir.org
            if (!isset($rc[3])) {
                break;
            }
            $a->buttons = false;
            $a->cancel_button_back = true;
            $permission = $Permission->get($rc[3]);
            $Page->title($L->deletion_of_permission("{$permission['group']}/{$permission['label']}"));
            $a->content(h::{'p.lead.cs-center'}($L->sure_delete_permission("{$permission['group']}/{$permission['label']}")) . h::{'input[type=hidden]'}(['name' => 'id', 'value' => $rc[3]]) . h::{'button[type=submit]'}($L->yes));
            $Page->warning($L->changing_settings_warning);
            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]'}();
    }
コード例 #6
0
ファイル: add.php プロジェクト: hypnomez/opir.org
<?php

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

use h, cs\Index, cs\Language\Prefix, cs\Page;
$Index = Index::instance();
$L = new Prefix('oauth2_');
Page::instance()->title($L->addition_of_client);
$Index->apply_button = false;
$Index->cancel_button_back = true;
$Index->action = 'admin/OAuth2/clients/list';
$Index->content(h::{'p.lead.cs-center'}($L->addition_of_client) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr'}(h::th($L->client_name) . h::{'td input[name=name]'}(), h::th($L->client_domain) . h::{'td input[name=domain]'}(), h::th($L->active) . h::{'td input[type=radio][name=active][checked=1]'}(['value' => [0, 1], 'in' => [$L->no, $L->yes]])) . h::{'input[type=hidden][name=mode][value=add]'}());
コード例 #7
0
ファイル: prepare.php プロジェクト: hypnomez/opir.org
/**
 * @param array[]	$rows
 * @param int	$cols
 *
 * @return array
 */
function form_rows_to_cols($rows, $cols = 2)
{
    foreach ($rows[0] as $i => &$r) {
        $r .= $rows[1][$i];
    }
    unset($i, $r);
    $rows = $rows[0];
    $return = [];
    $row = 0;
    foreach ($rows as $i => $r) {
        if (!isset($return[$row])) {
            $return[$row] = '';
        }
        $return[$row] .= $r;
        if (++$i % $cols === 0) {
            ++$row;
        }
    }
    if (isset($i) && $i % $cols != 0) {
        $return[$row] .= str_repeat(h::th() . h::td(), $cols - $i % $cols);
    }
    return $return;
}
コード例 #8
0
ファイル: edit.php プロジェクト: hypnomez/opir.org
<?php

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

use h, cs\Config, cs\Index, cs\Language\Prefix, cs\Page;
$Index = Index::instance();
$L = new Prefix('oauth2_');
$client = OAuth2::instance()->get_client(Config::instance()->route[2]);
Page::instance()->title($L->editing_of_client($client['name']));
$Index->apply_button = false;
$Index->cancel_button_back = true;
$Index->action = 'admin/OAuth2/clients/list';
$Index->content(h::{'p.lead.cs-center'}($L->editing_of_client($client['name'])) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr'}(h::th($L->client_name) . h::{'td input[name=name]'}(['value' => $client['name']]), h::th('client_secret') . h::{'td input[name=secret]'}(['value' => $client['secret']]), h::th($L->client_domain) . h::{'td input[name=domain]'}(['value' => $client['domain']]), h::th($L->active) . h::{'td input[type=radio][name=active]'}(['checked' => $client['active'], 'value' => [0, 1], 'in' => [$L->no, $L->yes]])) . h::{'input[type=hidden][name=id]'}(['value' => $client['id']]) . h::{'input[type=hidden][name=mode][value=edit]'}());
コード例 #9
0
ファイル: settings.php プロジェクト: hypnomez/opir.org
$Page->title($L->my_profile);
$Page->title($L->settings);
$Index->action = path($L->profile) . '/' . path($L->settings);
switch (isset($Config->route[2]) ? $Config->route[2] : '') {
    default:
        $Index->content(h::p(h::{'a.cs-button'}($L->general, ['href' => "{$Index->action}/" . path($L->general)]) . h::{'a.cs-button'}($L->change_password, ['href' => "{$Index->action}/" . path($L->change_password)])));
        Trigger::instance()->run('System/profile/settings');
        break;
    case 'general':
        $user_data = $User->get($columns);
        unset($columns);
        $timezones = get_timezones_list();
        $row = function ($col1, $col2) {
            return h::th($col1) . h::td($col2);
        };
        $Index->form = true;
        $Index->form_atributes['class'] = 'cs-center';
        $Index->apply_button = false;
        $Index->cancel_button_back = true;
        $Page->title($L->general);
        $Index->content(h::{'p.lead.cs-center'}($L->general_settings) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr'}($row($L->login, h::input(['name' => 'user[login]', 'value' => $user_data['login']])), $row($L->username, h::input(['name' => 'user[username]', 'value' => $user_data['username']])), $row($L->language, h::select(['in' => array_merge([$L->system_default], $Config->core['active_languages']), 'value' => array_merge([''], $Config->core['active_languages'])], ['name' => 'user[language]', 'selected' => $user_data['language'], 'size' => 5])), $row($L->timezone, h::select(['in' => array_merge(["{$L->system_default} ({$Config->core['timezone']})"], array_keys($timezones)), 'value' => array_merge([''], array_values($timezones))], ['name' => 'user[timezone]', 'selected' => $user_data['timezone'], 'size' => 5])), $row($L->avatar, h::input(['name' => 'user[avatar]', 'value' => $user_data['avatar']]))));
        break;
    case 'change_password':
        $Index->form = true;
        $Index->form_atributes['class'] = 'cs-center';
        $Index->buttons = false;
        $Index->cancel_button_back = true;
        $Page->title($L->password_changing);
        $Index->content(h::{'p.lead.cs-center'}($L->password_changing) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr'}(h::th("{$L->current_password} " . h::{'icon#current_password.cs-pointer'}('lock')) . h::td(h::{'input.cs-profile-current-password[type=password]'}()), h::th("{$L->new_password} " . h::{'icon#new_password.cs-pointer'}('lock')) . h::td(h::{'input.cs-profile-new-password[type=password]'}())) . h::{'button.cs-profile-change-password'}($L->change_password));
        break;
}