<?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'); $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]); $form->title(_dg('Add Article'))->element('text', 'title', ['label' => _g('Title'), 'required' => true])->element('textarea', 'text', ['label' => _g('Text'), 'editor' => true, 'required' => true])->element('checkbox', 'comments', ['label_inline' => _dg('Enable comments'), 'checked' => true])->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>'); $form->validate('title', 'lenght', ['min' => 3, 'max' => 100])->validate('text', 'lenght', ['min' => 3]); if ($form->process() === true) { $stmt = App::db()->prepare("\n INSERT INTO `news` SET\n `time` = ?,\n `author` = ?,\n `author_id` = ?,\n `title` = ?,\n `text` = ?,\n `comm_enable` = ?\n "); $user = App::user()->get(); $stmt->execute([time(), $user->nickname, $user->id, App::filter($form->output['title'])->specialchars(), App::purify($form->output['text']), $form->output['comments']]); $user->lastpost = time(); $user->save(); App::redirect('../'); } App::view()->form = $form->display(); App::view()->setTemplate('edit_form.php');
* @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');
* * @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; $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]); if (Config::$usrRegAllow) { $form->title('TMP')->element('text', 'nickname', ['label' => _g('Choose Nickname'), 'description' => _g('Min. 2, Max. 20 Characters.<br>Allowed letters are Cyrillic and Latin alphabet, numbers, spaces and punctuation - = @ ! ? ~ . _ ( ) [ ] *'), 'required' => true]); if (Config::$usrRegEmail) { $form->element('text', 'email', ['label' => _g('Your Email'), 'description' => _g('Please correctly specify your email address. This address will be sent a confirmation code to your registration.'), 'required' => true]); } $form->element('password', 'newpass', ['label' => _g('Password'), 'required' => true])->element('password', 'newconf', ['label' => _g('Repeat password'), 'description' => _g('The password length min. 3 characters'), 'required' => true])->element('radio', 'sex', ['label' => _g('Gender'), 'checked' => 'm', 'items' => ['m' => '<i class="male lg fw"></i>' . _g('Male'), 'w' => '<i class="female lg fw"></i>' . _g('Female')]])->divider(8)->captcha()->element('text', 'captcha', ['label_inline' => _g('Verification code'), 'class' => 'small', 'maxlenght' => 5, 'reset_value' => ''])->divider()->element('submit', 'submit', ['value' => _g('Sign Up'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="' . App::request()->getBaseUrl() . '/login/">' . _g('Cancel') . '</a>')->validate('captcha', 'captcha'); if (Config::$usrRegEmail) { $form->validate('email', 'lenght', ['min' => 5, 'max' => 50])->validate('email', 'email'); } $form->validate('nickname', 'lenght', ['min' => 2, 'max' => 20])->validate('nickname', 'nickname')->validate('newpass', 'lenght', ['continue' => false, 'min' => 3])->validate('newconf', 'compare', ['compare_field' => 'newpass', 'error' => _g("Passwords don't coincide")])->validate('nickname', 'nickoccupied', ['valid' => true]); if ($form->process() === true) { $token = Includes\Functions::generateToken(); $stmt = App::db()->prepare("\n INSERT INTO `user__` SET\n `nickname` = ?,\n `password` = ?,\n `token` = ?,\n `email` = ?,\n `rights` = 0,\n `level` = ?,\n `sex` = ?,\n `join_date` = ?,\n `last_visit` = ?,\n `about` = ?,\n `reputation` = ?\n "); $stmt->execute([$form->output['nickname'], password_hash($form->output['newpass'], PASSWORD_DEFAULT), $token, Config::$usrRegEmail ? $form->output['email'] : '', Config::$usrRegAllow && !Config::$usrRegModeration && !Config::$usrRegEmail ? 1 : 0, $form->output['sex'], time(), time(), '', '']); //TODO: Добавить подтверждение по Email //TODO: Добавить отправку Welcome Message //TODO: Добавить страницу с приветствием // Запускаем пользователя на сайт $userid = App::db()->lastInsertId(); setcookie('user_id', $userid, time() + 3600 * 24 * 31, '/'); setcookie('token', $token, time() + 3600 * 24 * 31, '/'); $_SESSION['user_id'] = $userid; $_SESSION['token'] = $token;