Example #1
0
 public function getView()
 {
     $o = $this;
     h::div(array('class' => 'clearfix'), function () use($o) {
         h::label(array('for' => 'username'), 'API Username');
         h::div(array('class' => 'input'), function () use($o) {
             h::input(array('class' => 'span6', 'type' => 'text', 'name' => 'username', 'value' => $o->getUsername()));
         });
     });
     h::div(array('class' => 'clearfix'), function () use($o) {
         h::label(array('for' => 'key'), 'API Secret');
         h::div(array('class' => 'input'), function () use($o) {
             h::input(array('class' => 'span6', 'type' => 'text', 'name' => 'key', 'value' => $o->getKey()));
         });
     });
 }
Example #2
0
function core_input($item, $type = 'text', $info_item = null, $disabled = false, $min = false, $max = false, $post_text = '')
{
    $Config = Config::instance();
    $L = Language::instance();
    if ($type != 'radio') {
        switch ($item) {
            default:
                $value = $Config->core[$item];
                break;
            case 'name':
            case 'closed_title':
            case 'mail_from_name':
                $value = get_core_ml_text($item);
        }
        return [$info_item !== false ? h::info($info_item ?: $item) : $L->{$item}, h::input(['name' => "core[{$item}]", 'value' => $value, 'min' => $min, 'max' => $max, 'type' => $type, $disabled ? 'disabled' : '']) . $post_text];
    } else {
        return [$info_item !== false ? h::info($info_item ?: $item) : $L->{$item}, h::input(['name' => "core[{$item}]", 'checked' => $Config->core[$item], 'value' => [0, 1], 'in' => [$L->off, $L->on], 'type' => $type])];
    }
}
Example #3
0
 * @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\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']]]));
Example #4
0
 /**
  *
  */
 public function toHtml(array $params = array(), array $innerCallbacks = array())
 {
     require_once 'lib/lib.htmlgen.php';
     $o = $this;
     //h::li(function () use ($o, $params, $innerCallbacks) {
     h::li(array('id' => $o->getInternalId()), function () use($o, $params, $innerCallbacks) {
         h::div(array('class' => 'builderElementLine'), function () use($o, $params) {
             h::h3($params['title']);
             /*
                       h::div(array('class' => 'builderElementActionItems'), function() use ($o) {
                         if ($o->isEditable()) {
                           h::a('Details', '#', array('class' => 'btn details'));
                         }
                         if ($o->isDeletable()) {
                           h::a('Delete', '#', array('class' => 'delete btn danger'));
                         }
                       });*/
         });
         h::div(array('class' => 'popover builderElementPopover right'), function () use($o, $params, $innerCallbacks) {
             h::div(array('class' => 'arrow'));
             h::div(array('class' => 'inner'), function () use($o, $params, $innerCallbacks) {
                 h::h3(array('class' => 'title'), function () use($o, $params) {
                     h::div(array('class' => 'actualTitle'), 'Details for ' . $params['title']);
                 });
                 h::div(array('class' => 'content'), function () use($o, $innerCallbacks) {
                     h::form(array('class' => 'form', 'action' => ''), function () use($o, $innerCallbacks) {
                         h::fieldset(function () use($o, $innerCallbacks) {
                             $params = array('help' => "Uncheck this if you don't want this task to execute at all.", 'label' => 'Active?', 'name' => 'active', 'checked' => $o->isActive());
                             $o->getHtmlInputCheckbox($params);
                             foreach ($innerCallbacks as $cb) {
                                 //
                                 // Filesets are special cases, because we might need to
                                 // iterate on more than one (in the future)
                                 //
                                 if ($cb['cb'] == 'getFilesets') {
                                     if ($o->getFilesets()) {
                                         $filesets = $o->getFilesets();
                                         foreach ($filesets as $fileset) {
                                             $fileset->toHtml();
                                         }
                                     }
                                     //
                                     // Normal to-HTML callbacks
                                     //
                                 } else {
                                     call_user_func(array($o, $cb['cb']), $cb);
                                 }
                             }
                             h::div(array('class' => 'actions'), function () {
                                 h::input(array('type' => 'submit', 'class' => 'btn', 'value' => 'Nothing to save', 'disabled' => 'disabled'));
                                 h::button(array('class' => 'btn delete danger'), 'Delete');
                             });
                         });
                     });
                 });
             });
         });
     });
     //});
 }
Example #5
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.");
             });
         });
     });
 }
