Ejemplo n.º 1
0
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\System;

use h, cs\Config, cs\Core, cs\Index, cs\Language;
$Config = Config::instance();
$L = Language::instance();
$Config->reload_languages();
$translate_engines = _mb_substr(get_files_list(ENGINES . '/Text', '/^[^_].*?\\.php$/i', 'f'), 0, -4);
$translate_engines_settings = [];
$current_engine_settings = '';
foreach ($translate_engines as $engine) {
    $parameters = file_get_json(ENGINES . '/Text/' . $engine . '.json');
    if (is_array($parameters) && !empty($parameters)) {
        $table = '';
        foreach ($parameters as $paremeter => $description) {
            $table .= h::{'tr td'}([$description, h::input(['name' => 'core[auto_translation_engine][' . $paremeter . ']', 'value' => isset($Config->core['auto_translation_engine'][$paremeter]) ? $Config->core['auto_translation_engine'][$paremeter] : ''])]);
        }
        $translate_engines_settings[] = base64_encode(h::table($table));
    } else {
        $translate_engines_settings[] = base64_encode($parameters ?: $L->no_settings_found);
    }
    if ($engine == $Config->core['auto_translation_engine']['name']) {
        $current_engine_settings = base64_decode(array_slice($translate_engines_settings, -1)[0]);
    }
}
unset($engine, $parameters, $paremeter, $description, $table);
Index::instance()->content(h::{'p.lead.cs-center'}(FIXED_LANGUAGE ? $L->language_fixed_as . ' ' . Core::instance()->language : false) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}(core_select($Config->core['active_languages'], 'language', 'change_language', 'current_language'), core_select($Config->core['languages'], 'active_languages', 'change_active_languages', null, true), [h::info('multilingual'), h::{'input[type=radio]'}(['name' => 'core[multilingual]', 'checked' => $Config->core['multilingual'], 'value' => [0, 1], 'in' => [$L->off, $L->on], 'OnClick' => ["\$('.cs-multilingual').hide(); \$('.cs-auto-translation').hide();", "\$('.cs-multilingual').show(); if (\$('#auto_translation [value=1]').prop('checked')) \$('.cs-auto-translation').show();"]])], [[h::info('auto_translation'), h::{'input[type=radio]'}(['name' => 'core[auto_translation]', 'checked' => $Config->core['auto_translation'], 'value' => [0, 1], 'in' => [$L->off, $L->on], 'OnClick' => ["\$('.cs-auto-translation').hide();", "\$('.cs-auto-translation').show();"]])], ['style' => !$Config->core['multilingual'] ? 'display: none; ' : '', 'id' => 'auto_translation', 'class' => 'cs-multilingual']], [[h::info('auto_translation_engine'), h::select($translate_engines, ['name' => 'core[auto_translation_engine][name]', 'selected' => $Config->core['auto_translation_engine']['name'], 'data-settings' => $translate_engines_settings, 'size' => 5])], ['style' => !$Config->core['multilingual'] || !$Config->core['auto_translation'] ? 'display: none; ' : '', 'id' => 'auto_translation_engine', 'class' => 'cs-auto-translation']], [[$L->auto_translation_engine_settings, ['style' => !$Config->core['multilingual'] || !$Config->core['auto_translation'] ? 'display: none; ' : '', 'class' => 'cs-auto-translation cs-multilingual']], [$current_engine_settings, ['style' => !$Config->core['multilingual'] || !$Config->core['auto_translation'] ? 'display: none; ' : '', 'id' => 'auto_translation_engine_settings', 'class' => 'cs-auto-translation']]]));
Ejemplo n.º 2
0
<?php

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

use cs\Index, cs\User;
$Index = Index::instance();
if (!isset($Index->route_ids[0])) {
    error_code(400);
    return;
}
$User = User::instance();
if (!in_array(AUTOMAIDAN_GROUP, $User->get_groups())) {
    error_code(403);
    return;
}
if (!Events::instance()->check_refuse($Index->route_ids[0])) {
    error_code(500);
}
Ejemplo n.º 3
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\modules\System;

