Ejemplo n.º 1
0
 /**
  * This centralizes all input type textarea to-HTML necessities.
  *
  * @param array $params This array expects three parameters:
  * . name - the form element's name
  * . label (optional) - human readable description
  * . value (optional) - the value
  * . help (optional) - the help block to append to the text input
  * . size (optional) - the Bootstrap CSS size of the textarea (e.g., xxlarge)
  * . rows (optional) - number of rows
  */
 public function getHtmlInputTextarea(array $params = array())
 {
     if (empty($params['label'])) {
         $params['label'] = ucfirst($params['name']);
     }
     h::div(array('class' => 'clearfix'), function () use($params) {
         h::label(array('for' => $params['name']), $params['label']);
         h::div(array('class' => 'input'), function () use($params) {
             if (empty($params['size'])) {
                 $params['size'] = 'large';
             }
             $rows = '3';
             if (!empty($params['rows'])) {
                 $rows = $params['rows'];
             }
             h::textarea(array('class' => $params['size'], 'name' => $params['name'], 'value' => $params['value'], 'rows' => $rows));
             if (!empty($params['help'])) {
                 h::span(array('class' => 'help-block'), $params['help']);
             }
         });
     });
 }
Ejemplo n.º 2
0
/**
 * @package		Streams
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\Streams;

use h, cs\Index, cs\Page, cs\User;
$Page = Page::instance();
$Index = Index::instance();
$Index->title_auto = false;
$Page->Description = 'opir.org - Тут ви можете з орієнтуватися на самому майдані, дізнатися де проходять суди над евромайданівцями, бути попередженим про появлення тітушок';
$User = User::instance();
$Page->title('Камери');
$Page->og('image', 'https://opir.org/components/modules/Home/includes/img/share.png');
$Page->og('image:secure_url', 'https://opir.org/components/modules/Home/includes/img/share.png');
if (isset($Index->route_ids[0])) {
    $stream = Streams::instance()->get($Index->route_ids[0]);
    if (preg_match('/youtube.com\\/embed\\/(.*)/', $stream['stream_url'], $image)) {
        $Page->replace('https://opir.org/components/modules/Home/includes/img/share.png', "https://i1.ytimg.com/vi/{$image['1']}/hqdefault.jpg");
    }
    unset($stream, $image);
}
$Page->link(['rel' => 'image_src', 'href' => 'https://opir.org/components/modules/Home/includes/img/share.png']);
$Page->css('body>header{height:62px}#map{top:62px;left:0;}', 'code');
$Page->Header = h::{'div.cs-home-logo'}(h::{'a[href=/] img'}(['src' => "components/modules/Home/includes/img/logo.png"]) . '<div class="yashare-auto-init" data-yashareL10n="uk" data-yashareQuickServices="facebook" data-yashareLink="https://www.facebook.com/opir.org" data-yashareTheme="counter" data-yashareImage="https://opir.org/components/modules/Home/includes/img/share.png"></div>' . '<div class="yashare-auto-init" data-yashareL10n="uk" data-yashareQuickServices="vkontakte,twitter" data-yashareTheme="counter" data-yashareImage="https://opir.org/components/modules/Home/includes/img/share.png"></div>') . h::{'button.cs-stream-add'}('Додати камеру') . h::{'a.cs-home-home[href=/]'}() . ($User->user() ? h::{'button.cs-home-sign-out'}() : h::{'button.cs-home-sign-in'}()) . h::{'button.cs-home-donate'}('Допомогти ініціативі');
$Page->content(h::{'aside.cs-stream-add-panel'}() . h::{'aside.cs-stream-filter-panel'}(h::{"div.uk-button-dropdown[data-uk-dropdown={mode:'click'}]"}(h::{'button.uk-button'}(h::icon('caret-down') . ' ' . h::span('Показати карту')) . h::{'div.uk-dropdown ul.cs-stream-show.uk-nav.uk-nav-dropdown'}(h::{'li[data-mode=map] a'}('Показати карту') . h::{'li[data-mode=list] a'}('Показати список'))) . h::{'div.cs-stream-added-tags[level=0]'}() . h::{'input.cs-stream-filter'}(['placeholder' => 'Фільтр по адресі']) . h::{'div.cs-stream-found-tags[level=0]'}()) . h::{'div.cs-stream-filter-hide.uk-icon-chevron-right'}() . h::{'div.cs-stream-list'}());
Ejemplo n.º 3
0
 public function getViewExecutables()
 {
     require_once 'lib/lib.htmlgen.php';
     $o = $this;
     h::fieldset(function () use($o) {
         h::div(array('class' => 'clearfix'), function () use($o) {
             h::label(array('for' => SystemSettings::EXECUTABLE_PHP), 'PHP');
             h::div(array('class' => 'input'), function () use($o) {
                 h::input(array('type' => 'text', 'class' => 'span6', 'name' => SystemSettings::EXECUTABLE_PHP, 'value' => $o[SystemSettings::EXECUTABLE_PHP]));
                 h::span(array('class' => 'help-block'), "The path to the host system's PHP executable.");
             });
         });
         h::div(array('class' => 'clearfix'), function () use($o) {
             h::label(array('for' => SystemSettings::EXECUTABLE_GIT), 'Git');
             h::div(array('class' => 'input'), function () use($o) {
                 h::input(array('type' => 'text', 'class' => 'span6', 'name' => SystemSettings::EXECUTABLE_GIT, 'value' => $o[SystemSettings::EXECUTABLE_GIT]));
                 h::span(array('class' => 'help-block'), "The path to the host system's Git executable. Required in order to allow Git as the configured SCM for projects.");
             });
         });
         h::div(array('class' => 'clearfix'), function () use($o) {
             h::label(array('for' => SystemSettings::EXECUTABLE_SVN), 'SVN');
             h::div(array('class' => 'input'), function () use($o) {
                 h::input(array('type' => 'text', 'class' => 'span6', 'name' => SystemSettings::EXECUTABLE_SVN, 'value' => $o[SystemSettings::EXECUTABLE_SVN]));
                 h::span(array('class' => 'help-block'), "The path to the host system's SVN executable. Required in order to allow SVN as the configured SCM for projects.");
             });
         });
         /*    });
         
             h::fieldset(function () use ($o) {
               h::legend('Archivers');*/
         h::div(array('class' => 'clearfix'), function () use($o) {
             h::label(array('for' => SystemSettings::EXECUTABLE_TAR), 'tar');
             h::div(array('class' => 'input'), function () use($o) {
                 h::input(array('type' => 'text', 'class' => 'span6', 'name' => SystemSettings::EXECUTABLE_TAR, 'value' => $o[SystemSettings::EXECUTABLE_TAR]));
                 h::span(array('class' => 'help-block'), "The path to the host system's tar executable. Will be used to generate all release packages.");
             });
         });
     });
 }