Example #6
0
 switch ($rc[2]) {
     case 'add':
         $a->apply_button = false;
         $a->cancel_button_back = true;
         $Page->title($L->adding_a_group);
         $a->content(h::{'p.lead.cs-center'}($L->adding_a_group) . h::{'table.cs-table-borderless.cs-center-all tr'}(h::{'thead tr th'}($L->group_name, $L->description), h::{'tbody tr td'}(h::{'input[name=group[title]]'}(), h::{'input[name=group[description]]'}())));
         break;
     case 'edit':
         if (!isset($rc[3])) {
             break;
         }
         $a->apply_button = false;
         $a->cancel_button_back = true;
         $group_data = $Group->get($rc[3]);
         $Page->title($L->editing_of_group($group_data['title']));
         $a->content(h::{'p.lead.cs-center'}($L->editing_of_group($group_data['title'])) . h::{'table.cs-table-borderless.cs-center-all tr'}(h::{'thead tr th'}('&nbsp;id&nbsp;', $L->group_name, $L->description, 'data'), h::{'tbody tr td'}($rc[3], h::input(['name' => 'group[title]', 'value' => $group_data['title']]), h::input(['name' => 'group[description]', 'value' => $group_data['description']]), h::{'textarea[name=group[data]]'}($group_data['data']))) . h::{'input[type=hidden]'}(['name' => 'group[id]', 'value' => $rc[3]]));
         break;
     case 'delete':
         if (!isset($rc[3])) {
             break;
         }
         $a->buttons = false;
         $a->cancel_button_back = true;
         $group = $Group->get($rc[3]);
         $Page->title($L->deletion_of_group($group['title']));
         $a->content(h::{'p.lead.cs-center'}($L->sure_delete_group($group['title'])) . h::{'input[type=hidden]'}(['name' => 'id', 'value' => $rc[3]]) . h::{'button[type=submit]'}($L->yes));
         $Page->warning($L->changing_settings_warning);
         break;
     case 'permissions':
         if (!isset($rc[3])) {
             break;
Example #7
0
     break;
 case 'edit':
     if (!isset($rc[3], $Config->components['blocks'][$rc[3]])) {
         break;
     }
     $form = false;
     $a->apply_button = false;
     $a->cancel_button_back = true;
     $a->form_atributes[] = 'formnovalidate';
     $block =& $Config->components['blocks'][$rc[3]];
     $Page->title($L->editing_a_block(get_block_title($rc[3])));
     $a->content(h::{'p.lead.cs-center'}($L->editing_a_block(get_block_title($rc[3]))) . 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);
     }, ['block_title', 'block_active', 'block_template', 'block_start', 'block_expire']), array_map(function ($in) {
         return h::td($in);
     }, [h::input(['name' => 'block[title]', 'value' => get_block_title($rc[3])]), h::{'div input[type=radio]'}(['name' => 'block[active]', 'checked' => $block['active'], 'value' => [1, 0], 'in' => [$L->yes, $L->no]]), h::select(['in' => _mb_substr(get_files_list(TEMPLATES . '/blocks', '/^block\\..*?\\.(php|html)$/i', 'f'), 6)], ['name' => 'block[template]', 'selected' => $block['template'], 'size' => 5]), h::{'input[type=datetime-local]'}(['name' => 'block[start]', 'value' => date('Y-m-d\\TH:i', $block['start'] ?: TIME)]), h::{'input[type=radio]'}(['name' => 'block[expire][state]', 'checked' => $block['expire'] != 0, 'value' => [0, 1], 'in' => [$L->never, $L->as_specified]]) . h::br(2) . h::{'input[type=datetime-local]'}(['name' => 'block[expire][date]', 'value' => date('Y-m-d\\TH:i', $block['expire'] ?: TIME)])])]), $block['type'] == 'html' ? h::{'td[colspan=5] textarea.EDITOR'}(get_block_content($rc[3]), ['name' => 'block[html]']) : ($block['type'] == 'raw_html' ? h::{'td[colspan=5] textarea'}(get_block_content($rc[3]), ['name' => 'block[raw_html]']) : '')) . h::{'input[type=hidden]'}([[['name' => 'block[id]', 'value' => $rc[3]]], [['name' => 'mode', 'value' => $rc[2]]]]));
     break;
 case 'permissions':
     if (!isset($rc[3], $Config->components['blocks'][$rc[3]])) {
         break;
     }
     $form = false;
     $a->apply_button = false;
     $a->cancel_button_back = true;
     $permission = Permission::instance()->get(null, 'Block', $Config->components['blocks'][$rc[3]]['index'])[0]['id'];
     $groups = Group::instance()->get_all();
     $groups_content = [];
     foreach ($groups as $group) {
         $group_permission = $User->db()->qfs(["SELECT `value`\n\t\t\t\t\tFROM `[prefix]groups_permissions`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`id`\t\t\t= '%s' AND\n\t\t\t\t\t\t`permission`\t= '%s'", $group['id'], $permission]);
         $groups_content[] = h::th($group['title'], ['data-title' => $group['description']]) . h::{'td input[type=radio]'}(['name' => "groups[{$group['id']}]", 'checked' => $group_permission === false ? -1 : $group_permission, 'value' => [-1, 0, 1], 'in' => [$L->inherited, $L->deny, $L->allow]]);
     }
