예제 #1
0
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 *
 * @module      IP WHOIS
 * @author      Oleg (AlkatraZ) Kasyanov <*****@*****.**>
 * @version     v.1.0.0 2015-02-01
 */
defined('MOBICMS') or die('Error: restricted access');
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->infoMessages = false;
$query = App::router()->getQuery();
if (isset($query[0])) {
    $form->input['ip'] = $query[0];
    $form->isSubmitted = true;
    $form->isValid = true;
}
$form->title('IP WHOIS')->element('text', 'ip', ['label' => _s('IP address'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _s('Search'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
//TODO: разобраться с обратной ссылкой
$form->validate('ip', 'ip');
if ($form->process() === true) {
    include_once __DIR__ . '/classes/WhoisClient.php';
    include_once __DIR__ . '/classes/Whois.php';
    include_once __DIR__ . '/classes/IpTools.php';
    $result = (new Whois())->lookup($form->output['ip']);
    $whois = nl2br(implode("\n", $result['rawdata']));
    // Выделяем цветом важные параметры
    $whois = strtr($whois, ['%' => '#', 'inetnum:' => '<span style="color: #c81237"><strong>inetnum:</strong></span>', 'netname:' => '<span style="color: #c81237"><strong>netname:</strong></span>', 'country:' => '<span style="color: #c81237"><strong>country:</strong></span>', 'route:' => '<span style="color: #c81237"><strong>route:</strong></span>', 'org-name:' => '<span style="color: #c81237"><strong>org-name:</strong></span>', 'descr:' => '<span style="color: #26a51d"><strong>descr:</strong></span>', 'address:' => '<span style="color: #26a51d"><strong>address:</strong></span>']);
    $form->divider()->html('<div class="alert alert-neytral"><small>' . $whois . '</small></div>');
}
App::view()->form = $form->display();
App::view()->setTemplate('index.php');
예제 #2
0
<?php

/*
 * mobiCMS Content Management System (http://mobicms.net)
 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
use Config\System as Config;
$uri = App::request()->getUri();
$form = new Mobicms\Form\Form(['action' => $uri]);
$form->title(_g('Registration'))->element('checkbox', 'usrRegAllow', ['label_inline' => _dg('Allow registration'), 'checked' => Config::$usrRegAllow])->element('checkbox', 'usrRegModeration', ['label_inline' => _dg('Enable moderation'), 'checked' => Config::$usrRegModeration])->element('checkbox', 'usrRegEmail', ['label_inline' => _dg('Confirmation by Email'), 'checked' => Config::$usrRegEmail])->element('checkbox', 'usrRegQuarantine', ['label_inline' => _dg('Enable Quarantine'), 'checked' => Config::$usrRegQuarantine]);
if (App::user()->get()->rights == 9) {
    $form->title(_dg('For Users'))->element('checkbox', 'usrChangeSex', ['label_inline' => _dg('Change Sex'), 'checked' => Config::$usrChangeSex])->element('checkbox', 'usrChangeStatus', ['label_inline' => _dg('Change Status'), 'checked' => Config::$usrChangeStatus])->element('checkbox', 'usrUploadAvatars', ['label_inline' => _dg('Upload Avatars'), 'checked' => Config::$usrUploadAvatars])->element('checkbox', 'usrGravatar', ['label_inline' => _dg('Use Gravatar'), 'checked' => Config::$usrGravatar])->element('checkbox', 'usrNicknameDigitsOnly', ['label_inline' => _dg('Allow Nicknames, consisting of digits'), 'checked' => Config::$usrNicknameDigitsOnly])->element('checkbox', 'usrChangeNickname', ['label_inline' => _dg('Allow to change Nickname'), 'checked' => Config::$usrChangeNickname])->element('text', 'usrChangeNicknamePeriod', ['label_inline' => _dg('After how many days?') . ' <span class="note">(0-90)</span>', 'value' => Config::$usrChangeNicknamePeriod, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 0, 'max' => 90]])->title(_dg('For Guests'))->element('checkbox', 'usrViewOnline', ['label_inline' => _dg('Online Lists'), 'checked' => Config::$usrViewOnline])->element('checkbox', 'usrViewUserlist', ['label_inline' => _dg('List of Users'), 'checked' => Config::$usrViewUserlist])->element('checkbox', 'usrViewProfiles', ['label_inline' => _dg('View Profiles'), 'checked' => Config::$usrViewProfiles])->title(_dg('Antiflood'))->element('radio', 'usrFloodMode', ['checked' => Config::$usrFloodMode, 'items' => ['3' => _dg('Day'), '4' => _dg('Night'), '2' => _dg('Autoswitch'), '1' => _dg('Adaptive')]])->element('text', 'usrFloodDay', ['value' => Config::$usrFloodDay, 'class' => 'small', 'label_inline' => _dg('Sec.') . ', ' . _dg('Day') . ' <span class="note">(3-300)</span>', 'limit' => ['type' => 'int', 'min' => 3, 'max' => 300]])->element('text', 'usrFloodNight', ['value' => Config::$usrFloodNight, 'class' => 'small', 'label_inline' => _dg('Sec.') . ', ' . _dg('Night') . ' <span class="note">(3-300)</span>', 'limit' => ['type' => 'int', 'min' => 3, 'max' => 300]]);
}
$form->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>');
if ($form->process() === true) {
    // Записываем настройки
    (new Mobicms\Config\WriteHandler())->write('System', $form->output);
    App::redirect($uri . '?saved');
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');