</div> <?php if (!empty($profile['status'])) { ?> <div class="small bold colored"><?php echo $profile['status']; ?> </div> <?php } ?> <?php if ($profile['lastVisit'] < time() - 300) { ?> <div><?php echo _s('Last visit') . ': ' . Includes\Functions::displayDate($profile['lastVisit']); ?> </div> <?php } ?> <?php if ($rights) { ?> <div class="small inline margin"><?php echo $profile['userAgent']; ?> </div> <div class="small"> <?php if ($proxy) {
* 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; $app = App::getInstance(); $user = $app->user()->get(); $form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]); if ($user->rights >= 7 || $user->nickChanged < time() - Config::$usrChangeNicknamePeriod * 86400) { $form->title(_m('Change Nickname'))->element('text', 'nickname', ['label' => _m('New Nickname'), 'maxlength' => 20, 'required' => true])->element('text', 'repeat', ['label' => _m('Repeat Nickname'), 'maxlength' => 20, 'description' => _s('Min. 2, Max. 20 Characters.<br>Allowed letters are Cyrillic and Latin alphabet, numbers, spaces and punctuation - = @ ! ? ~ . _ ( ) [ ] *') . '<br/>' . _m('Please note that while changing the nickname is changing your Login on the site.<br>The next change of nickname is allowed through') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _sp('Day', 'Days', Config::$usrChangeNicknamePeriod) . '.', 'required' => true])->element('password', 'password', ['label' => _m('Your Password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>')->validate('nickname', 'lenght', ['min' => 2, 'max' => 20])->validate('repeat', 'compare', ['compare_field' => 'nickname']); } else { $form->html('<div class="alert alert-danger">' . '<strong>' . _m('Nickname can not change more than once a') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _sp('Day', 'Days', Config::$usrChangeNicknamePeriod) . '</strong><br/><br/>' . _m('You have already changed their nickname:') . ' ' . Includes\Functions::displayDate($user->nickChanged) . '<br/>' . _m('Next time will be able to change:') . ' ' . Includes\Functions::displayDate($user->nickChanged + Config::$usrChangeNicknamePeriod * 86400) . '</div>')->html('<a class="btn btn-primary" href="../">' . _s('Back') . '</a>'); } if ($form->process() === true) { $valid = $app->user()->validate(); // Проверяем Ник if (!$valid->checkNicknameChars($form->output['nickname'])) { // Обнаружены запрещенные символы $form->setError('nickname', _s('Invalid characters')); } elseif (!$valid->checkNicknameCharsets($form->output['nickname'])) { // Обнаружены символы из разных языков $form->setError('nickname', _s('It is forbidden to use characters of different languages')); } elseif (ctype_digit($form->output['nickname']) && !Config::$usrNicknameDigitsOnly) { // Ник состоит только из цифр $form->setError('nickname', _s('Nicknames consisting only of numbers are prohibited')); } elseif (!$valid->checkNicknameRepeatedChars($form->output['nickname'])) { // Обнаружены повторяющиеся символыь (более 3-х подряд)
<?php } ?> </ul> <h3><?php echo _s('Total'); ?> : <?php echo $this->total; ?> </h3> <?php if ($this->total > $config->pageSize) { ?> <?php echo Includes\Functions::displayPagination($this->uri . '?', App::vars()->start, $this->total, $config->pageSize); ?> <?php } ?> <?php } else { ?> <div class="content box padding text-center"> <?php echo _s('Only for registered users'); ?> </div> <?php } ?>
if ($form->process() === true) { $cache = []; $smilies = glob(ROOT_PATH . 'assets' . DS . 'smilies' . DS . '*' . DS . '*.{gif,jpg,png}', GLOB_BRACE); foreach ($smilies as $val) { $file = basename($val); $name = explode(".", $file); $parent = basename(dirname($val)); $image = '<img src="' . App::request()->getBaseUrl() . 'assets/smilies/' . $parent . '/' . $file . '" alt="" />'; if ($parent == '_admin') { $cache['adm_s'][] = '/:' . preg_quote($name[0]) . ':/'; $cache['adm_r'][] = $image; $cache['adm_s'][] = '/:' . preg_quote(Includes\Functions::translit($name[0])) . ':/'; $cache['adm_r'][] = $image; } elseif ($parent == '_simply') { $cache['usr_s'][] = '/:' . preg_quote($name[0]) . '/'; $cache['usr_r'][] = $image; } else { $cache['usr_s'][] = '/:' . preg_quote($name[0]) . ':/'; $cache['usr_r'][] = $image; $cache['usr_s'][] = '/:' . preg_quote(Includes\Functions::translit($name[0])) . ':/'; $cache['usr_r'][] = $image; } } if (file_put_contents(CACHE_PATH . 'smilies.cache', serialize($cache))) { App::view()->save = _dg('The cache is updated'); } else { App::view()->error = _dg('When updating a cache there was a error'); } } App::view()->form = $form->display(); App::view()->setTemplate('smilies.php');
*/ 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; App::redirect(App::request()->getBaseUrl()); } } App::view()->form = $form->display();