Ejemplo n.º 4
0
        }
        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);
}
$plugins_for_removal = array_values(array_filter($plugins, function ($plugin) use($Config) {
    return !in_array($plugin, $Config->components['plugins']);
}));
$a->content(h::{'table.cs-table.cs-center-all'}(h::{'thead tr th'}($L->plugin_name, $L->state, $L->action) . h::{'tbody tr| td'}([$plugins_list ?: false])) . h::p(h::{'input[type=file][name=upload_plugin]'}(['style' => 'position: relative;']) . h::{'button[type=submit]'}(h::icon('upload') . $L->upload_and_install_update_plugin, ['formaction' => "{$a->action}/enable/upload"])) . ($plugins_for_removal ? h::p(h::{'select[name=remove_plugin]'}($plugins_for_removal) . h::{'button[type=submit]'}(h::icon('trash-o') . $L->complete_plugin_removal, ['formaction' => "{$a->action}/remove"])) : ''));
Ejemplo n.º 5
0
<?php

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

use h, cs\modules\Info\Info, cs\modules\Help\Help;
Trigger::instance()->register('System/Index/construct', function () {
    if (!API && !ADMIN && Config::instance()->module('Common')->active()) {
        $L = Language::instance();
        $Page = Page::instance();
        $Page->Description = 'opir.org - ми контролюємо вибори';
        $Page->og('image', 'https://opir.org/components/modules/Common/includes/img/share.png');
        $Page->og('image:secure_url', 'https://opir.org/components/modules/Common/includes/img/share.png');
        $Page->link(['rel' => 'image_src', 'href' => 'https://opir.org/components/modules/Common/includes/img/share.png']);
        $Page->Header = h::{'div.cs-elections-logo'}(h::{'a[href=/] img'}(['src' => "components/modules/Common/includes/img/logo-{$L->clang}.png"])) . h::{'nav.cs-elections-switch-language'}(h::span("{$L->clang} " . h::icon('caret-down'), ['class' => $L->clang]) . h::{'div a[href=/$i[lang]][in=$i[language]]'}(['class' => '$i[lang]', 'insert' => [['lang' => 'uk', 'language' => 'Українська'], ['lang' => 'ru', 'language' => 'Русский'], ['lang' => 'en', 'language' => 'English']]])) . h::{'button.cs-elections-info'}() . h::{'button.cs-elections-help-initiative'}($L->help_initiative);
        $Page->content(h::{'section.cs-elections-info-modal[style=display:none] article[style=width:800px;]'}(Info::get()) . h::{'section.cs-elections-help-initiative-modal[style=display:none] article[style=width:800px;]'}(Help::get()));
    }
});
Ejemplo n.º 6
0
            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"]));
}
Ejemplo n.º 7
0
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs;