Example #8
0
     $a->apply_button = false;
     $a->cancel_button_back = true;
     if (!$is_bot) {
         if ($rc[3] == User::GUEST_ID || $rc[3] == User::ROOT_ID) {
             break;
         }
         $user_data = $User->get(['login', 'username', 'email', 'language', 'timezone', 'reg_date', 'reg_ip', 'status', 'block_until', 'last_sign_in', 'last_ip', 'last_online', 'avatar'], $rc[3]);
         $timezones = get_timezones_list();
         $reg_ip = hex2ip($user_data['reg_ip'], 10);
         $last_ip = hex2ip($user_data['last_ip'], 10);
         $Page->title($L->editing_of_user_information($User->username($rc[3])));
         $a->content(h::{'p.lead.cs-center'}($L->editing_of_user_information($User->username($rc[3]))) . h::{'table.cs-table-borderless.cs-center-all tr'}([row('id', $rc[3]), row($L->registration_date, $user_data['reg_date'] ? date($L->_date, $user_data['reg_date']) : $L->undefined), row($L->registration_ip, $reg_ip[0] ? $reg_ip[0] . ($reg_ip[1] ? h::br() . $reg_ip[1] : '') : $L->undefined), row($L->last_sign_in, $user_data['last_sign_in'] ? date($L->_datetime, $user_data['last_sign_in']) : $L->undefined), row($L->last_ip, $last_ip[0] ? $last_ip[0] . ($last_ip[1] ? h::br() . $last_ip[1] : '') : $L->undefined), row($L->last_online, $user_data['last_online'] ? date($L->_datetime, $user_data['last_online']) : $L->undefined), row($L->login, h::input(['name' => 'user[login]', 'value' => $user_data['login']])), row($L->username, h::input(['name' => 'user[username]', 'value' => $user_data['username']])), row($L->email, h::input(['name' => 'user[email]', 'value' => $user_data['email']])), row($L->password_only_for_changing . h::{'icon.cs-show-password.cs-pointer'}('lock'), h::{'input[type=password]'}(['name' => 'user[password]', 'value' => ''])), row($L->language, h::select(['in' => array_merge(["{$L->system_default} ({$Config->core['language']})"], $Config->core['active_languages']), 'value' => array_merge([''], $Config->core['active_languages'])], ['name' => 'user[language]', 'selected' => $user_data['language'], 'size' => 5])), row($L->timezone, h::select(['in' => array_merge(["{$L->system_default} ({$Config->core['timezone']})"], array_keys($timezones)), 'value' => array_merge([''], array_values($timezones))], ['name' => 'user[timezone]', 'selected' => $user_data['timezone'], 'size' => 5])), row($L->status, h::{'input[type=radio]'}(['name' => 'user[status]', 'checked' => $user_data['status'], 'value' => [User::STATUS_NOT_ACTIVATED, User::STATUS_INACTIVE, User::STATUS_ACTIVE], 'in' => [$L->is_not_activated, $L->inactive, $L->active]])), row(h::info('block_until'), h::{'input[type=datetime-local]'}(['name' => 'user[block_until]', 'value' => date('Y-m-d\\TH:i', $user_data['block_until'] ?: TIME)])), row($L->avatar, h::input(['name' => 'user[avatar]', 'value' => $user_data['avatar']]))]) . h::{'input[type=hidden]'}(['name' => 'user[id]', 'value' => $rc[3]]));
     } else {
         $bot_data = $User->get(['login', 'email', 'username'], $rc[3]);
         $Page->title($L->editing_of_bot_information($bot_data['username']));
         $a->content(h::{'p.lead.cs-center'}($L->editing_of_bot_information($bot_data['username'])) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}([[$L->bot_name, h::input(['name' => 'bot[name]', 'value' => $bot_data['username']])], [h::info('bot_user_agent'), h::input(['name' => 'bot[user_agent]', 'value' => $bot_data['login']])], [h::info('bot_ip'), h::input(['name' => 'bot[ip]', 'value' => $bot_data['email']])]]) . h::{'input[type=hidden]'}(['name' => 'bot[id]', 'value' => $rc[3]]));
     }
     break;
 case 'deactivate':
     if ($rc[3] == User::GUEST_ID || $rc[3] == User::ROOT_ID) {
         break;
     }
     $a->buttons = false;
     $a->cancel_button_back = true;
     $user_data = $User->get(['login', 'username'], $rc[3]);
     $a->content(h::{'p.cs-center-all'}($L->{$is_bot ? 'sure_deactivate_bot' : 'sure_deactivate_user'}($user_data['username'] ?: $user_data['login'])) . h::{'input[type=hidden]'}(['name' => 'id', 'value' => $rc[3]]) . h::{'button[type=submit]'}($L->yes));
     break;
 case 'activate':
     if ($rc[3] == User::GUEST_ID || $rc[3] == User::ROOT_ID) {
         break;
     }