use h, cs\Config, cs\Cache, cs\Index, cs\Language;
$Config = Config::instance();
$L = Language::instance();
$sa = $Config->core['simple_admin_mode'];
Index::instance()->content(h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}(core_input('gzip_compression', 'radio', null, zlib_compression()), core_input('cache_compress_js_css', 'radio'), core_input('put_js_after_body', 'radio'), !$sa ? core_input('inserts_limit', 'number', null, false, 1) : false, !$sa ? core_input('update_ratio', 'number', null, false, 0, 100) : false, [h::{'div#clean_cache'}(), h::{'div#clean_pcache'}()], [h::button($L->clean_settings_cache, Cache::instance()->cache_state() ? ['onMouseDown' => "cs.admin_cache('#clean_cache', '{$Config->base_url()}/api/System/admin/cache/clean_cache');"] : ['disabled']), h::button($L->clean_scripts_styles_cache, $Config->core['cache_compress_js_css'] ? ['onMouseDown' => "cs.admin_cache('#clean_pcache', '{$Config->base_url()}/api/System/admin/cache/clean_pcache');"] : ['disabled'])]));
Ejemplo n.º 4
0
 *  ['name'	=> <i>module_name</i>]<br>
 *
 *  admin/System/components/modules/enable<br>
 *  ['name'	=> <i>module_name</i>]<br>
 *
 *  admin/System/components/modules/disable<br>
 *  ['name'	=> <i>module_name</i>]
 */
namespace cs\modules\System;

