Beispiel #1
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;
 }
Beispiel #2
0
     $a->action = "admin/System/{$rc['0']}/{$rc['1']}";
     $Page->title($rc[2] == 'edit' ? $L->editing_of_storage($Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection']) : $L->adding_of_storage);
     $a->content(h::{'p.lead.cs-center'}($rc[2] == 'edit' ? $L->editing_of_storage($Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection']) : $L->adding_of_storage) . h::{'table.cs-table-borderless.cs-center-all tr'}(\cs\modules\System\form_rows_to_cols([array_map(function ($in) {
         return h::{'th info'}($in);
     }, ['storage_url', 'storage_host', 'storage_connection', 'storage_user', 'storage_pass']), array_map(function ($in) {
         return h::td($in);
     }, [h::input(['name' => 'storage[url]', 'value' => $rc[2] == 'edit' ? $storage['url'] : '']), h::input(['name' => 'storage[host]', 'value' => $rc[2] == 'edit' ? $storage['host'] : '']), h::select(['in' => _mb_substr(get_files_list(ENGINES . '/Storage', '/^[^_].*?\\.php$/i', 'f'), 0, -4)], ['name' => 'storage[connection]', 'selected' => $rc[2] == 'edit' ? $storage['connection'] : '', 'size' => 5]), h::input(['name' => 'storage[user]', 'value' => $rc[2] == 'edit' ? $storage['user'] : '']), h::input(['name' => 'storage[password]', 'value' => $rc[2] == 'edit' ? $storage['password'] : '']) . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2] == 'edit' ? 'edit' : 'add']) . (isset($rc[3]) ? h::{'input[type=hidden]'}(['name' => 'storage_id', 'value' => $rc[3]]) : '')])])) . h::button($L->test_connection, ['onMouseDown' => "cs.storage_test('{$a->action}/test');"]));
     break;
 case 'delete':
     $a->buttons = false;
     $modules = [];
     foreach ($Config->components['modules'] as $module => &$mdata) {
         if (isset($mdata['storage']) && is_array($mdata['storage'])) {
             foreach ($mdata['storage'] as $storage_name) {
                 if ($storage_name == $rc[3]) {
                     $modules[] = h::b($module);
                     break;
                 }
             }
         }
     }
     unset($module, $mdata, $storage_name);
     if (!empty($modules)) {
         $Page->warning($L->storage_used_by_modules . ': ' . implode(', ', $modules));
     } else {
         $a->action = "admin/System/{$rc['0']}/{$rc['1']}";
         $Page->title($L->deletion_of_storage($Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection']));
         $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':
Beispiel #3
0
     $Page->title($rc[2] == 'edit' ? $L->editing_the_database($name) : $L->addition_of_db);
     $a->content(h::{'p.lead.cs-center'}($rc[2] == 'edit' ? $L->editing_the_database($name) : $L->addition_of_db) . h::{'table.cs-table.cs-center-all tr'}(\cs\modules\System\form_rows_to_cols([array_map(function ($in) {
         return h::{'th info'}($in);
     }, [$rc[2] == 'add' ? 'db_mirror' : false, 'db_host', 'db_type', 'db_prefix', 'db_name', 'db_user', 'db_password', 'db_charset']), array_map(function ($in) {
         return h::td($in);
     }, [$rc[2] == 'add' ? h::select(['in' => $dbsname, 'value' => $dbs], ['name' => 'db[mirror]', 'selected' => isset($rc[3]) ? $rc[3] : -1, 'size' => 5]) : false, h::input(['name' => 'db[host]', 'value' => $rc[2] == 'edit' ? $database['host'] : $Core->db_host]), h::select(['in' => _mb_substr(get_files_list(ENGINES . '/DB', '/^[^_].*?\\.php$/i', 'f'), 0, -4)], ['name' => 'db[type]', 'selected' => $rc[2] == 'edit' ? $database['type'] : $Core->db_type, 'size' => 5]), h::input(['name' => 'db[prefix]', 'value' => $rc[2] == 'edit' ? $database['prefix'] : $Core->db_prefix]), h::input(['name' => 'db[name]', 'value' => $rc[2] == 'edit' ? $database['name'] : '']), h::input(['name' => 'db[user]', 'value' => $rc[2] == 'edit' ? $database['user'] : '']), h::input(['name' => 'db[password]', 'value' => $rc[2] == 'edit' ? $database['password'] : '']), h::input(['name' => 'db[charset]', 'value' => $rc[2] == 'edit' ? $database['charset'] : $Core->db_charset]) . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2] == 'edit' ? 'edit' : 'add']) . (isset($rc[3]) ? h::{'input[type=hidden]'}(['name' => 'database', 'value' => $rc[3]]) : '') . (isset($rc[4]) ? h::{'input[type=hidden]'}(['name' => 'mirror', 'value' => $rc[4]]) : '')])])) . h::{'p button'}($L->test_connection, ['onMouseDown' => "cs.db_test('{$a->action}/test');"]));
     break;
 case 'delete':
     $a->buttons = false;
     $content = [];
     if (!isset($rc[4])) {
         foreach ($Config->components['modules'] as $module => &$mdata) {
             if (isset($mdata['db']) && is_array($mdata['db'])) {
                 foreach ($mdata['db'] as $db_name) {
                     if ($db_name == $rc[3]) {
                         $content[] = h::b($module);
                         break;
                     }
                 }
             }
         }
         unset($module, $mdata, $db_name);
     }
     if (!empty($content)) {
         $Page->warning($L->db_used_by_modules . ': ' . implode(', ', $content));
     } else {
         $a->action = 'admin/System/' . $rc[0] . '/' . $rc[1];
         $mirror = isset($rc[4]);
         $cdb = $Config->db[$rc[3]];
         if ($mirror) {
             $cdbm = $Config->db[$rc[3]]['mirrors'][$rc[4]];
Beispiel #4
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)])]));