Example #9
0
         }
         unset($i, $db);
     }
     $a->action = "admin/System/{$rc['0']}/{$rc['1']}";
     /**
      * @var array $dbsname
      * @var array $dbs
      * @var array $database
      * @var string $name
      */
     $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;
                     }
                 }
             }
         }
Example #10
0
 switch ($rc[2]) {
     case 'add':
         $a->apply_button = false;
         $a->cancel_button_back = true;
         $Page->title($L->adding_permission);
         $a->content(h::{'p.lead.cs-center'}($L->adding_permission) . h::{'table.cs-table-borderless.cs-center-all'}(h::{'thead tr th'}([$L->group, $L->label]) . h::{'tbody tr td'}([h::{'input[name=permission[group]]'}(), h::{'input[name=permission[label]]'}()])));
         break;
     case 'edit':
         if (!isset($rc[3])) {
             break;
         }
         $a->apply_button = false;
         $a->cancel_button_back = true;
         $permission = $Permission->get($rc[3]);
         $Page->title($L->editing_permission("{$permission['group']}/{$permission['label']}"));
         $a->content(h::{'p.lead.cs-center'}($L->editing_permission("{$permission['group']}/{$permission['label']}")) . h::{'table.cs-table-borderless.cs-center-all'}(h::{'thead tr th'}(['&nbsp;id&nbsp;', $L->group, $L->label]) . h::{'tbody tr td'}([$rc[3], h::input(['name' => 'permission[group]', 'value' => $permission['group']]), h::input(['name' => 'permission[label]', 'value' => $permission['label']])])) . h::{'input[type=hidden]'}(['name' => 'permission[id]', 'value' => $rc[3]]));
         $Page->warning($L->changing_settings_warning);
         break;
     case 'delete':
         if (!isset($rc[3])) {
             break;
         }
         $a->buttons = false;
         $a->cancel_button_back = true;
         $permission = $Permission->get($rc[3]);
         $Page->title($L->deletion_of_permission("{$permission['group']}/{$permission['label']}"));
         $a->content(h::{'p.lead.cs-center'}($L->sure_delete_permission("{$permission['group']}/{$permission['label']}")) . h::{'input[type=hidden]'}(['name' => 'id', 'value' => $rc[3]]) . h::{'button[type=submit]'}($L->yes));
         $Page->warning($L->changing_settings_warning);
         break;
 }
 $a->content(h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2]]));
Example #11
0
<?php

/**
 * @package		HybridAuth
 * @category	modules
 * @author		HybridAuth authors
 * @author		Nazar Mokrynskyi <*****@*****.**> (integration with CleverStyle CMS)
 * @copyright	HybridAuth authors
 * @license		MIT License, see license.txt
 */
namespace cs;