use h;
$Group = Group::instance();
$Index = Index::instance();
$User = User::instance();
if (isset($_POST['group'], $_POST['count'])) {
    $group = $Group->get($_POST['group']);
    $count = (int) $_POST['count'];
    while ($count--) {
        for ($i = 100; $User->get_id(hash('sha224', $login = mb_strtolower($group['title']) . '_' . $i)); ++$i) {
        }
        $new_user = $User->registration("{$login}@" . DOMAIN, false, false);
        $User->set_groups([2, $group['id']], $new_user['id']);
        $Index->content(h::p("Логін: {$login} Пароль: {$new_user['password']}"));
    }
}
$groups = array_filter($Group->get_all(), function ($group) {
    return $group['id'] > 3;
});
Index::instance()->buttons = false;
$Index->content(h::{'p.cs-center'}(h::span('Група') . h::{'select[name=group]'}(['in' => array_values(array_map(function ($group) {
    return $group['description'];
}, $groups)), 'value' => array_values(array_map(function ($group) {
    return $group['id'];
}, $groups))])) . h::{'p.cs-center'}(h::span('Кількість') . h::{'input[name=count][type=number][min=1][value=1]'}()) . h::{'p.cs-center button[type=submit]'}('Додати користувачів'));
Ejemplo n.º 8
0
    $groups[$c['group']]['categories'][] = $c['id'];
}
$categories = $categories_;
unset($categories_, $c);
$Page->js('cs.home = ' . _json_encode(['categories' => $categories, 'reporter' => in_array(STREAMER_GROUP, $User->get_groups() ?: []) ? _json_encode($User->get_data('stream_url') ?: 1) : 0, 'automaidan' => (int) in_array(AUTOMAIDAN_GROUP, $User->get_groups() ?: []), 'automaidan_coord' => (int) in_array(AUTOMAIDAN_COORD_GROUP, $User->get_groups() ?: [])]) . ';', 'code');
$Index = Index::instance();
if (isset($Index->route_ids[0])) {
    $event = Events::instance()->get($Index->route_ids[0]);
    if ($event) {
        $Page->Description = 'Додано: ' . date('H:i d.m.Y', $event['added']);
        if ($event['timeout'] > 0) {
            $Page->Description .= ' Актуально до: ' . date('H:i d.m.Y', $event['timeout']);
        }
        if ($event['img']) {
            $Page->replace('https://opir.org/components/modules/Home/includes/img/share.png', $event['img']);
        }
        if (strpos($event['text'], 'stream:') === false) {
            $Page->Description .= ' ' . $event['text'];
        }
        $Page->og('title', array_column(Events_categories::instance()->get_all(), 'name', 'id')[$event['category']]);
    }
    unset($event);
}
$Page->content(h::{'aside.cs-home-add-panel'}() . h::{'aside.cs-home-events-stream-panel'}() . (!in_array(AUTOMAIDAN_COORD_GROUP, $User->get_groups() ?: []) ? h::{'aside.cs-home-settings-panel'}(h::{'a.cs-app-store[target=_blank]'}('App Store', ['href' => 'https://itunes.apple.com/in/app/opir/id828565038']) . h::{'div.cs-hot-line'}(h::h3('Гаряча лінія:') . '+38 050 258 17 05<br><small>(медичні питання)</small><br>+38 050 258 17 43<br><small>(координація самооборони)</small><br>+38 093 01 222 11<br><small>(інше)</small>') . h::{'input.cs-home-address-search'}(['placeholder' => 'Пошук адреси на карті']) . h::h2('Фільтр') . h::{'div.cs-home-added-tags[level=0]'}() . h::{'input.cs-home-filter-tags'}(['placeholder' => 'Фільтр по адресі']) . h::{'div.cs-home-found-tags[level=0]'}() . h::{'ul.cs-home-filter-category li'}(array_map(function ($g) use($categories) {
    $return = [[h::h2($g['name']), ['data-group' => $g['id']]]];
    foreach ($g['categories'] as $c) {
        $c = $categories[$c];
        $return[] = [h::img(['src' => "components/modules/Home/includes/img/{$c['id']}.png"]) . h::span($c['name']), ['data-id' => $c['id'], 'data-group' => $g['id']]];
    }
    return $return;
}, array_values($groups)))) : h::{'aside.cs-home-settings-coordinator'}(h::h2('Фільтр') . h::{'div.all'}())) . h::{'div.cs-home-events-stream.uk-icon-chevron-left'}() . h::{'div.cs-home-settings.uk-icon-chevron-right'}());