use h, cs\Config, cs\Core, cs\Index, cs\Language, cs\Page, cs\Trigger, cs\User;
$Config = Config::instance();
$L = Language::instance();
$Page = Page::instance();
$User = User::instance();
$a = Index::instance();
$rc = $Config->route;
$a->buttons = false;
$show_modules = true;
if (isset($rc[2]) && !empty($rc[2]) && (in_array($rc[2], ['update_system', 'remove']) || (isset($rc[3], $Config->components['modules'][$rc[3]]) || isset($rc[3]) && $rc[2] == 'install' && $rc[3] == 'upload'))) {
    switch ($rc[2]) {
        case 'install':
            if ($rc[3] == 'upload' && isset($_FILES['upload_module']) && $_FILES['upload_module']['tmp_name']) {
                switch ($_FILES['upload_module']['error']) {
                    case UPLOAD_ERR_INI_SIZE:
                    case UPLOAD_ERR_FORM_SIZE:
                        $Page->warning($L->file_too_large);
                        break;
                    case UPLOAD_ERR_NO_TMP_DIR:
                        $Page->warning($L->temporary_folder_is_missing);
                        break;
Ejemplo n.º 5
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\modules\System;

use h, cs\Config, cs\Index, cs\Language;
$Config = Config::instance();
$L = Language::instance();
$sa = $Config->core['simple_admin_mode'];
Index::instance()->content(h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}(core_input('site_mode', 'radio'), core_input('closed_title'), core_textarea('closed_text', 'SIMPLE_EDITOR'), core_input('title_delimiter'), core_input('title_reverse', 'radio'), core_textarea('footer_text', 'SIMPLE_EDITOR'), core_input('show_footer_info', 'radio'), core_input('show_tooltips', 'radio', false), core_input('og_support', 'radio'), core_input('simple_admin_mode', 'radio'), !$sa ? [$L->debug, [h::{'table tr| td'}(core_input('show_db_queries', 'radio'), core_input('show_cookies', 'radio')), ['class' => 'cs-padding-left']]] : false, !$sa ? [h::info('routing'), h::{'table.cs-table-borderless tr| td'}([h::info('routing_in'), h::info('routing_out')], [h::textarea($Config->routing['in'], ['name' => 'routing[in]']), h::textarea($Config->routing['out'], ['name' => 'routing[out]'])])] : false, !$sa ? [h::info('replace'), h::{'table.cs-table-borderless tr| td'}([h::info('replace_in'), h::info('replace_out')], [h::textarea($Config->replace['in'], ['name' => 'replace[in]']), h::textarea($Config->replace['out'], ['name' => 'replace[out]'])])] : false));
Ejemplo n.º 6
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\modules\System;

use h, cs\Config, cs\Index, cs\Language;
$Config = Config::instance();
$L = Language::instance();
Index::instance()->content(h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}(core_input('session_expire', 'number', null, false, 1, false, $L->seconds), core_input('online_time', 'number', null, false, 1, false, $L->seconds), [h::info('sign_in_attempts_block_count'), h::{'input[type=number]'}(['name' => 'core[sign_in_attempts_block_count]', 'value' => $Config->core['sign_in_attempts_block_count'], 'min' => 0, 'onChange' => "if (\$(this).val() == 0) { \$('.cs-sign-in-attempts-block-count').hide(); } else { \$('.cs-sign-in-attempts-block-count').show(); }"])], [core_input('sign_in_attempts_block_time', 'number', null, false, 1, false, $L->seconds), ['style' => $Config->core['sign_in_attempts_block_count'] == 0 ? 'display: none;' : '', 'class' => 'cs-sign-in-attempts-block-count']], core_input('remember_user_ip', 'radio'), core_input('password_min_length', 'number', null, false, 4), core_input('password_min_strength', 'range', null, false, 0, 7), [h::info('allow_user_registration'), h::{'input[type=radio]'}(['name' => 'core[allow_user_registration]', 'checked' => $Config->core['allow_user_registration'], 'value' => [0, 1], 'in' => [$L->off, $L->on], 'onchange' => ["\$('.cs-allow-user-registration').hide();", "\$('.cs-allow-user-registration').show();" . "if (!\$('.cs-allow-user-registration input[value=1]').prop('checked')) { \$('.cs-require-registration-confirmation').hide(); }"]])], [[h::info('require_registration_confirmation'), h::{'input[type=radio]'}(['name' => 'core[require_registration_confirmation]', 'checked' => $Config->core['require_registration_confirmation'], 'value' => [0, 1], 'in' => [$L->off, $L->on], 'onchange' => ["\$('.cs-require-registration-confirmation').hide();", "\$('.cs-require-registration-confirmation').show();"]])], ['style' => $Config->core['allow_user_registration'] == 0 ? 'display: none;' : '', 'class' => 'cs-allow-user-registration']], [core_input('registration_confirmation_time', 'number', null, false, 1, false, $L->days), ['style' => $Config->core['allow_user_registration'] == 1 && $Config->core['require_registration_confirmation'] == 1 ? '' : 'display: none;', 'class' => 'cs-allow-user-registration cs-require-registration-confirmation']], [core_input('auto_sign_in_after_registration', 'radio'), ['style' => $Config->core['allow_user_registration'] == 1 && $Config->core['require_registration_confirmation'] == 1 ? '' : 'display: none;', 'class' => 'cs-allow-user-registration cs-require-registration-confirmation']], core_textarea('rules', 'SIMPLE_EDITOR')));
Ejemplo 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\modules\System;

use h, cs\Config, cs\Index;
$Config = Config::instance();
$timezones = get_timezones_list();
$sa = $Config->core['simple_admin_mode'];
Index::instance()->content(h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}(core_input('name', 'text', 'site_name'), !$sa ? core_textarea('url') : false, !$sa ? core_textarea('cookie_domain') : false, !$sa ? core_textarea('cookie_path') : false, !$sa ? core_input('cookie_prefix') : false, [h::info('timezone'), h::select(['in' => array_keys($timezones), 'value' => array_values($timezones)], ['name' => 'core[timezone]', 'selected' => $Config->core['timezone'], 'size' => 7])], core_input('admin_email', 'email')));
Ejemplo n.º 8
0
 /**
  * Processing of template, substituting of content, preparing for the output
  *
  * @return Page
  */
 protected function prepare()
 {
     $Config = Config::instance(true);
     /**
      * Loading of template
      * Loading of CSS and JavaScript
      * Getting user information
      */
     $this->get_template()->add_includes_on_page()->get_header_info();
     /**
      * Forming page title
      */
     foreach ($this->Title as $i => $v) {
         if (!trim($v)) {
             unset($this->Title[$i]);
         } else {
             $this->Title[$i] = trim($v);
         }
     }
     if ($Config) {
         $this->Title = $Config->core['title_reverse'] ? array_reverse($this->Title) : $this->Title;
         $this->Title = implode($Config->core['title_delimiter'], $this->Title);
     } else {
         $this->Title = $this->Title[0];
     }
     /**
      * Core JS
      */
     if ($Config) {
         $Index = Index::instance();
         $User = User::instance();
         $this->js_internal('window.cs	= ' . _json_encode(['base_url' => $Config->base_url(), 'current_base_url' => $Config->base_url() . '/' . (defined('IN_ADMIN') && IN_ADMIN ? 'admin/' : '') . MODULE, 'public_key' => Core::instance()->public_key, 'module' => MODULE, 'in_admin' => (int) (defined('IN_ADMIN') && IN_ADMIN), 'is_admin' => (int) $User->admin(), 'is_user' => (int) $User->user(), 'is_guest' => (int) $User->guest(), 'debug' => (int) $User->guest(), 'cookie_prefix' => $Config->core['cookie_prefix'], 'cookie_domain' => $Config->core['cookie_domain'][$Config->server['mirror_index']], 'cookie_path' => $Config->core['cookie_path'][$Config->server['mirror_index']], 'protocol' => $Config->server['protocol'], 'route' => $Config->route, 'route_path' => $Index->route_path, 'route_ids' => $Index->route_ids]) . ';', 'code', true);
         if ($User->guest()) {
             $this->js('cs.rules_text = ' . _json_encode(get_core_ml_text('rules')) . ';', 'code');
         }
         if (!$Config->core['cache_compress_js_css']) {
             $this->js('cs.Language = ' . _json_encode(Language::instance()) . ';', 'code');
         }
     }
     /**
      * Forming <head> content
      */
     $this->core_css[0] = implode('', array_unique($this->core_css[0]));
     $this->core_css[1] = implode('', array_unique($this->core_css[1]));
     $this->css[0] = implode('', array_unique($this->css[0]));
     $this->css[1] = implode('', array_unique($this->css[1]));
     $this->core_js[0] = implode('', array_unique($this->core_js[0]));
     $this->core_js[1] = implode('', array_unique($this->core_js[1]));
     $this->js[0] = implode('', array_unique($this->js[0]));
     $this->js[1] = implode('', array_unique($this->js[1]));
     if (file_exists(THEMES . "/{$this->theme}/{$this->color_scheme}/img/favicon.png")) {
         $favicon = "themes/{$this->theme}/{$this->color_scheme}/img/favicon.png";
     } elseif (file_exists(THEMES . "/{$this->theme}/{$this->color_scheme}/img/favicon.ico")) {
         $favicon = "themes/{$this->theme}/{$this->color_scheme}/img/favicon.ico";
     } elseif (file_exists(THEMES . "/{$this->theme}/img/favicon.png")) {
         $favicon = "themes/{$this->theme}/img/favicon.png";
     } elseif (file_exists(THEMES . "/{$this->theme}/img/favicon.ico")) {
         $favicon = "themes/{$this->theme}/img/favicon.ico";
     } else {
         $favicon = 'favicon.ico';
     }
     $this->Head = h::title($this->Title) . h::meta(['charset' => 'utf-8'], $this->Description ? ['name' => 'description', 'content' => $this->Description] : false, ['name' => 'generator', 'content' => base64_decode('Q2xldmVyU3R5bGUgQ01TIGJ5IE1va3J5bnNreWkgTmF6YXI=')], defined('ADMIN') && ADMIN || defined('API') && API ? ['name' => 'robots', 'content' => 'noindex,nofollow'] : false) . h::base($Config ? ['href' => $Config->base_url() . '/'] : false) . $this->Head . h::link([['rel' => 'shortcut icon', 'href' => $favicon]], $this->link ?: false) . $this->core_css[0] . $this->css[0] . h::style($this->core_css[1] . $this->css[1] ?: false) . h::script($this->core_js[1] . $this->js[1]);
     if ($Config->core['put_js_after_body']) {
         $this->post_Body .= $this->core_js[0] . $this->js[0];
     } else {
         $this->Head .= $this->core_js[0] . $this->js[0];
     }
     /**
      * Generation of Open Graph protocol information
      */
     $this->og_generation();
     /**
      * Getting footer information
      */
     $this->get_footer();
     /**
      * Menu generation
      */
     $Index = Index::instance();
     if (!$this->main_menu && $Index->main_menu) {
         $this->main_menu = h::{'li| a'}($Index->main_menu);
     }
     if ($Index->main_sub_menu) {
         if (!$this->main_sub_menu) {
             foreach ($Index->main_sub_menu as $item) {
                 if (isset($item[1], $item[1]['class']) && $item[1]['class'] == 'uk-active') {
                     if ($Index->main_menu_more) {
                         $item[0] .= ' ' . h::icon('caret-down');
                     }
                     $item[1]['class'] = trim(str_replace('uk-active', '', $item[1]['class']));
                     $this->main_sub_menu .= h::{'li.uk-active[data-uk-dropdown=]'}(h::a($item) . ($Index->main_menu_more ? h::{'div.uk-dropdown.uk-dropdown-small ul.uk-nav.uk-nav-dropdown li| a'}($Index->main_menu_more) : ''));
                 } else {
                     $this->main_sub_menu .= h::{'li a'}($item);
                 }
             }
         }
     } elseif (!$this->main_menu && $Index->main_menu_more) {
         $this->main_menu = h::{'li| a'}($Index->main_menu_more);
     }
     /**
      * Substitution of information into template
      */
     $this->Html = str_replace(['<!--pre_Html-->', '<!--head-->', '<!--pre_Body-->', '<!--header-->', '<!--main-menu-->', '<!--main-sub-menu-->', '<!--main-menu-more-->', '<!--user-avatar-image-->', '<!--header_info-->', '<!--left_blocks-->', '<!--top_blocks-->', '<!--content-->', '<!--bottom_blocks-->', '<!--right_blocks-->', '<!--footer-->', '<!--post_Body-->', '<!--post_Html-->'], [$this->pre_Html, h::level($this->Head, $this->level['Head']), h::level($this->pre_Body, $this->level['pre_Body']), h::level($this->Header, $this->level['Header']), h::level($this->main_menu, $this->level['main_menu']), h::level($this->main_sub_menu, $this->level['main_sub_menu']), h::level($this->main_menu_more, $this->level['main_menu_more']), $this->user_avatar_image, h::level($this->header_info, $this->level['header_info']), h::level($this->Left, $this->level['Left']), h::level($this->Top, $this->level['Top']), h::level($this->Content, $this->level['Content']), h::level($this->Bottom, $this->level['Bottom']), h::level($this->Right, $this->level['Right']), h::level($this->Footer, $this->level['Footer']), h::level($this->post_Body, $this->level['post_Body']), $this->post_Html], $this->Html);
     return $this;
 }
Ejemplo n.º 9
0
<?php

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

use cs\Index;
$Events = Events::instance();
$event = $Events->get(Index::instance()->route_ids[0]);
if (!$event) {
    error_code(404);
    return;
}
if (!isset($event['user'])) {
    error_code(403);
    return;
}
if (!$Events->del($event['id'])) {
    error_code(500);
}
Ejemplo n.º 10
0
<?php

/**
 * @package		Plupload
 * @category	modules
 * @author		Moxiecode Systems AB
 * @author		Nazar Mokrynskyi <*****@*****.**> (integration with CleverStyle CMS)
 * @copyright	Moxiecode Systems AB
 * @license		GNU GPL v2, see license.txt
 */
namespace cs;

use h;
if (isset($_POST['edit_settings'], $_POST['max_file_size']) && $_POST['edit_settings'] == 'save') {
    $module_data = Config::instance()->module('Plupload');
    $module_data->max_file_size = xap($_POST['max_file_size']);
    $module_data->confirmation_time = (int) $_POST['confirmation_time'];
    Index::instance()->save(true);
}
Page::instance()->main_sub_menu = h::{'li.uk-active a'}('Plupload', ['href' => 'admin/Plupload']);
Ejemplo n.º 11
0
 * @package		Static Pages
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\Static_pages;

use h, cs\Config, cs\Index, cs\Page;
$Config = Config::instance();
$Static_pages = Static_pages::instance();
$page = $Static_pages->get(HOME ? $Static_pages->get_structure()['pages']['index'] : $Config->route[0]);
$Page = Page::instance();
if ($page['interface']) {
    if (!HOME) {
        Index::instance()->title_auto = false;
        $Page->title($page['title']);
    }
    $Page->Description = description($page['content']);
    if (HOME) {
        $Page->canonical_url($Config->base_url());
    } else {
        $category = $page['category'];
        $canonical_url = [];
        while ($category) {
            $category = $Static_pages->get_category($category);
            $canonical_url[] = $category['path'];
            $category = $category['parent'];
        }
        unset($category);
        $canonical_url[] = $page['path'];
Ejemplo n.º 12
0
     */
    if (_require_once($file = CLASSES . "/{$namespace}/{$class_name}.php", false) || _require_once($file = THIRDPARTY . "/{$namespace}/{$class_name}.php", false) || _require_once($file = TRAITS . "/{$namespace}/{$class_name}.php", false) || _require_once($file = ENGINES . "/{$namespace}/{$class_name}.php", false) || _require_once($file = MODULES . "/../{$namespace}/{$class_name}.php", false)) {
        $cache[$class] = realpath($file);
        file_put_json(CACHE . '/classes_autoloading', $cache);
        return true;
    }
    return false;
}, true, true);
/**
 * Correct termination
 */
register_shutdown_function(function () {
    if (!class_exists('\\cs\\Core', false)) {
        return;
    }
    Index::instance(true)->__finish();
    Page::instance()->__finish();
    User::instance(true)->__finish();
});
/**
 * Enable of errors processing
 */
function errors_on()
{
    error_reporting(defined('DEBUG') && DEBUG ? E_ALL : E_ERROR | E_WARNING | E_PARSE);
    if (defined('CS_ERROR_HANDLER') && CS_ERROR_HANDLER && class_exists('\\cs\\Error', false)) {
        Error::instance()->error = true;
    }
}
/**
 * Disabling of errors processing
Ejemplo n.º 13
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\modules\System;

use h, cs\Config, cs\Index, cs\Language;
$Config = Config::instance();
$L = Language::instance();
Index::instance()->content(h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}([[h::info('smtp'), h::{'input[type=radio]'}(['name' => 'core[smtp]', 'checked' => $Config->core['smtp'], 'value' => [0, 1], 'in' => [$L->off, $L->on], 'OnClick' => ["\$('#smtp_form').parent().parent().hide();", "\$('#smtp_form').parent().parent().show();"]])], [['', h::{'table#smtp_form tr'}(h::td(core_input('smtp_host')), h::td(core_input('smtp_port')), h::td([h::info('smtp_secure'), h::{'input[type=radio]'}(['name' => 'core[smtp_secure]', 'checked' => $Config->core['smtp_secure'], 'value' => ['', 'ssl', 'tls'], 'in' => [$L->off, 'SSL', 'TLS']])]), h::td([$L->smtp_auth, h::{'input[type=radio]'}(['name' => 'core[smtp_auth]', 'checked' => $Config->core['smtp_auth'], 'value' => [0, 1], 'in' => [$L->off, $L->on], 'OnClick' => ["\$('#smtp_user, #smtp_password').hide();", "\$('#smtp_user, #smtp_password').show();"]])]), [h::td(core_input('smtp_user')), ['style' => (!$Config->core['smtp_auth'] ? 'display: none;' : '') . ' padding-left: 20px;', 'id' => 'smtp_user']], [h::td(core_input('smtp_password')), ['style' => !$Config->core['smtp_auth'] ? 'display: none;' : '', 'id' => 'smtp_password']])], ['style' => !$Config->core['smtp'] ? 'display: none; ' : '']], core_input('mail_from'), core_input('mail_from_name'), core_textarea('mail_signature', 'SIMPLE_EDITOR')]));
Ejemplo n.º 14
0
 * @category	modules
 * @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.º 15
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)])]));