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"])) : ''));
/** * @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'}());
<?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())); } });
$Index->content(h::{'button[type=submit][name=action][value=remove_confirmed]'}($L->yes) . h::{'input[type=hidden]'}(['name' => 'remove_theme_confirmed', 'value' => $_POST['remove_theme']])); return; break; case 'remove_confirmed': $theme = $_POST['remove_theme_confirmed']; if ($theme == 'CleverStyle' || $theme == $Config->core['theme']) { break; } $ok = true; get_files_list(THEMES . "/{$theme}", false, 'fd', true, true, false, false, true, function ($item) use(&$ok) { if (is_writable($item)) { is_dir($item) ? @rmdir($item) : @unlink($item); } else { $ok = false; } }); if ($ok && @rmdir(THEMES . "/{$theme}")) { $Index->save(); } else { $Index->save(false); } break; } } $Config->reload_themes(); $themes_for_removal = array_values(array_filter(get_files_list(THEMES, '/[^CleverStyle)]/', 'd'), function ($theme) use($Config) { return $theme != $Config->core['theme']; })); $Index->file_upload = true; $Index->content(h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}(core_select($Config->core['themes'], 'theme', 'change_theme', 'current_theme'), core_select($Config->core['color_schemes'][$Config->core['theme']], 'color_scheme', 'change_color_scheme')) . h::p(h::{'input[type=file][name=upload_theme]'}() . h::{'button[type=submit][name=action][value=upload]'}(h::icon('upload') . $L->upload_and_install_update_theme, ['formaction' => $Index->action])) . ($themes_for_removal ? h::p(h::{'select[name=remove_theme]'}($themes_for_removal) . h::{'button[type=submit][name=action][value=remove]'}(h::icon('trash-o') . $L->complete_theme_removal, ['formaction' => $Index->action])) : ''));
/** * 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; }
* @category modules * @author Nazar Mokrynskyi <*****@*****.**> * @copyright Copyright (c) 2014, Nazar Mokrynskyi * @license MIT License, see license.txt */ namespace cs\modules\Precincts; use h, cs\Core, cs\Index, cs\Language, cs\Page, cs\User; $Index = Index::instance(); $Index->title_auto = false; $L = Language::instance(); $Page = Page::instance(); if (isset($Index->route_path[0], $Index->route_ids[1]) && $Index->route_path[0] == 'violation') { $violation = Violations::instance()->get($Index->route_ids[1]); if ($violation['images']) { $Page->replace('/<meta content="[^"]*share.png" property="og:image">/Uims', ''); $Page->replace('/<link href="[^"]*share.png" rel="image_src">/Uims', ''); $Page->link(['rel' => 'image_src', 'href' => $violation['images'][0]]); foreach ($violation['images'] as $image) { $Page->og('image', $image); $Page->og('image:secure_url', $image); } } if ($violation['text']) { $Page->Description = description($violation['text']); } } $Page->Header .= h::{'button.cs-elections-add-violation'}(h::{'i.uk-icon-plus'}() . " {$L->add_violation}") . h::{'button.cs-elections-last-violations'}(); $Page->js("window.disqus_shortname = '" . Core::instance()->disqus_shortname . "';", 'code'); $Page->content(h::{'div.cs-elections-last-violations-panel'}(h::h2($L->last_violations) . h::{'section'}()) . h::{'aside.cs-elections-precinct-sidebar'}() . h::{'aside.cs-elections-add-violation-sidebar'}() . h::{'aside.cs-elections-violation-read-more-sidebar'}() . h::{'aside.cs-elections-main-sidebar'}(h::{'div.cs-elections-opirzagin a[href=become_eyes]'}($L->become_eyes) . h::{'div.cs-elections-opirzagin a[href=opirzagin]'}($L->opircrew) . h::{'div.cs-elections-opirzagin a[href=instruktsia]'}($L->instruktsia) . h::{'div.cs-elections-socials'}('<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/Common/includes/img/share.png"></div>' . '<div class="yashare-auto-init" data-yashareL10n="uk" data-yashareQuickServices="vkontakte,twitter" data-yashareLink="https://opir.org/" data-yashareTheme="counter" data-yashareImage="https://opir.org/components/modules/Common/includes/img/share.png"></div>') . h::h2($L->precincts_search) . h::{'input.cs-elections-precincts-search[type=search]'}(['placeholder' => $L->number_or_address]) . h::{'section.cs-elections-precincts-search-results[level=0]'}() . h::h2($L->mobile_apps) . h::{'div.cs-elections-mobile-apps'}(h::{'a[target=_blank'}($L->download_in('App Store'), ['href' => 'https://itunes.apple.com/ua/app/opir.org/id896488790']) . h::{'a[target=_blank]'}($L->download_in('Google Play'), ['href' => 'https://play.google.com/store/apps/details?id=example.yariksoffice']) . h::{'a[target=_blank]'}($L->download_in('Market Place'), ['onclick' => "\$.cs.simple_modal('{$L->soon}')"])) . h::h2($L->contacts) . h::{'div.cs-elections-contacts'}(h::a(h::icon('phone') . '+38 093 012 22 11') . h::a(h::icon('phone') . '+38 067 708 42 90') . h::{'a[href=mailto:info@opir.org]'}(h::icon('envelope') . '*****@*****.**')) . h::h2($L->map_legend) . h::{'div.cs-elections-map-legend'}(h::div($L->precincts_with_violations) . h::div($L->precincts_without_violations) . h::div($L->district_precincts))));
} $results_count = $users_db->qfs(["SELECT COUNT(`id`)\n\t\tFROM `[prefix]users`\n\t\tWHERE\n\t\t\t(\n\t\t\t\t{$where}\n\t\t\t) AND\n\t\t\t`status` != '%s'", User::STATUS_NOT_ACTIVATED]); if ($results_count) { $from = $start * $limit; $users_ids = $users_db->qfas(["SELECT `id`\n\t\t\tFROM `[prefix]users`\n\t\t\tWHERE\n\t\t\t\t(\n\t\t\t\t\t{$where}\n\t\t\t\t) AND\n\t\t\t\t`status` != '%s'\n\t\t\tORDER BY `id`\n\t\t\tLIMIT {$from}, {$limit}", User::STATUS_NOT_ACTIVATED]); unset($from); } $users_list = []; if (isset($users_ids) && is_array($users_ids)) { foreach ($users_ids as $id) { $is_guest = $id == User::GUEST_ID; $is_root = $id == User::ROOT_ID; $groups = (array) $User->get_groups($id); $is_bot = in_array(User::BOT_GROUP_ID, $groups); $is_active = $User->get('status', $id) == User::STATUS_ACTIVE; $buttons = (!$is_guest && !$is_root && !$is_bot ? h::{'a.cs-button-compact'}(h::icon('pencil'), ['href' => "{$a->action}/edit_raw/{$id}", 'data-title' => $L->edit_raw_user_data]) : '') . (!$is_guest && !$is_root && (!$is_bot || !$Config->core['simple_admin_mode']) ? h::{'a.cs-button-compact'}(h::icon('pencil-square-o'), ['href' => "{$a->action}/edit/{$id}", 'data-title' => $L->{$is_bot ? 'edit_bot_information' : 'edit_user_information'}]) : '') . (!$is_guest && !$is_root ? h::{'a.cs-button-compact'}(h::icon($is_active ? 'minus' : 'check'), ['href' => "{$a->action}/" . ($is_active ? 'deactivate' : 'activate') . "/{$id}", 'data-title' => $L->{($is_active ? 'de' : '') . 'activate_' . ($is_bot ? 'bot' : 'user')}]) : '') . (!$is_guest && !$is_root && !$is_bot ? h::{'a.cs-button-compact'}(h::icon('group'), ['href' => "{$a->action}/groups/{$id}", 'data-title' => $L->edit_user_groups]) : '') . (!$is_root ? h::{'a.cs-button-compact'}(h::icon('key'), ['href' => "{$a->action}/permissions/{$id}", 'data-title' => $L->{$is_bot ? 'edit_bot_permissions' : 'edit_user_permissions'}]) : '-'); $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]) {
$a->content(h::{'p.lead.cs-center'}($L->sure_to_delete . ' ' . $L->storage . ' ' . $Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection'] . '?' . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => 'delete']) . h::{'input[type=hidden]'}(['name' => 'storage', 'value' => $rc[3]])) . h::{'button[type=submit]'}($L->yes)); } break; case 'test': interface_off(); $test_dialog = false; $a->form = false; $a->generate_auto = false; $Storage = Storage::instance(); if (isset($rc[3])) { $Page->Content = h::{'p.cs-test-result'}($Storage->test([$rc[3]]) ? $L->success : $L->failed); } else { $Page->Content = h::{'p.cs-test-result'}($Storage->test($_POST['storage']) ? $L->success : $L->failed); } break; } } else { $storage_list = []; $Core = Core::instance(); $storages = $Config->storage; if (!empty($storages)) { foreach ($storages as $i => &$storage_data) { $storage_list[] = [[$i ? h::{'a.cs-button-compact'}(h::icon('pencil'), ['href' => "{$a->action}/edit/{$i}", 'data-title' => "{$L->edit} {$L->storage}"]) . h::{'a.cs-button-compact'}(h::icon('trash-o'), ['href' => "{$a->action}/delete/{$i}", 'data-title' => "{$L->delete} {$L->storage}"]) . h::{'a.cs-button-compact'}(h::icon('signal'), ['onMouseDown' => "cs.storage_test('{$a->action}/test/{$i}', true);", 'data-title' => $L->test_connection]) : '-', ['class' => $i ? '' : 'text-primary']], [[$i ? $storage_data['url'] : $Core->storage_url ?: url_by_source(STORAGE), $i ? $storage_data['host'] : $Core->storage_host, $i ? $storage_data['connection'] : $Core->storage_type, $i ? $storage_data['user'] : $Core->storage_user ?: '-'], ['class' => $i ? '' : 'text-primary']]]; } unset($i, $storage_data); } unset($storages); $a->content(h::{'table.cs-table.cs-center-all'}(h::{'thead tr th'}([$L->action, $L->storage_url, $L->storage_host, $L->storage_connection, $L->storage_user]) . h::{'tbody tr| td'}([$storage_list])) . h::{'p a.cs-button'}($L->add_storage, ['href' => "admin/System/{$rc['0']}/{$rc['1']}/add"])); unset($storage_list); } $test_dialog && $a->content(h::{'div#cs-storage-test.uk-modal div'}(h::h3($L->test_connection) . h::div()));
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"])); }
$a->form = false; $a->generate_auto = false; $db = DB::instance(); if (isset($rc[4])) { $Page->content(h::{'p.cs-test-result'}($db->test([$rc[3], $rc[4]]) ? $L->success : $L->failed)); } elseif (isset($rc[3])) { $Page->content(h::{'p.cs-test-result'}($db->test([$rc[3]]) ? $L->success : $L->failed)); } else { $Page->content(h::{'p.cs-test-result'}($db->test($_POST['db']) ? $L->success : $L->failed)); } } } else { $test_dialog = true; $db_list = []; $databases = $Config->db; if (!empty($databases)) { foreach ($databases as $i => &$db_data) { $db_list[] = [[[h::{'a.cs-button-compact'}([h::icon('plus'), ['href' => "{$a->action}/add/{$i}", 'data-title' => "{$L->add} {$L->mirror} {$L->of_db}"]], $i ? [h::icon('pencil'), ['href' => "{$a->action}/edit/{$i}", 'data-title' => "{$L->edit} {$L->db}"]] : false, $i ? [h::icon('trash-o'), ['href' => "{$a->action}/delete/{$i}", 'data-title' => $L->delete . ' ' . $L->db]] : false, [h::icon('signal'), ['onMouseDown' => "cs.db_test('{$a->action}/test/{$i}', true);", 'data-title' => $L->test_connection]]), ['class' => 'cs-left-all']], $i ? $db_data['host'] : $Core->db_host, $i ? $db_data['type'] : $Core->db_type, $i ? $db_data['prefix'] : $Core->db_prefix, $i ? $db_data['name'] : $Core->db_name, $i ? $db_data['user'] : '******', $i ? $db_data['charset'] : $Core->db_charset], ['class' => $i ? '' : 'text-primary']]; foreach ($Config->db[$i]['mirrors'] as $m => &$mirror) { if (is_array($mirror) && !empty($mirror)) { $db_list[] = [[h::{'a.cs-button-compact'}([h::icon('pencil'), ['href' => "admin/System/{$rc['0']}/{$rc['1']}/edit/{$i}/{$m}", 'data-title' => "{$L->edit} {$L->mirror} {$L->of_db}"]], [h::icon('trash-o'), ['href' => "admin/System/{$rc['0']}/{$rc['1']}/delete/{$i}/{$m}", 'data-title' => "{$L->delete} {$L->mirror} {$L->of_db}"]], [h::icon('signal'), ['onMouseDown' => "cs.db_test('{$a->action}/test/{$i}/{$m}', true);", 'data-title' => $L->test_connection]]), ['class' => 'cs-right-all']], $mirror['host'], $mirror['type'], $mirror['prefix'], $mirror['name'], $mirror['user'], $mirror['charset']]; } } unset($m, $mirror); } unset($i, $db_data); } unset($databases); $a->content(h::{'table.cs-table'}(h::{'thead tr th'}($L->action, $L->db_host, $L->db_type, $L->db_prefix, $L->db_name, $L->db_user, $L->db_charset) . h::tbody(h::{'tr| td'}([$db_list]))) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}([[h::info('db_balance'), h::{'input[type=radio]'}(['name' => 'core[db_balance]', 'checked' => $Config->core['db_balance'], 'value' => [0, 1], 'in' => [$L->off, $L->on]])], [h::info('maindb_for_write'), h::{'input[type=radio]'}(['name' => 'core[maindb_for_write]', 'checked' => $Config->core['maindb_for_write'], 'value' => [0, 1], 'in' => [$L->off, $L->on]])]]) . h::{'p a.cs-button'}($L->add_database, ['href' => "admin/System/{$rc['0']}/{$rc['1']}/add"]) . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => 'config'])); } $test_dialog && $a->content(h::{'div#cs-db-test.uk-modal div'}(h::h3($L->test_connection) . h::div()));
function get_pages_rows() { $L = Language::instance(); $Static_pages = Static_pages::instance(); $categories = array_slice(Config::instance()->route, 2); $structure = $Static_pages->get_structure(); $path = []; if (!empty($categories)) { foreach ($categories as $category) { $category = $Static_pages->get_category($category)['path']; if (isset($structure['categories'][$category])) { $structure = $structure['categories'][$category]; $path[] = $structure['path']; } } unset($category); } Page::instance()->title($structure['id'] == 0 ? $L->root_category : $structure['title']); $path = !empty($path) ? implode('/', $path) . '/' : ''; $content = []; if (!empty($structure['pages'])) { foreach ($structure['pages'] as &$page) { $page = $Static_pages->get($page); $content[] = [[h::a($page['title'], ['href' => $path . $page['path']]), ['class' => 'cs-static-pages-padding-left-0']], h::{'a.cs-button-compact'}([h::icon('file-text'), ['href' => "admin/Static_pages/edit_page/{$page['id']}", 'data-title' => $L->edit]], [h::icon('trash-o'), ['href' => "admin/Static_pages/delete_page/{$page['id']}", 'data-title' => $L->delete]])]; } } return [$content]; }
$Index->form = false; switch ($Index->route_path[2]) { case 'phpinfo': $Index->Content = ob_wrapper(function () { phpinfo(); }); break; case 'readme.html': $Index->Content = file_get_contents(DIR . '/readme.html'); } $Index->stop; return; } $hhvm_version = defined('HHVM_VERSION') ? HHVM_VERSION : false; $Index->form = false; $Index->content(h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}([h::{'a.cs-button[target=_blank]'}('phpinfo()', ['href' => "{$Index->action}/phpinfo"]) . h::{'a.cs-button[target=_blank]'}($L->information_about_system, ['href' => "{$Index->action}/readme.html"]) . h::{'div#cs-system-license.uk-modal pre.uk-modal-dialog-large'}(file_get_contents(DIR . '/license.txt'), ['title' => "{$L->system} » {$L->license}"]) . h::{'button#cs-system-license-open'}($L->license, ['data-title' => $L->click_to_view_details]), ['colspan' => 2]], ["{$L->operation_system}:", php_uname('s') . ' ' . php_uname('r') . ' ' . php_uname('v')], ["{$L->server_type}:", server_api()], preg_match('/apache/i', $_SERVER['SERVER_SOFTWARE']) ? [$L->version_of('Apache') . ':', apache_version()] : false, preg_match('/nginx/i', $_SERVER['SERVER_SOFTWARE']) ? [$L->version_of('Nginx') . ':', explode('/', $_SERVER['SERVER_SOFTWARE'])[1]] : false, $hhvm_version ? [$L->version_of('HHVM') . ':', $hhvm_version] : false, $hhvm_version ? false : ["{$L->available_ram}:", str_replace(['K', 'M', 'G'], [" {$L->KB}", " {$L->MB}", " {$L->GB}"], ini_get('memory_limit'))], [$L->version_of('PHP') . ':', PHP_VERSION], ["{$L->php_components}:", h::{'table.cs-left-odd.cs-table-borderless tr| td'}(["{$L->mcrypt}:", [check_mcrypt() ? $L->on : $L->off . h::icon('info-sign', ['data-title' => $L->mcrypt_warning]), ['class' => state(check_mcrypt())]]], ["{$L->zlib}:", $L->get(zlib())], zlib() ? ["{$L->zlib_compression}:", $L->get(zlib_compression())] : false, zlib_compression() ? ["{$L->zlib_compression_level}:", zlib_compression_level()] : false, ["{$L->curl_lib}:", [$L->get(curl()), ['class' => state(curl())]]], ["{$L->apc_module}:", [$L->get(apc()), ['class' => version_compare(PHP_VERSION, '5.5', '>=') ? false : state(apc())]]], ["{$L->memcached_module}:", [$L->get(memcached())]])], ["{$L->main_db}:", $Core->db_type], ["{$L->properties} {$Core->db_type}:", h::{'table.cs-left-odd.cs-table-borderless tr| td'}(["{$L->host}:", $Core->db_host], [$L->version_of($Core->db_type) . ':', [DB::instance()->server()]], ["{$L->name_of_db}:", $Core->db_name], ["{$L->prefix_for_db_tables}:", $Core->db_prefix])], ["{$L->main_storage}:", $Core->storage_type], ["{$L->cache_engine}:", $Core->cache_engine], ["{$L->free_disk_space}:", format_filesize(disk_free_space('./'), 2)], ["{$L->php_ini_settings}:", h::{'table.cs-left-odd.cs-table-borderless tr| td'}(["{$L->allow_file_upload}:", [$L->get(ini_get('file_uploads')), ['class' => state(ini_get('file_uploads'))]]], $hhvm_version ? false : ["{$L->max_file_uploads}:", ini_get('max_file_uploads')], ["{$L->upload_limit}:", format_filesize(str_replace(['K', 'M', 'G'], [" {$L->KB}", " {$L->MB}", " {$L->GB}"], ini_get('upload_max_filesize')))], ["{$L->post_max_size}:", format_filesize(str_replace(['K', 'M', 'G'], [" {$L->KB}", " {$L->MB}", " {$L->GB}"], ini_get('post_max_size')))], $hhvm_version ? false : ["{$L->max_execution_time}:", format_time(ini_get('max_execution_time'))], $hhvm_version ? false : ["{$L->max_input_time}:", format_time(ini_get('max_input_time'))], $hhvm_version ? false : ["{$L->default_socket_timeout}:", format_time(ini_get('default_socket_timeout'))], ["{$L->allow_url_fopen}:", [$L->get(ini_get('allow_url_fopen')), ['class' => state(ini_get('allow_url_fopen'))]]], ["{$L->display_errors}:", [$L->get(display_errors()), ['class' => state(!display_errors())]]])])); function state($state) { return $state ? 'uk-alert-success' : 'uk-alert-danger'; } /** * Returns server type * * @return string */ function server_api() { $phpinfo = ob_wrapper(function () { phpinfo(); }); if (preg_match('/apache/i', $_SERVER['SERVER_SOFTWARE'])) {
<?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_'); Page::instance()->title($L->list_of_client); $Index->apply_button = false; $module_data = Config::instance()->module('OAuth2'); $Index->content(h::{'p.lead.cs-center'}($L->list_of_clients) . h::{'table.cs-table.cs-center-all'}(h::{'thead tr th'}([$L->client_name, 'client_id', 'client_secret', $L->action]) . h::{'tbody tr'}(array_map(function ($client) use($L) { return h::td([$client['name'], h::{'input{disabled]'}($client['id']), h::{'input{disabled]'}($client['secret']), h::{'a.cs-button-compact'}([h::icon('pencil'), ['href' => "admin/OAuth2/clients/edit/{$client['id']}", 'data-title' => $L->edit]]) . h::{'a.cs-button-compact'}([h::icon('trash-o'), ['href' => "admin/OAuth2/clients/delete/{$client['id']}", 'data-title' => $L->delete]])], ['class' => $client['active'] ? false : 'text-muted']); }, OAuth2::instance()->clients_list()))) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd.uk-margin-top tr| td'}([h::info('oauth2_allow_guest_tokens'), h::{'input[type=radio]'}(['name' => 'general[guest_tokens]', 'checked' => $module_data->guest_tokens, 'value' => [0, 1], 'in' => [$L->no, $L->yes]])], [h::info('oauth2_automatic_prolongation'), h::{'input[type=radio]'}(['name' => 'general[automatic_prolongation]', 'checked' => $module_data->automatic_prolongation, 'value' => [0, 1], 'in' => [$L->no, $L->yes]])], [h::info('oauth2_expiration'), h::{'input[type=number]'}(['name' => 'general[expiration]', 'value' => $module_data->expiration, 'min' => 1]) . $L->seconds]) . h::{'p.cs-left a.cs-button'}([$L->add_client, ['href' => 'admin/OAuth2/clients/add']]));
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"])); }
case 'Instagram': return 'instagram'; case 'LinkedIn': return 'linkedin'; case 'Tumblr': return 'tumbrl'; case 'Twitter': return 'twitter'; case 'Vkontakte': return 'vk'; default: return false; } }; $data['list'] = h::{'ul.cs-hybrid-auth-providers-list li'}([$L->or_sign_in_with, ['class' => 'uk-nav-header']], array_map(function ($provider) use($L, $icon_mapper) { return [h::a(h::icon($icon_mapper($provider)) . $L->{$provider}), ['data-provider' => $provider, 'class' => "cs-hybrid-auth-{$provider}"]]; }, array_keys($providers))); }); Trigger::instance()->register('System/User/registration/confirmation/after', function () { if ($referer = _getcookie('HybridAuth_referer')) { header("Refresh: 5; url={$referer}"); _setcookie('HybridAuth_referer', ''); } }); Trigger::instance()->register('System/User/del/after', function ($data) { /** * @var \cs\DB\_Abstract $cdb */ $cdb = DB::instance()->{Config::instance()->module('HybridAuth')->db('integration')}(); $cdb->q(["DELETE FROM `[prefix]users_social_integration`\n\t\t\t\tWHERE `id` = '%s'", "DELETE FROM `[prefix]users_social_integration_contacts`\n\t\t\t\tWHERE `id` = '%s'"], $data['id']); });
/** * Link to the module admin page */ if (file_exists(MODULES . "/{$module_name}/admin/index.php") || file_exists(MODULES . "/{$module_name}/admin/index.json")) { $action .= h::{'a.cs-button-compact'}(h::icon('wrench'), ['href' => "admin/{$module_name}", 'data-title' => $L->module_admin_page]); $admin_link = true; } if ($module_name != $Config->core['default_module']) { $action .= h::{'a.cs-button-compact'}(h::icon($module_data['active'] == 1 ? 'minus' : 'check'), ['href' => $a->action . ($module_data['active'] == 1 ? '/disable/' : '/enable/') . $module_name, 'data-title' => $module_data['active'] == 1 ? $L->disable : $L->enable]) . h::{'a.cs-button-compact'}(h::icon('trash-o'), ['href' => "{$a->action}/uninstall/{$module_name}", 'data-title' => $L->uninstall]); } } /** * If module uninstalled or not installed yet */ } else { $action .= h::{'a.cs-button-compact'}(h::icon('download'), ['href' => "{$a->action}/install/{$module_name}", 'data-title' => $L->install]); } $module_info = false; if (file_exists(MODULES . "/{$module_name}/meta.json")) { $module_meta = file_get_json(MODULES . "/{$module_name}/meta.json"); $module_info = $L->module_info($module_meta['package'], $module_meta['version'], $module_meta['description'], $module_meta['author'], isset($module_meta['website']) ? $module_meta['website'] : $L->none, $module_meta['license'], isset($module_meta['db_support']) ? implode(', ', $module_meta['db_support']) : $L->none, isset($module_meta['storage_support']) ? implode(', ', $module_meta['storage_support']) : $L->none, isset($module_meta['provide']) ? implode(', ', (array) $module_meta['provide']) : $L->none, isset($module_meta['require']) ? implode(', ', (array) $module_meta['require']) : $L->none, isset($module_meta['conflict']) ? implode(', ', (array) $module_meta['conflict']) : $L->none, isset($module_meta['optional']) ? implode(', ', (array) $module_meta['optional']) : $L->none, isset($module_meta['multilingual']) && in_array('interface', $module_meta['multilingual']) ? $L->yes : $L->no, isset($module_meta['multilingual']) && in_array('content', $module_meta['multilingual']) ? $L->yes : $L->no, isset($module_meta['languages']) ? implode(', ', $module_meta['languages']) : $L->none); } unset($module_meta); $modules_list[] = [h::a($L->{$module_name}, ['href' => $admin_link ? "admin/{$module_name}" : false, 'data-title' => $module_info]), h::icon($module_data['active'] == 1 ? $module_name == $Config->core['default_module'] ? 'home' : 'check' : ($module_data['active'] == 0 ? 'minus' : 'times'), ['data-title' => $module_data['active'] == 1 ? $module_name == $Config->core['default_module'] ? $L->default_module : $L->enabled : ($module_data['active'] == 0 ? $L->disabled : "{$L->uninstalled} ({$L->not_installed})")]) . $addition_state, [$action, ['class' => 'cs-left-all']]]; unset($module_info); } $modules_for_removal = array_keys(array_filter($Config->components['modules'], function ($module_data) { return $module_data['active'] == '-1'; })); $a->content(h::{'table.cs-table.cs-center-all'}(h::{'thead tr th'}($L->module_name, $L->state, $L->action) . h::{'tbody tr| td'}([$modules_list])) . h::p(h::{'input[type=file][name=upload_module]'}() . h::{'button[type=submit]'}(h::icon('upload') . $L->upload_and_install_update_module, ['formaction' => "{$a->action}/install/upload"])) . h::p(h::{'input[type=file][name=upload_system]'}() . h::{'button[type=submit]'}(h::icon('upload') . $L->upload_and_update_system, ['formaction' => "{$a->action}/update_system"])) . ($modules_for_removal ? h::p(h::{'select[name=remove_module]'}($modules_for_removal) . h::{'button[type=submit]'}(h::icon('trash-o') . $L->complete_module_removal, ['formaction' => "{$a->action}/remove"])) : '') . h::{'button[type=submit]'}(h::icon('refresh') . $L->update_modules_list, ['data-title' => $L->update_modules_list_info, 'name' => 'update_modules_list']));
/** * @package OAuth2 customization * @category plugins * @author Nazar Mokrynskyi <*****@*****.**> * @copyright Copyright (c) 2014, Nazar Mokrynskyi * @license MIT License, see license.txt */ namespace cs; use h; Trigger::instance()->register('OAuth2/custom_sign_in_page', function () { if (!in_array('OAuth2_customization', Config::instance()->components['plugins'])) { return true; } define('MOBILE_AUTH', true); $L = Language::instance(); $Page = Page::instance(); $Page->Title = [$Page->Title[0], $L->sign_in]; $Page->content(h::{'section.cs-oauth2-customization'}(h::{'h2.uk-text-center.uk-margin-top'}($L->sign_in) . h::a(h::icon('facebook') . $L->sign_in_with('Facebook'), ['href' => 'HybridAuth/Facebook']) . h::a(h::icon('vk') . $L->sign_in_with('VK'), ['href' => 'HybridAuth/Vkontakte']))); return false; })->register('System/Config/routing_replace', function () { if (!in_array('OAuth2_customization', Config::instance()->components['plugins'])) { return; } spl_autoload_register(function ($class) { if (ltrim($class, '\\') == 'cs\\modules\\OAuth2\\OAuth2') { include __DIR__ . '/OAuth2.php'; } }, true, true); });