use h;
$Config = Config::instance();
$Index = Index::instance();
$L = Language::instance();
$Page = Page::instance();
$providers_config = $Config->module('HybridAuth')->providers;
$providers = file_get_json(MFOLDER . '/../providers.json');
$Page->css('components/modules/HybridAuth/includes/css/admin.css');
$Page->main_sub_menu = h::{'li.uk-active a'}($L->providers_list, ['href' => 'admin/HybridAuth']);
$Index->apply_button = false;
$Index->content(h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr'}(h::{'th info'}('enable_contacts_detection') . h::{'td input[type=radio]'}(['name' => 'enable_contacts_detection', 'checked' => $Config->module('HybridAuth')->enable_contacts_detection, 'value' => [0, 1], 'in' => [$L->off, $L->on]])) . h::{'table.cs-hybrid-auth-providers-table.cs-table.cs-center-all'}(h::{'thead tr th'}([$L->provider, $L->settings, $L->state]) . h::{'tbody tr| td'}(array_map(function ($provider, $pdata) use($L, $providers_config, $Config) {
    $content = '';
    if (isset($pdata['keys'])) {
        foreach ($pdata['keys'] as $key) {
            $content .= h::{'tr td'}([ucfirst($key), h::input(['name' => 'providers[' . $provider . '][keys][' . $key . ']', 'value' => isset($providers_config[$provider], $providers_config[$provider]['keys'][$key]) ? $providers_config[$provider]['keys'][$key] : ''])]);
        }
    }
    return [$L->{$provider}, h::{'table.cs-table-borderless.cs-left-even.cs-right-odd'}($content . (isset($pdata['scope']) ? h::{'tr td'}(['Scope', h::input(['name' => 'providers[' . $provider . '][scope]', 'value' => isset($providers_config[$provider], $providers_config[$provider]['scope']) ? $providers_config[$provider]['scope'] : $pdata['scope']])]) : '') . h::{'tr td.cs-left-all[colspan=2]'}(isset($pdata['info']) ? str_replace(['{base_url}', '{provider}'], [$Config->base_url(), $provider], $pdata['info']) : false)), h::{'input[type=radio]'}(['name' => 'providers[' . $provider . '][enabled]', 'checked' => isset($providers_config[$provider], $providers_config[$provider]['enabled']) ? $providers_config[$provider]['enabled'] : 0, 'value' => [0, 1], 'in' => [$L->off, $L->on]])];
}, array_keys($providers), $providers))));
Example #12
0
 switch ($rc[2]) {
     case 'add':
     case 'edit':
         if ($rc[2] == 'edit' && isset($rc[3])) {
             $storage =& $Config->storage[$rc[3]];
         }
         /**
          * @var array $storage
          */
         $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);
Example #13
0
$Page->title($L->my_profile);
$Page->title($L->settings);
$Index->action = path($L->profile) . '/' . path($L->settings);
switch (isset($Config->route[2]) ? $Config->route[2] : '') {
    default:
        $Index->content(h::p(h::{'a.cs-button'}($L->general, ['href' => "{$Index->action}/" . path($L->general)]) . h::{'a.cs-button'}($L->change_password, ['href' => "{$Index->action}/" . path($L->change_password)])));
        Trigger::instance()->run('System/profile/settings');
        break;
    case 'general':
        $user_data = $User->get($columns);
        unset($columns);
        $timezones = get_timezones_list();
        $row = function ($col1, $col2) {
            return h::th($col1) . h::td($col2);
        };
        $Index->form = true;
        $Index->form_atributes['class'] = 'cs-center';
        $Index->apply_button = false;
        $Index->cancel_button_back = true;
        $Page->title($L->general);
        $Index->content(h::{'p.lead.cs-center'}($L->general_settings) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr'}($row($L->login, h::input(['name' => 'user[login]', 'value' => $user_data['login']])), $row($L->username, h::input(['name' => 'user[username]', 'value' => $user_data['username']])), $row($L->language, h::select(['in' => array_merge([$L->system_default], $Config->core['active_languages']), 'value' => array_merge([''], $Config->core['active_languages'])], ['name' => 'user[language]', 'selected' => $user_data['language'], 'size' => 5])), $row($L->timezone, h::select(['in' => array_merge(["{$L->system_default} ({$Config->core['timezone']})"], array_keys($timezones)), 'value' => array_merge([''], array_values($timezones))], ['name' => 'user[timezone]', 'selected' => $user_data['timezone'], 'size' => 5])), $row($L->avatar, h::input(['name' => 'user[avatar]', 'value' => $user_data['avatar']]))));
        break;
    case 'change_password':
        $Index->form = true;
        $Index->form_atributes['class'] = 'cs-center';
        $Index->buttons = false;
        $Index->cancel_button_back = true;
        $Page->title($L->password_changing);
        $Index->content(h::{'p.lead.cs-center'}($L->password_changing) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr'}(h::th("{$L->current_password} " . h::{'icon#current_password.cs-pointer'}('lock')) . h::td(h::{'input.cs-profile-current-password[type=password]'}()), h::th("{$L->new_password} " . h::{'icon#new_password.cs-pointer'}('lock')) . h::td(h::{'input.cs-profile-new-password[type=password]'}())) . h::{'button.cs-profile-change-password'}($L->change_password));
        break;
}