예제 #1
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;
$app = App::getInstance();
$uri = $app->request()->getUri();
$form = new Mobicms\Form\Form(['action' => $uri]);
$form->title(_m('System Time'))->element('text', 'timeshift', ['value' => Config::$timeshift, 'class' => 'small', 'label_inline' => '<span class="badge badge-green">' . date("H:i", time() + Config::$timeshift * 3600) . '</span> ' . _m('Time Shift') . ' <span class="note">(+ - 12)</span>', 'limit' => ['type' => 'int', 'min' => -12, 'max' => 13]])->title(_m('Upload Files'))->element('text', 'filesize', ['value' => Config::$filesize, 'label_inline' => _m('Max. File size') . ' kB <span class="note">(100-50000)</span>', 'description' => _m('Note that the maximum size of uploaded file may be limited by your PHP settings. Most often the default 2000kb.'), 'class' => 'small', 'limit' => ['type' => 'int', 'min' => 100, 'max' => 50000]])->title(_m('Profiling'))->element('checkbox', 'profilingGeneration', ['checked' => Config::$profilingGeneration, 'label_inline' => _m('Show generation time')])->element('checkbox', 'profilingMemory', ['checked' => Config::$profilingMemory, 'label_inline' => _m('Show used memory')])->title(_m('Site Requisites'))->element('text', 'email', ['value' => Config::$email, 'label' => _m('Site Email')])->element('textarea', 'copyright', ['value' => Config::$copyright, 'label' => _m('Copyright')])->title(_m('SEO Attributes'))->element('text', 'homeTitle', ['value' => Config::$homeTitle, 'style' => 'max-width: none', 'label' => _m('Homepage title'), 'description' => _m('In the search results for keywords, search engines use the page title for the reference to the document. Well written title containing keywords will attract many visitors and increase chances are that the site is visited by many people.')])->element('textarea', 'metaKey', ['value' => Config::$metaKey, 'label' => 'META Keywords', 'description' => _m('Keywords (or phrases) separated by commas. This meta tag search engines use to determine the relevance of links. In forming this tag should be used only the words that are contained in the document. The use of words that are not on the page, is not recommended. The recommended number of words in this tag - no more than ten. In addition,revealed that the breakdown of the tag on a few lines affect the estimate of links by search engines.<br>Max. 250 characters.'), 'limit' => ['type' => 'str', 'max' => 250]])->element('textarea', 'metaDesc', ['value' => Config::$metaDesc, 'label' => 'META Description', 'description' => _m('This tag is used to create a short description of the page, use the search engines to index, as well as to create annotations the extradition request. In the absence of a tag search system gives the first line in the summary of the document or a passage containing the keywords. Displayed after the link in the search pages in search engine. Different search engines charge different rates for the length of the tag. Try to write a small description of 150 characters.<br>Max. 250 characters.'), 'limit' => ['type' => 'str', 'max' => 250]])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('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');
예제 #2
0
                $options['thumbinal'] = App::request()->getBaseUrl() . '/themes/' . $dir . '/theme.png';
                $tpl_list[$dir] = $options;
            }
        }
    }
    ksort($tpl_list);
    return $tpl_list;
}
$themes = getThemesList();
$act = filter_input(INPUT_GET, 'act', FILTER_SANITIZE_STRING);
$mod = filter_input(INPUT_GET, 'mod', FILTER_SANITIZE_STRING);
if ($act == 'set' && isset($themes[$mod])) {
    $theme = $themes[$mod];
    $description = '<br/><dl class="description">' . '<dt class="wide"><img src="' . $themes[$mod]['thumbinal'] . '" alt=""/></dt>' . '<dd>' . '<div class="header">' . $theme['name'] . '</div>' . (!empty($theme['author']) ? '<strong>' . _m('Author') . '</strong>: ' . htmlspecialchars($theme['author']) : '') . (!empty($theme['author_url']) ? '<br/><strong>' . _m('Site') . '</strong>: ' . htmlspecialchars($theme['author_url']) : '') . (!empty($theme['author_email']) ? '<br/><strong>Email</strong>: ' . htmlspecialchars($theme['author_email']) : '') . (!empty($theme['description']) ? '<br/><strong>' . _m('Description') . '</strong>: ' . htmlspecialchars($theme['description']) : '') . '</dd></dl>';
    $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
    $form->title(_m('Choose Skin'))->html($description)->divider()->element('submit', 'submit', ['value' => _m('Choose'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
    if ($form->process() === true) {
        //        $stmt = App::db()->prepare("UPDATE `" . TP . "usr__users` SET `avatar` = ? WHERE `id` = " . App::user()->id);
        //        $stmt->execute([$image]);
        //        $stmt = null;
        //
        //        @unlink(FILES_PATH . 'users' . DS . 'avatar' . DS . Users::$data['id'] . '.jpg');
        //        @unlink(FILES_PATH . 'users' . DS . 'avatar' . DS . Users::$data['id'] . '.gif');
        //
        //        $form->continueLink = App::cfg()->sys->homeurl . 'profile/' . App::user()->id . '/option/avatar/';
        //        $form->successMessage = _d('avatar_applied');
        //        $form->confirmation = true;
        //        App::view()->hideuser = true;
    }
    App::view()->form = $form->display();
    App::view()->setTemplate('option_theme_set.php');
예제 #3
0
/*
 * 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');
define('ROOT_DIR', '.');
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->infoMessages = false;
$form->title(_m('Anti-Spyware'))->element('radio', 'mode', ['checked' => 1, 'items' => ['1' => _m('Scan to the appropriate distribution'), '2' => _m('Snapshot scan'), '3' => _m('Make snapshot')]])->divider()->element('submit', 'submit', ['value' => _s('Run'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
if ($form->process() === true) {
    require_once dirname(__DIR__) . '/classes/Scanner.php';
    $scanner = new Scanner();
    switch ($form->output['mode']) {
        case 1:
            // Сканируем на соответствие дистрибутиву
            $scanner->scan();
            if (count($scanner->modifiedFiles) || count($scanner->missingFiles) || count($scanner->newFiles)) {
                App::view()->modifiedFiles = $scanner->modifiedFiles;
                App::view()->missingFiles = $scanner->missingFiles;
                App::view()->extraFiles = $scanner->newFiles;
                App::view()->errormsg = _m('Distributive inconsistency!');
            } else {
                App::view()->ok = _m('List of files corresponds to the distributive');
            }
예제 #4
0
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
$app = App::getInstance();
$user = $app->user()->get();
$profile = $app->profile();
if ($user->rights == 9 || $user->rights == 7 && $user->rights > $profile->rights) {
    $items = [0 => _m('User'), 3 => _m('Forum Moderator'), 4 => _m('Downloads Moderator'), 5 => _m('Library Moderator'), 6 => _m('Super Modererator')];
    if ($user->rights == 9) {
        $items['7'] = '<i class="exclamation-circle lg"></i> ' . _m('Administrator');
        $items['9'] = '<span class="danger"><i class="exclamation-circle lg"></i> ' . _m('Supervisor') . '</span>';
    }
    $form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]);
    $form->title(_m('Rank'))->element('radio', 'rights', ['checked' => $profile->rights, 'items' => $items])->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>');
    if ($form->process() === true) {
        // Проверяем пароль
        if (!$user->checkPassword($form->output['password'])) {
            $form->setError('password', _s('Invalid password'));
        }
        if ($form->isValid) {
            $profile->offsetSet('rights', intval($form->output['rights']), true);
            $profile->save();
            if ($profile->id == $user->id) {
                $app->redirect('../');
            }
        }
    }
    $app->view()->admin = true;
    $app->view()->form = $form->display();
예제 #5
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');
예제 #6
0
 * 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;
$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'));
예제 #7
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');
$app = App::getInstance();
$homeUrl = $app->request()->getBaseUrl();
$form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]);
$form->title(_s('Leave the site?'))->element('checkbox', 'clear', ['label_inline' => _s('Remove authorization from all devices')])->divider(12)->element('submit', 'submit', ['value' => '   ' . _s('Exit') . '   ', 'class' => 'btn btn-primary btn-lg btn-block'])->html('<br/><a class="btn btn-default btn-lg btn-block" href="' . $homeUrl . '/profile/' . $app->user()->get()->id . '/">' . _s('Back') . '</a>');
if ($form->process() === true) {
    $app->user()->logout($form->output['clear']);
    $app->redirect($homeUrl);
}
$app->view()->form = $form->display();
$app->view()->setTemplate('login.php');
예제 #8
0
파일: clean.php 프로젝트: eskrano/mobicms
<?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('Clear Archive'))->element('radio', 'clear', ['checked' => 1, 'items' => [1 => _dg('Older than 1 month'), 2 => _dg('Older than 1 week'), 3 => _dg('Delete all news')]])->divider()->element('submit', 'submit', ['value' => _dg('Clear'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Cancel') . '</a>');
if ($form->process() === true) {
    switch ($form->output['clear']) {
        case 2:
            // Чистим старше 1 недели
            App::db()->exec("DELETE FROM `news` WHERE `time` <= " . (time() - 604800));
            App::db()->query("OPTIMIZE TABLE `news`");
            break;
        case 3:
            // Удаляем все новости
            App::db()->query("TRUNCATE TABLE `news`");
            break;
        default:
            // Чистим старше 1 месяца
            App::db()->exec("DELETE FROM `news` WHERE `time` <= " . (time() - 2592000));
            App::db()->query("OPTIMIZE TABLE `news`");
    }
예제 #9
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');
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->title(_dg('Delete Avatar'))->html('<p>' . _dg('You really want to delete avatar?') . '</p>')->divider()->element('submit', 'submit', ['value' => _dg('Delete'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Cancel') . '</a>');
if ($form->process() === true) {
    App::profile()->avatar = '';
    App::profile()->save();
    $ext = ['.jpg', '.gif', '.png'];
    $file = FILES_PATH . 'users' . DS . 'avatar' . DS . App::profile()->id;
    foreach ($ext as $val) {
        if (is_file($file . $val)) {
            unlink($file . $val);
        }
    }
    $form->continueLink = '../';
    $form->successMessage = _dg('Avatar is deleted');
    $form->confirmation = true;
    App::view()->hideuser = true;
}
App::view()->form = $form->display();
예제 #10
0
 * 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;
$app = App::getInstance();
$profile = $app->profile();
$config = $profile->config();
$form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]);
$editors[0] = _m('Without Editor');
$editors[1] = '<abbr title="SCeditor">' . _m('WYSIWYG Editor') . '</abbr>';
if ($profile->rights == 9) {
    $editors[2] = '<abbr title="CodeMirror">' . _m('HTML Editor') . '</abbr>';
}
$form->title(_m('System Settings'))->element('text', 'timeShift', ['value' => $config->timeShift, 'label_inline' => '<span class="badge badge-large">' . date("H:i", time() + (Config::$timeshift + $config->timeShift) * 3600) . '</span> ' . _m('Time settings'), 'description' => _m('Time Shift') . ' (+ - 12)', 'class' => 'small', 'maxlength' => 3, 'limit' => ['type' => 'int', 'min' => -12, 'max' => 13]])->element('text', 'pageSize', ['value' => $config->pageSize, 'label_inline' => _m('List Size'), 'description' => _m('Number of items per page') . ' (5-99)', 'class' => 'small', 'maxlength' => 2, 'limit' => ['type' => 'int', 'min' => 5, 'max' => 99]])->element('checkbox', 'directUrl', ['checked' => $config->directUrl, 'label_inline' => _m('Direct URL')])->title(_m('Text Editor'))->element('radio', 'editor', ['checked' => $config->editor, 'items' => $editors])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
if ($form->process() === true) {
    $config->timeShift = $form->output['timeShift'];
    $config->pageSize = $form->output['pageSize'];
    $config->directUrl = $form->output['directUrl'];
    $config->editor = $form->output['editor'];
    $config->save();
    $app->redirect($app->request()->getUri() . '?saved');
}
$app->view()->form = $form->display();
$app->view()->setTemplate('edit_form.php');
예제 #11
0
$user = App::user()->get();
$profile = App::profile();
$reputation = !empty($profile->reputation) ? unserialize($profile->reputation) : ['a' => 0, 'b' => 0, 'c' => 0, 'd' => 0, 'e' => 0];
if (App::user()->isValid() && $profile->id != $user->id) {
    $checked = '0';
    $update = false;
    // Поиск имеющегося голосования
    $voteStmt = $db->prepare('SELECT * FROM `user__reputation` WHERE `from` = ? AND `to` = ? LIMIT 1');
    $voteStmt->execute([$user->id, $profile->id]);
    $voteResult = $voteStmt->fetch();
    if ($result !== false) {
        $checked = $voteResult['value'];
        $update = true;
    }
    $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
    $form->title(_dg('Vote'))->html('<span class="description">' . _dg('You can express your relationship to the person, what is its reputation in your opinion. You can change your attitude when you want, no restrictions.') . '</span>')->element('radio', 'vote', ['checked' => $checked, 'items' => ['2' => _dg('Excellent'), '1' => _dg('Good'), '0' => _dg('Neutrally'), '-1' => _dg('Bad'), '-2' => _dg('Very Bad')]])->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) {
        if ($update) {
            $writeStmt = $db->prepare('UPDATE `user__reputation` SET `value` = ? WHERE `from` = ? AND `to` = ?');
        } else {
            $writeStmt = $db->prepare('INSERT INTO `user__reputation` SET `value` = ?, `from` = ?, `to` = ?');
        }
        $writeStmt->execute([$form->output['vote'], $user->id, $profile->id]);
        // Обновляем кэш пользователя
        $repStmt = $db->prepare('
            SELECT
            COUNT(IF(`value` =  2, 1, NULL)) AS `a`,
            COUNT(IF(`value` =  1, 1, NULL)) AS `b`,
            COUNT(IF(`value` =  0, 1, NULL)) AS `c`,
            COUNT(IF(`value` = -1, 1, NULL)) AS `d`,
            COUNT(IF(`value` = -2, 1, NULL)) AS `e`
예제 #12
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)
 *
 * @module      System Tools
 * @author      Oleg (AlkatraZ) Kasyanov <*****@*****.**>
 * @version     v.1.0.0 2015-02-01
 */
defined('MOBICMS') or die('Error: restricted access');
use Config\Quarantine as Qarantine;
$app = App::getInstance();
$uri = $app->request()->getUri();
$form = new Mobicms\Form\Form(['action' => $uri]);
$form->title(_s('Quarantine'))->html('<div class="description">' . _m('Quarantine allows you to temporarily restrict user activity') . '</div>')->element('text', 'period', ['label_inline' => _m('The Quarantine action period, in hours') . ' <span class="note">(1-99)</span>', 'value' => Qarantine::$period, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 1, 'max' => 99]])->title(_s('Restrictions'))->html('<div class="description">' . _m('For the duration of the quarantine period, will be active the following restrictions:') . '</div>')->element('text', 'mailSent', ['label_inline' => _m('How much mail can be sent?') . ' <span class="note">(0-99)</span>', 'value' => Qarantine::$mailSent, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 0, 'max' => 99]])->element('text', 'mailRecipients', ['label_inline' => _m('How many mail recipients?') . ' <span class="note">(0-9)</span>', 'value' => Qarantine::$mailRecipients, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 0, 'max' => 9]])->element('text', 'comments', ['label_inline' => _m('How many comments are allowed?') . ' <span class="note">(0-99)</span>', 'value' => Qarantine::$comments, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 0, 'max' => 99]])->element('text', 'chat', ['label_inline' => _m('How many Chat posts are allowed?') . ' <span class="note">(0-99)</span>', 'value' => Qarantine::$chat, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 0, 'max' => 99]])->element('text', 'album', ['label_inline' => _m('How many images are allowed to upload into the Album?') . ' <span class="note">(0-99)</span>', 'value' => Qarantine::$album, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 0, 'max' => 99]])->element('checkbox', 'reputation', ['label_inline' => _m('Allow Reputation'), 'checked' => Qarantine::$reputation])->title(_s('Forum'))->element('text', 'forumTopics', ['label_inline' => _m('How many Topics is allowed to create?') . ' <span class="note">(0-9)</span>', 'value' => Qarantine::$forumTopics, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 0, 'max' => 9]])->element('text', 'forumSections', ['label_inline' => _m('The Sections of the Forum which allowed to create Topics'), 'value' => Qarantine::$forumSections, 'description' => _m('Type (separated by commas) ID of Sections where it is permitted to create Topics.<br>If the list is empty, then allowed to create anywhere.')])->element('text', 'forumPosts', ['label_inline' => _m('How many Forum posts are allowed?') . ' <span class="note">(0-99)</span>', 'value' => Qarantine::$forumPosts, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 0, 'max' => 99]])->element('text', 'forumAllowedTopics', ['label_inline' => _m('The Topics of the Forum which allowed to create posts'), 'value' => Qarantine::$forumAllowedTopics, 'description' => _m('Type (separated by commas) ID of topics where it is permitted to post messages.<br>If the list is empty, then allowed to write anywhere. Please note, if allowed the creation of a topic, then they will be allowed posting messages, regardless of the limitations of this list.')])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
if ($form->process() === true) {
    // Записываем настройки
    (new Mobicms\Config\WriteHandler())->write('Quarantine', $form->output);
    $app->redirect($uri . '?saved');
}
$app->view()->form = $form->display();
$app->view()->setTemplate('edit_form.php');
예제 #13
0
/*
 * 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');
$app = App::getInstance();
$profile = $app->profile();
$form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]);
$form->title(_m('Change E-mail'));
if (!empty($profile->email)) {
    $form->element('text', 'oldemail', ['label' => _m('Old E-mail'), 'value' => $profile->email, 'readonly' => true]);
}
$form->element('text', 'email', ['label' => _m('New E-mail'), 'maxlength' => 50])->element('text', 'repeatemail', ['label' => _m('Repeat E-mail'), 'maxlength' => 50, 'description' => _m('Correctly specify your email address, that it will be sent your password.<br/>Max. 50 characters')])->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('email', 'lenght', ['min' => 5, 'max' => 50, 'empty' => true])->validate('repeatemail', 'compare', ['compare_field' => 'email']);
if ($form->process() === true) {
    // Проверяем Email
    if (!filter_var($form->output['email'], FILTER_VALIDATE_EMAIL)) {
        $form->setError('email', _s('Invalid Email address'));
    } elseif ($app->user()->validate()->checkEmailExists($form->output['email'])) {
        $form->setError('email', _s('This Email is already taken'));
    }
    // Проверяем пароль
    if (!$user->checkPassword($form->output['password'])) {
        $form->setError('password', _s('Invalid password'));
    }
예제 #14
0
/*
 * 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;
if (Config::$usrRegAllow) {
    $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
    $form->title('TMP')->element('text', 'nickname', ['label' => _s('Choose Nickname'), 'description' => _s('Min. 2, Max. 20 Characters.<br>Allowed letters are Cyrillic and Latin alphabet, numbers, spaces and punctuation - = @ ! ? ~ . _ ( ) [ ] *'), 'required' => true])->element('text', 'email', ['label' => _s('Your Email'), 'description' => _s('Please correctly specify your email address. This address will be sent a confirmation code to your registration.'), 'required' => Config::$usrRegEmail ? true : false])->element('password', 'newpass', ['label' => _s('Password'), 'required' => true])->element('password', 'newconf', ['label' => _s('Repeat password'), 'description' => _s('The password length min. 3 characters'), 'required' => true])->element('radio', 'sex', ['label' => _s('Gender'), 'checked' => 'm', 'items' => ['m' => '<i class="male lg fw"></i>' . _s('Male'), 'w' => '<i class="female lg fw"></i>' . _s('Female')]])->divider(8)->captcha()->element('text', 'captcha', ['label_inline' => _s('Verification code'), 'class' => 'small', 'maxlenght' => 5, 'reset_value' => ''])->divider()->element('submit', 'submit', ['value' => _s('Sign Up'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="' . App::request()->getBaseUrl() . '/login/">' . _s('Cancel') . '</a>')->validate('captcha', 'captcha')->validate('nickname', 'lenght', ['min' => 2, 'max' => 20])->validate('email', 'lenght', ['min' => 5, 'max' => 50, 'empty' => true])->validate('newpass', 'lenght', ['continue' => false, 'min' => 3])->validate('newconf', 'compare', ['compare_field' => 'newpass', 'error' => _s("Passwords don't coincide")]);
    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-х подряд)
            $form->setError('nickname', _s('Repeated characters'));
예제 #15
0
/*
 * 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;
$app = App::getInstance();
$profile = $app->profile();
$form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]);
$form->title(_m('Edit Profile'));
if (Config::$usrChangeStatus) {
    $form->html('<div class="form-group">')->element('text', 'status', ['label' => _m('Status'), 'value' => $profile->status, 'description' => _m('Min.3, Max. 50 symbols, or blank to remove status'), 'filter' => FILTER_SANITIZE_SPECIAL_CHARS])->html('</div>');
}
$form->element('text', 'imname', ['label' => _m('Your Name'), 'value' => $profile->imname, 'description' => _m('Max. 50 characters'), 'filter' => FILTER_SANITIZE_STRING]);
if (Config::$usrChangeSex || $app->profile()->rights >= 7) {
    $form->element('radio', 'sex', ['label' => _s('Gender'), 'checked' => $profile->sex, 'items' => ['m' => _s('Male'), 'w' => _s('Female')]]);
}
$form->element('text', 'day', ['label' => _m('Birthday'), 'value' => date("d", strtotime($profile->birth)), 'class' => 'mini', 'filter' => FILTER_SANITIZE_NUMBER_INT])->element('text', 'month', ['value' => date("m", strtotime($profile->birth)), 'class' => 'mini', 'filter' => FILTER_SANITIZE_NUMBER_INT])->element('text', 'year', ['value' => date("Y", strtotime($profile->birth)), 'class' => 'small', 'description' => _m('Day, month, year'), 'filter' => FILTER_SANITIZE_NUMBER_INT])->element('text', 'live', ['label' => _m('Accommodation'), 'value' => $profile->live, 'description' => _m('Specify the country of residence, your city.<br/>Max. 100 characters.'), 'filter' => FILTER_SANITIZE_STRING])->element('textarea', 'about', ['label' => _m('About yourself'), 'value' => $profile->about, 'editor' => true, 'description' => _m('Max. 5000 characters')])->element('text', 'tel', ['label' => _m('Phone Number'), 'value' => $profile->tel, 'description' => _m('Max. 100 characters'), 'filter' => FILTER_SANITIZE_STRING])->element('text', 'siteurl', ['label' => _m('Site'), 'value' => $profile->siteurl, 'description' => _m('You can enter multiple URL, separated by spaces.<br/>Max. 100 characters'), 'filter' => FILTER_SANITIZE_STRING]);
if (!empty($profile->email)) {
    $form->element('text', 'email', ['label' => 'E-mail', 'value' => $profile->email, 'readonly' => true, 'filter' => FILTER_SANITIZE_EMAIL])->element('checkbox', 'mailvis', ['label_inline' => _m('Show in the Profile'), 'checked' => $profile->mailvis, 'description' => _m('Correctly specify your email address, that it will be sent your password.<br/>Max. 50 characters') . '<br/><a href="../email/">' . _m('Change E-mail') . '</a>']);
}
$form->element('text', 'skype', ['label' => 'Skype', 'value' => $profile->skype, 'description' => _m('Max. 50 characters'), 'filter' => FILTER_SANITIZE_STRING])->element('text', 'icq', ['label' => 'ICQ', 'value' => $profile->icq, 'description' => _m('Enter your UIN number'), 'filter' => FILTER_SANITIZE_NUMBER_INT])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>')->validate('status', 'lenght', ['min' => 3, 'max' => 50, 'empty' => true])->validate('imname', 'lenght', ['max' => 50])->validate('live', 'lenght', ['max' => 100])->validate('about', 'lenght', ['max' => 5000])->validate('tel', 'lenght', ['max' => 100])->validate('siteurl', 'lenght', ['max' => 100])->validate('skype', 'lenght', ['max' => 50])->validate('icq', 'numeric', ['min' => 10000, 'empty' => true]);
if ($form->process() === true) {
    $profile->status = $form->output['status'];
    $profile->sex = $form->output['sex'];
예제 #16
0
/*
 * 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;
$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: Добавить страницу с приветствием
예제 #17
0
파일: smilies.php 프로젝트: eskrano/mobicms
<?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->infoMessages = false;
$form->title(_dg('Update cache'))->divider()->element('submit', 'submit', ['value' => _g('Run'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>');
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]) . '/';
예제 #18
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(_s('Registration'))->element('checkbox', 'usrRegAllow', ['label_inline' => _m('Allow registration'), 'checked' => Config::$usrRegAllow])->divider(14)->element('checkbox', 'usrRegEmail', ['label_inline' => _m('Confirmation by Email'), 'checked' => Config::$usrRegEmail, 'description' => _m('On the specified at registration address will be sent an Email with a confirmation link')])->element('checkbox', 'usrSetGravatar', ['label_inline' => _m('Set an Gravatar based on the specified Email'), 'checked' => Config::$usrSetGravatar, 'description' => _m('If for Email specified at registration there is Gravatar, it will be set as an avatar')])->element('checkbox', 'usrRegModeration', ['label_inline' => _m('Confirmation by the Administrator'), 'checked' => Config::$usrRegModeration, 'description' => _m('Regardless of other settings, the User will be activated only after confirmation by the Administrator')])->element('checkbox', 'usrQuarantine', ['label_inline' => _m('Enable Quarantine') . ' <a href="quarantine/" class="btn btn-link btn-xs">[ ' . _s('Settings') . ' ]</a>', 'checked' => Config::$usrQuarantine, 'description' => _m('Quarantine allows you to temporarily restrict user activity')]);
if (App::user()->get()->rights == 9) {
    $form->title(_m('For Users'))->element('checkbox', 'usrChangeSex', ['label_inline' => _m('Change Sex'), 'checked' => Config::$usrChangeSex])->element('checkbox', 'usrChangeStatus', ['label_inline' => _m('Change Status'), 'checked' => Config::$usrChangeStatus])->element('checkbox', 'usrUploadAvatars', ['label_inline' => _m('Upload Avatars'), 'checked' => Config::$usrUploadAvatars])->element('checkbox', 'usrUseGravatar', ['label_inline' => _m('Allow Gravatar'), 'checked' => Config::$usrUseGravatar])->element('checkbox', 'usrNicknameDigitsOnly', ['label_inline' => _m('Allow Nicknames, consisting of digits'), 'checked' => Config::$usrNicknameDigitsOnly])->element('checkbox', 'usrChangeNickname', ['label_inline' => _m('Allow to change Nickname'), 'checked' => Config::$usrChangeNickname])->element('text', 'usrChangeNicknamePeriod', ['label_inline' => _m('After how many days?') . ' <span class="note">(0-99)</span>', 'value' => Config::$usrChangeNicknamePeriod, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 0, 'max' => 99]])->title(_m('For Guests'))->element('checkbox', 'usrViewOnline', ['label_inline' => _m('Online Lists'), 'checked' => Config::$usrViewOnline])->element('checkbox', 'usrViewUserlist', ['label_inline' => _m('List of Users'), 'checked' => Config::$usrViewUserlist])->element('checkbox', 'usrViewProfiles', ['label_inline' => _m('View Profiles'), 'checked' => Config::$usrViewProfiles])->title(_m('Antiflood'))->element('radio', 'usrFloodMode', ['checked' => Config::$usrFloodMode, 'items' => ['3' => _s('Day'), '4' => _m('Night'), '2' => _m('Autoswitch'), '1' => _m('Adaptive')]])->element('text', 'usrFloodDay', ['value' => Config::$usrFloodDay, 'class' => 'small', 'label_inline' => _m('Sec.') . ', ' . _s('Day') . ' <span class="note">(3-300)</span>', 'limit' => ['type' => 'int', 'min' => 3, 'max' => 300]])->element('text', 'usrFloodNight', ['value' => Config::$usrFloodNight, 'class' => 'small', 'label_inline' => _m('Sec.') . ', ' . _m('Night') . ' <span class="note">(3-300)</span>', 'limit' => ['type' => 'int', 'min' => 3, 'max' => 300]]);
}
$form->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('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');
예제 #19
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');
예제 #20
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');
$app = App::getInstance();
$form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]);
$form->title(_m('Set Gravatar'))->element('text', 'email', ['label' => 'Email', 'description' => _m('Gravatar (an abbreviation for globally recognized avatar) is a service for providing globally unique avatars. On Gravatar, users can <a href="http://gravatar.com">register an account</a> based on their email address, and upload an avatar to be associated with the account. Next, in your profile when you install avatar, just specify your Email address and will be used as your global avatar.'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
if ($form->process() === true) {
    $profile = $app->profile();
    $default = 'http://johncms.com/images/empty.png';
    //TODO: Установить изображение по умолчанию
    $profile->avatar = 'http://www.gravatar.com/avatar/' . md5(strtolower(trim($form->output['email']))) . '?d=' . urlencode($default) . '&s=48';
    $profile->save();
    $ext = ['.jpg', '.gif', '.png'];
    $file = FILES_PATH . 'users' . DS . 'avatar' . DS . $profile->id;
    foreach ($ext as $val) {
        if (is_file($file . $val)) {
            unlink($file . $val);
        }
    }
    $form->continueLink = '../';
    $form->successMessage = _m('Avatar is established');
예제 #21
0
파일: delete.php 프로젝트: eskrano/mobicms
 * 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');
$id = App::request()->getFiltered('id', 0, FILTER_VALIDATE_INT);
$form = new Mobicms\Form\Form(['action' => App::request()->getUri() . '?id=' . $id]);
if ($id) {
    $stmt = App::db()->query("SELECT * FROM `news` WHERE `id` = " . $id);
    if ($stmt->rowCount()) {
        $form->title(_dg('Delete Article'))->divider()->element('submit', 'submit', ['value' => _g('Delete'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Cancel') . '</a>');
    } else {
        $form->html('<div class="alert alert-danger">' . _g('Wrong data') . '</div>')->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>');
    }
} else {
    $form->html('<div class="alert alert-danger">' . _g('Wrong data') . '</div>')->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>');
}
if ($form->process() === true) {
    App::db()->exec("DELETE FROM `news` WHERE `id` = " . $id);
    //TODO: Добавить удаление комментариев к новости
    $form->confirmation = true;
    $form->continueLink = '../';
    $form->successMessage = _dg('Article deleted');
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
예제 #22
0
/*
 * 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');
$app = App::getInstance();
$user = $app->user()->get();
$profile = $app->profile();
$form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]);
$form->title(_m('Change Password'))->element('password', 'oldpass', ['label' => $profile->id == $user->id ? _m('Old Password') : _m('Admin Password'), 'required' => true])->element('password', 'newpass', ['label' => _m('New Password'), 'description' => _s('The password length min. 3 characters'), 'required' => true])->element('password', 'newconf', ['label' => _s('Repeat 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('oldpass', 'lenght', ['continue' => false, 'min' => 3])->validate('newpass', 'lenght', ['continue' => false, 'min' => 3])->validate('newconf', 'compare', ['compare_field' => 'newpass', 'error' => _s("Passwords don't coincide")]);
if ($form->process() === true) {
    if ($user->checkPassword($form->output['oldpass'])) {
        $profile->setPassword($form->output['newpass']);
        $profile->setToken($app->user()->generateToken());
        $profile->save();
        if ($profile->id == $user->id) {
            $remember = filter_has_var(INPUT_COOKIE, $app->user()->domain);
            $app->user()->login($user->nickname, $form->output['newpass'], $remember);
        }
        $form->continueLink = '../';
        $form->successMessage = _m('The password is successfully changed');
        $form->confirmation = true;
    } else {
        $form->setError('oldpass', _s('Invalid password'));
    }
예제 #23
0
파일: add.php 프로젝트: eskrano/mobicms
<?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');
예제 #24
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;
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->title(_m('Upload image'))->element('hidden', 'MAX_FILE_SIZE', ['value' => Config::$filesize * 1024])->element('file', 'image', ['label' => _m('Image'), 'description' => _m('The following files are allowed to unload: JPG, JPEG, PNG, GIF. File size should not exceed 100kb. Regardless of the resolution of the source file, it will be converted to the size of the 48х48. For best results, the image should have an equal ratio. New image replaces the old (if it was).')])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
if ($form->process() === true) {
    $error = [];
    if ($_FILES['image']['size'] > 0) {
        require_once ROOT_PATH . 'system/vendor/class.upload/class.upload.php';
        $handle = new upload($_FILES['image']);
        if ($handle->uploaded) {
            $profile = App::profile();
            // Обрабатываем фото
            $handle->file_new_name_body = $profile->id;
            $handle->allowed = ['image/jpeg', 'image/gif', 'image/png'];
            $handle->file_max_size = Config::$filesize * 1024;
            $handle->file_overwrite = true;
            $handle->image_resize = true;
            $handle->image_x = 48;
            $handle->image_y = 48;
예제 #25
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');
$uri = App::request()->getUri();
$config = App::profile()->config();
$items['#'] = _dg('Select automatically');
$items = array_merge($items, App::lng()->getLocalesList());
$form = new Mobicms\Form\Form(['action' => $uri]);
$form->title(_dg('Select Language'))->element('radio', 'lng', ['checked' => $config->lng, 'items' => $items, 'description' => _dg('If you turn on automatic mode, the system language is set depending on the settings of your browser.')])->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) {
    $config->lng = $form->output['lng'];
    $config->save();
    App::session()->remove('lng');
    App::redirect($uri . '?saved');
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
예제 #26
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;
$app = App::getInstance();
$form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]);
$form->title(_m('Where to turn?'))->element('checkbox', 'sitemapForum', ['label_inline' => _s('Forum'), 'checked' => Config::$sitemapForum])->element('checkbox', 'sitemapLibrary', ['label_inline' => _s('Library'), 'checked' => Config::$sitemapLibrary])->title(_m('To whom to show?'))->element('radio', 'sitemapUsers', ['checked' => Config::$sitemapUsers, 'items' => ['1' => _m('All'), '0' => _m('Guests only')]])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
if ($form->process() === true) {
    // Записываем настройки
    (new Mobicms\Config\WriteHandler())->write('System', $form->output);
    $app->view()->save = true;
}
$app->view()->form = $form->display();
$app->view()->setTemplate('edit_form.php');
예제 #27
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');
$app = App::getInstance();
$form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]);
$form->title(_m('Upload GIF animation'))->element('hidden', 'MAX_FILE_SIZE', ['value' => 10 * 1024])->element('file', 'animation', ['label' => _m('Image'), 'description' => _m('Only GIF files allowed for upload, file size should not exceed 20kb.<br>Image size must be 48x48.')])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
if ($form->process() === true) {
    $error = [];
    if ($_FILES['animation']['size'] > 0) {
        // Проверка на допустимый вес файла
        if ($_FILES['animation']['size'] > 20480) {
            $error[] = _m('Weight of the file exceeds 20kb');
        }
        $param = getimagesize($_FILES['animation']['tmp_name']);
        // Проверка на допустимый тип файла
        if ($param == false || $param['mime'] != 'image/gif') {
            $error[] = _m('Invalid file type, are only allowed to upload images in GIF format');
        }
        // Проверка на допустимый размер изображения
        if ($param != false && ($param[0] != 48 || $param[1] != 48)) {
            $error[] = _m('The size of the images must be 48x48');
예제 #28
0
파일: acl.php 프로젝트: waydelyle/mobicms
<?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;
$app = App::getInstance();
$form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]);
$form->title(_s('Forum'))->element('radio', 'aclForum', ['checked' => Config::$aclForum, 'items' => ['2' => _m('Access is open'), '1' => _m('Only for the authorized'), '3' => _m('Read only'), '0' => _m('Access denied')]])->title(_s('Guestbook'))->element('radio', 'aclGuestbook', ['checked' => Config::$aclGuestbook, 'items' => ['2' => _m('Enable posting for guests'), '1' => _m('Access is open'), '0' => _m('Access denied')]])->title(_s('Library'))->element('radio', 'aclLibrary', ['checked' => Config::$aclLibrary, 'items' => ['2' => _m('Access is open'), '1' => _m('Only for the authorized'), '0' => _m('Access denied')]])->title(_s('Downloads'))->element('radio', 'aclDownloads', ['checked' => Config::$aclDownloads, 'items' => ['2' => _m('Access is open'), '1' => _m('Only for the authorized'), '0' => _m('Access denied')]])->element('checkbox', 'aclDownloadsComm', ['label_inline' => _s('Comments'), 'checked' => Config::$aclDownloadsComm])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>');
if ($form->process() === true) {
    // Записываем настройки
    (new Mobicms\Config\WriteHandler())->write('System', $form->output);
    //App::cfg()->sys->write($form->output);
    $app->view()->save = true;
}
$app->view()->form = $form->display();
$app->view()->setTemplate('edit_form.php');
예제 #29
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(_dg('Clear Cache'))->html('<span class="description">' . _dg('The Cache clearing is required after installing a new language or upgrade existing ones.') . '</span>')->element('submit', 'update', ['value' => _dg('Clear Cache'), 'class' => 'btn btn-primary btn-xs'])->title(_dg('Default Language'))->element('radio', 'lng', ['checked' => Config::$lng, 'description' => _dg('If the choice is prohibited, the language will be forced to set for all visitors. If the choice is allowed, it will be applied only in the case, if requested by the client language is not in the system.'), 'items' => App::lng()->getLocalesList()])->element('checkbox', 'lngSwitch', ['checked' => Config::$lngSwitch, 'label_inline' => _dg('Allow to choose'), 'description' => _dg('Allow visitors specify the desired language from the list of available in the system. Including activated auto select languages by signatures of the browser.')])->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) {
    if (isset($form->input['update'])) {
        // Обновляем кэш
        App::lng()->clearCache();
        App::redirect($uri . '?cache');
    } else {
        // Записываем настройки
        App::session()->remove('lng');
        (new Mobicms\Config\WriteHandler())->write('System', $form->output);
        App::redirect($uri . '?saved');
    }
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
예제 #30
0
파일: avatars.php 프로젝트: eskrano/mobicms
foreach (glob(ROOT_PATH . 'assets' . DS . 'avatars' . DS . '*', GLOB_ONLYDIR) as $val) {
    $dir = basename($val);
    $catalog[$dir] = _g($dir);
    //TODO: доделать мультиязычность
}
asort($catalog);
$uri = App::request()->getUri();
$homeUrl = App::request()->getBaseUrl();
$query = App::router()->getQuery();
App::view()->pagesize = 40;
$user = App::user()->get();
if (App::user()->isValid() && isset($query[1], $query[2], $catalog[$query[2]]) && $query[1] == 'set') {
    // Устанавливаем аватар в анкету
    $image = $homeUrl . '/assets/avatars/' . urlencode($query[2]) . '/' . urlencode($query[3]);
    $form = new Mobicms\Form\Form(['action' => $uri . '/' . $query[3]]);
    $form->title(_g('Set Avatar'))->html('<br/><div class="avatars-list" style="float: left; margin-right: 12px"><img src="' . $image . '" alt=""/></div><br/>' . _g('Are you sure you want to set yourself this avatar?'))->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="' . $uri . 'list/' . \App::router()->getQuery(2) . '">' . _g('Back') . '</a>');
    if ($form->process() === true) {
        $user->avatar = $image;
        $user->save();
        foreach (['gif', 'jpg', 'png'] as $ext) {
            $file = FILES_PATH . 'users' . DS . 'avatar' . DS . $user->id . '.' . $ext;
            if (is_file($file)) {
                unlink($file);
            }
        }
        $form->continueLink = $homeUrl . '/profile/' . $user->id . '/option/avatar/';
        $form->successMessage = _g('Avatar is installed');
        $form->confirmation = true;
        App::view()->hideuser = true;
    }
    App::view()->form = $form->display();