Esempio n. 1
0
echo _dg('Choose Skin');
?>
 <span class="label label-danger">draft</span></a></li>
    <?php 
if (Config::$lngSwitch) {
    ?>
        <li><a href="<?php 
    echo $uri;
    ?>
language/"><i class="language fw lg"></i><?php 
    echo _dg('Choose Language');
    ?>
</a></li>
    <?php 
}
?>
    <?php 
if ($user->rights == 9 || $user->rights == 7 && $user->rights > $profile->rights) {
    ?>
        <li><a href="<?php 
    echo $uri;
    ?>
rank/"><span class="danger"><i class="graduation-cap fw lg"></i><?php 
    echo _dg('Rank');
    ?>
</span></a></li>
    <?php 
}
?>
</ul>
Esempio n. 2
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');
$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');
Esempio n. 3
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');
Esempio n. 4
0
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');
Esempio n. 5
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');
$user = App::user()->get();
$profile = App::profile();
if ($user->rights == 9 || $user->rights == 7 && $user->rights > $profile->rights) {
    $items = [0 => _dg('User'), 3 => _dg('Forum Moderator'), 4 => _dg('Downloads Moderator'), 5 => _dg('Library Moderator'), 6 => _dg('Super Modererator')];
    if ($user->rights == 9) {
        $items['7'] = '<i class="exclamation-circle lg"></i> ' . _dg('Administrator');
        $items['9'] = '<span class="danger"><i class="exclamation-circle lg"></i> ' . _dg('Supervisor') . '</span>';
    }
    $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
    $form->title(_dg('Rank'))->element('radio', 'rights', ['checked' => $profile->rights, 'items' => $items])->element('password', 'password', ['label' => _dg('Your Password'), 'required' => true])->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 (!$user->checkPassword($form->output['password'])) {
            $form->setError('password', _g('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();
Esempio n. 6
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>' . _dg('Author') . '</strong>: ' . htmlspecialchars($theme['author']) : '') . (!empty($theme['author_url']) ? '<br/><strong>' . _dg('Site') . '</strong>: ' . htmlspecialchars($theme['author_url']) : '') . (!empty($theme['author_email']) ? '<br/><strong>Email</strong>: ' . htmlspecialchars($theme['author_email']) : '') . (!empty($theme['description']) ? '<br/><strong>' . _dg('Description') . '</strong>: ' . htmlspecialchars($theme['description']) : '') . '</dd></dl>';
    $form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
    $form->title(_dg('Choose Skin'))->html($description)->divider()->element('submit', 'submit', ['value' => _dg('Choose'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>');
    if ($form->process() === true) {
        //        $stmt = App::db()->prepare("UPDATE `" . TP . "user__` 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');
        if ($param != false && ($param[0] != 48 || $param[1] != 48)) {
            $error[] = _dg('The size of the images must be 48x48');
        }
        if (empty($error)) {
            $profile = App::profile();
            if (move_uploaded_file($_FILES['animation']['tmp_name'], FILES_PATH . 'users' . DS . 'avatar' . DS . $profile->id . '.gif') == true) {
                $profile->avatar = App::request()->getBaseUrl() . '/uploads/users/avatar/' . $profile->id . '.gif';
                $profile->save();
                if (is_file(FILES_PATH . 'users' . DS . 'avatar' . DS . $profile->id . '.jpg')) {
                    unlink(FILES_PATH . 'users' . DS . 'avatar' . DS . $profile->id . '.jpg');
                }
                $form->continueLink = '../';
                $form->successMessage = _dg(_dg('Avatar is uploaded'));
                $form->confirmation = true;
                App::view()->hideuser = true;
            } else {
                $error[] = _dg('Error uploading avatar');
            }
        } else {
            echo $error . ' <a href="../">' . _g('Back') . '</a>';
        }
    } else {
        // Если не выбран файл
        $error[] = _dg('The file is not selected');
    }
    if (!empty($error)) {
        App::view()->error = implode('<br/>', $error);
    }
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
Esempio n. 8
0
</a></li>
            <li><a href="<?php 
        echo $homeUrl;
        ?>
/contacts/?act=select&amp;mod=contact&amp;id=<?php 
        echo $profile->id;
        ?>
"><i class="adress_book lg fw"></i><?php 
        echo $this->num_cont ? _dg('Remove from Contacts') : _dg('Add to Contacts');
        ?>
</a>
            </li>
        <?php 
    }
    ?>
        <li><a href="<?php 
    echo $homeUrl;
    ?>
/contacts/?act=select&amp;mod=banned&amp;id=<?php 
    echo $profile->id;
    ?>
">
                <i class="ban lg fw"></i><?php 
    echo isset($this->banned) && $this->banned == 1 ? _dg('Remove from Ignore List') : _dg('Add to Ignore List');
    ?>
</a></li>
    <?php 
}
?>
</ul>
Esempio n. 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');
use Config\System as Config;
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->title(_g('Forum'))->element('radio', 'aclForum', ['checked' => Config::$aclForum, 'items' => ['2' => _dg('Access is open'), '1' => _dg('Only for the authorized'), '3' => _dg('Read only'), '0' => _dg('Access denied')]])->title(_g('Guestbook'))->element('radio', 'aclGuestbook', ['checked' => Config::$aclGuestbook, 'items' => ['2' => _dg('Enable posting for guests'), '1' => _dg('Access is open'), '0' => _dg('Access denied')]])->title(_g('Library'))->element('radio', 'aclLibrary', ['checked' => Config::$aclLibrary, 'items' => ['2' => _dg('Access is open'), '1' => _dg('Only for the authorized'), '0' => _dg('Access denied')]])->title(_g('Downloads'))->element('radio', 'aclDownloads', ['checked' => Config::$aclDownloads, 'items' => ['2' => _dg('Access is open'), '1' => _dg('Only for the authorized'), '0' => _dg('Access denied')]])->element('checkbox', 'aclDownloadsComm', ['label_inline' => _g('Comments'), 'checked' => Config::$aclDownloadsComm])->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::cfg()->sys->write($form->output);
    App::view()->save = true;
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
Esempio n. 10
0
            <?php 
    foreach ($this->list as $val) {
        ?>
                <li class="static">
                    <h2><?php 
        echo $val['title'];
        ?>
</h2>

                    <div class="news-info">
                        <?php 
        echo Includes\Functions::displayDate($val['time']);
        ?>
<br/>
                        <?php 
        echo _dg('Added');
        ?>
: <a href="<?php 
        echo App::request()->getBaseUrl();
        ?>
/profile/<?php 
        echo $val['author_id'];
        ?>
/"><?php 
        echo $val['author'];
        ?>
</a>
                    </div>
                    <p><?php 
        echo $val['text'];
        ?>
Esempio n. 11
0
use Config\System as Config;
$profile = App::profile();
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->title(_dg('Edit Profile'));
if (Config::$usrChangeStatus) {
    $form->html('<div class="form-group">')->element('text', 'status', ['label' => _dg('Status'), 'value' => $profile->status, 'description' => _dg('Min.3, Max. 50 symbols, or blank to remove status'), 'filter' => FILTER_SANITIZE_SPECIAL_CHARS])->html('</div>');
}
$form->element('text', 'imname', ['label' => _dg('Your Name'), 'value' => $profile->imname, 'description' => _dg('Max. 50 characters'), 'filter' => FILTER_SANITIZE_STRING]);
if (Config::$usrChangeSex || App::profile()->rights >= 7) {
    $form->element('radio', 'sex', ['label' => _g('Gender'), 'checked' => $profile->sex, 'items' => ['m' => _g('Male'), 'w' => _g('Female')]]);
}
$form->element('text', 'day', ['label' => _dg('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' => _dg('Day, month, year'), 'filter' => FILTER_SANITIZE_NUMBER_INT])->element('text', 'live', ['label' => _dg('Accommodation'), 'value' => $profile->live, 'description' => _dg('Specify the country of residence, your city.<br/>Max. 100 characters.'), 'filter' => FILTER_SANITIZE_STRING])->element('textarea', 'about', ['label' => _dg('About yourself'), 'value' => $profile->about, 'editor' => true, 'description' => _dg('Max. 5000 characters')])->element('text', 'tel', ['label' => _dg('Phone Number'), 'value' => $profile->tel, 'description' => _dg('Max. 100 characters'), 'filter' => FILTER_SANITIZE_STRING])->element('text', 'siteurl', ['label' => _dg('Site'), 'value' => $profile->siteurl, 'description' => _dg('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' => _dg('Show in the Profile'), 'checked' => $profile->mailvis, 'description' => _dg('Correctly specify your email address, that it will be sent your password.<br/>Max. 50 characters') . '<br/><a href="../email/">' . _dg('Change E-mail') . '</a>']);
}
$form->element('text', 'skype', ['label' => 'Skype', 'value' => $profile->skype, 'description' => _dg('Max. 50 characters'), 'filter' => FILTER_SANITIZE_STRING])->element('text', 'icq', ['label' => 'ICQ', 'value' => $profile->icq, 'description' => _dg('Enter your UIN number'), 'filter' => FILTER_SANITIZE_NUMBER_INT])->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('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'];
    $profile->imname = $form->output['imname'];
    $profile->live = $form->output['live'];
    $profile->about = App::purify($form->output['about']);
    $profile->tel = $form->output['tel'];
    $profile->siteurl = $form->output['siteurl'];
    $profile->mailvis = isset($form->output['mailvis']) ? 1 : 0;
    $profile->icq = $form->output['icq'];
    $profile->skype = $form->output['skype'];
    //TODO: Добавить валидацию даты
    if (empty($form->output['day']) && empty($form->output['month']) && empty($form->output['year'])) {
        $profile->birth = '00-00-0000';
    } else {
Esempio n. 12
0
    echo _dg('Set Gravatar');
    ?>
</a></li>
    <?php 
}
?>
    <?php 
if ($owner) {
    ?>
        <li><a href="<?php 
    echo App::request()->getBaseUrl();
    ?>
/help/avatars/"><i class="picture lg fw"></i><?php 
    echo _dg('Choose in the catalog');
    ?>
</a></li>
    <?php 
}
?>
    <?php 
if (!empty($profile->avatar)) {
    ?>
        <li><a href="delete/"><i class="bin lg fw"></i><?php 
    echo _dg('Delete Avatar');
    ?>
</a></li>
    <?php 
}
?>
</ul>
Esempio n. 13
0
 *
 * 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');
$user = App::user()->get();
$profile = App::profile();
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->title(_dg('Change Password'))->element('password', 'oldpass', ['label' => $profile->id == $user->id ? _dg('Old Password') : _dg('Admin Password'), 'required' => true])->element('password', 'newpass', ['label' => _dg('New Password'), 'description' => _g('The password length min. 3 characters'), 'required' => true])->element('password', 'newconf', ['label' => _g('Repeat password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>')->validate('oldpass', 'lenght', ['continue' => false, 'min' => 3])->validate('newpass', 'lenght', ['continue' => false, 'min' => 3])->validate('newconf', 'compare', ['compare_field' => 'newpass', 'error' => _g("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 = _dg('The password is successfully changed');
        $form->confirmation = true;
    } else {
        $form->setError('oldpass', _g('Invalid password'));
    }
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
Esempio n. 14
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(_dg('Where to turn?'))->element('checkbox', 'sitemapForum', ['label_inline' => _g('Forum'), 'checked' => Config::$sitemapForum])->element('checkbox', 'sitemapLibrary', ['label_inline' => _g('Library'), 'checked' => Config::$sitemapLibrary])->title(_dg('To whom to show?'))->element('radio', 'sitemapUsers', ['checked' => Config::$sitemapUsers, 'items' => ['1' => _dg('All'), '0' => _dg('Guests only')]])->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::view()->save = true;
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
Esempio n. 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');
$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();
App::view()->setTemplate('edit_form.php');
Esempio n. 16
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('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> ' . _dg('Time Shift') . ' <span class="note">(+ - 12)</span>', 'limit' => ['type' => 'int', 'min' => -12, 'max' => 13]])->title(_dg('Upload Files'))->element('text', 'filesize', ['value' => Config::$filesize, 'label_inline' => _dg('Max. File size') . ' kB <span class="note">(100-50000)</span>', 'description' => _dg('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(_dg('Profiling'))->element('checkbox', 'profilingGeneration', ['checked' => Config::$profilingGeneration, 'label_inline' => _dg('Show generation time')])->element('checkbox', 'profilingMemory', ['checked' => Config::$profilingMemory, 'label_inline' => _dg('Show used memory')])->title(_dg('Site Requisites'))->element('text', 'email', ['value' => Config::$email, 'label' => _dg('Site Email')])->element('textarea', 'copyright', ['value' => Config::$copyright, 'label' => _dg('Copyright')])->title(_dg('SEO Attributes'))->element('text', 'homeTitle', ['value' => Config::$homeTitle, 'style' => 'max-width: none', 'label' => _dg('Homepage title'), 'description' => _dg('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' => _dg('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' => _dg('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' => _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');
Esempio n. 17
0
?>
: <?php 
echo $this->counters['d'];
?>
                        </div>
                        <div class="progress">
                            <div class="progress-bar progress-bar-warning" style="width: <?php 
echo $this->reputation['d'];
?>
%;"></div>
                        </div>

                        <!-- Очень плохо -->
                        <div class="reputation-desc">
                            <?php 
echo _dg('Very Bad');
?>
: <?php 
echo $this->counters['e'];
?>
                        </div>
                        <div class="progress">
                            <div class="progress-bar progress-bar-danger" style="width: <?php 
echo $this->reputation['e'];
?>
%;"></div>
                        </div>
                    </td>
                </tr>
            </table>
        </a>
Esempio n. 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');
$profile = App::profile();
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->title(_dg('Change E-mail'));
//TODO: Доработать, добавить валидацию
if (!empty($profile->email)) {
    $form->element('text', 'oldemail', ['label' => _dg('Old E-mail'), 'value' => $profile->email, 'readonly' => true]);
}
$form->element('text', 'email', ['label' => _dg('New E-mail'), 'maxlength' => 50])->element('text', 'repeatemail', ['label' => _dg('Repeat E-mail'), 'maxlength' => 50, 'description' => _dg('Correctly specify your email address, that it will be sent your password.<br/>Max. 50 characters')])->element('password', 'password', ['label' => _dg('Your Password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>')->validate('email', 'lenght', ['min' => 5, 'max' => 50, 'empty' => true])->validate('email', 'email', ['empty' => true])->validate('repeatemail', 'compare', ['compare_field' => 'email'])->validate('password', 'password', ['continue' => false])->validate('email', 'emailoccupied', ['valid' => true]);
if ($form->process() === true) {
    $stmt = App::db()->prepare("\n        UPDATE `user__`\n        SET\n        `email`    = ?\n        WHERE `id` = ?\n        ");
    $stmt->execute([$form->output['email'], Users::$data['id']]);
    $stmt = null;
    $form->continueLink = '../';
    $form->confirmation = true;
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
Esempio n. 19
0
$user = App::user()->get();
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
if ($user->rights >= 7 || $user->change_time < time() - Config::$usrChangeNicknamePeriod * 86400) {
    $form->title(_dg('Change Nickname'))->element('text', 'nickname', ['label' => _dg('New Nickname'), 'maxlength' => 20, 'required' => true])->element('text', 'repeat', ['label' => _dg('Repeat Nickname'), 'maxlength' => 20, 'description' => _g('Min. 2, Max. 20 Characters.<br>Allowed letters are Cyrillic and Latin alphabet, numbers, spaces and punctuation - = @ ! ? ~ . _ ( ) [ ] *') . '<br/>' . _dg('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 . ' ' . _n('Day', 'Days', Config::$usrChangeNicknamePeriod) . '.', 'required' => true])->element('password', 'password', ['label' => _dg('Your Password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>')->validate('nickname', 'lenght', ['min' => 2, 'max' => 20])->validate('repeat', 'compare', ['compare_field' => 'nickname']);
} else {
    $form->html('<div class="alert alert-danger">' . '<strong>' . _dg('Nickname can not change more than once a') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _n('Day', 'Days', Config::$usrChangeNicknamePeriod) . '</strong><br/><br/>' . _dg('You have already changed their nickname:') . ' ' . Includes\Functions::displayDate($user->change_time) . '<br/>' . _dg('Next time will be able to change:') . ' ' . Includes\Functions::displayDate($user->change_time + Config::$usrChangeNicknamePeriod * 86400) . '</div>')->html('<a class="btn btn-primary" href="../">' . _g('Back') . '</a>');
}
if ($form->process() === true) {
    try {
        // Проверяем ник
        App::user()->validate()->checkNickname($form->output['nickname']);
        // Проверяем пароль
        if (!$user->checkPassword($form->output['password'])) {
            $form->setError('password', _g('Invalid password'));
        }
    } catch (Mobicms\Checkpoint\Exceptions\UserExceptionInterface $e) {
        $form->setError('nickname', $e->getMessage());
    }
    // Если все проверки пройдены, записываем данные
    if ($form->isValid) {
        $profile = App::profile();
        $profile->nickname = $form->output['nickname'];
        $profile->change_time = time();
        $profile->save();
        $form->continueLink = '../';
        $form->successMessage = _dg('Nickname successfully changed');
        $form->confirmation = true;
    }
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
Esempio n. 20
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;
$profile = App::profile();
$config = $profile->config();
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$editors[0] = _dg('Without Editor');
$editors[1] = '<abbr title="SCeditor">' . _dg('WYSIWYG Editor') . '</abbr>';
if ($profile->rights == 9) {
    $editors[2] = '<abbr title="CodeMirror">' . _dg('HTML Editor') . '</abbr>';
}
$form->title(_dg('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> ' . _dg('Time settings'), 'description' => _dg('Time Shift') . ' (+ - 12)', 'class' => 'small', 'maxlength' => 3, 'limit' => ['type' => 'int', 'min' => -12, 'max' => 13]])->element('text', 'pageSize', ['value' => $config->pageSize, 'label_inline' => _dg('List Size'), 'description' => _dg('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' => _dg('Direct URL')])->title(_dg('Text Editor'))->element('radio', 'editor', ['checked' => $config->editor, 'items' => $editors])->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->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');
Esempio n. 21
0
    <?php 
}
?>
    <?php 
if (!empty($this->extraFiles)) {
    ?>
        <div class="alert alert-danger">
            <h4>(<?php 
    echo count($this->extraFiles);
    ?>
) <?php 
    echo _dg('New files');
    ?>
</h4>
            <?php 
    echo _dg('If the files listed below does not pertain to your additional modules and you are not assured of their safety, remove them. They can be dangerous for your site.');
    ?>
<br/><br/>
            <?php 
    foreach ($this->extraFiles as $file) {
        ?>
                <div style="font-size: small; font-weight: bold; padding-top: 2px; padding-bottom: 2px; border-top: 1px dotted #ec8583;">
                    <?php 
        echo htmlspecialchars($file['file_path']);
        ?>
                    <span style="font-size: small; font-weight: normal; color: #696969">
                        - <?php 
        echo $file['file_date'];
        ?>
                    </span>
                </div>
Esempio n. 22
0
<div class="content box padding">
    <?php 
if (isset($_GET['save'])) {
    ?>
        <div class="alert alert-success"><?php 
    echo _dg('Data saved successfully');
    ?>
</div>
    <?php 
} elseif (isset($_GET['default'])) {
    ?>
        <div class="alert"><?php 
    echo _dg('Options set to default');
    ?>
</div>
    <?php 
} elseif (isset($_GET['cache'])) {
    ?>
        <div class="alert alert-success"><?php 
    echo _dg('The Cache cleared successfully');
    ?>
</div>
    <?php 
}
?>
    <?php 
echo $this->form;
?>
</div>
Esempio n. 23
0
        }
        ?>
                                    <?php 
        if (!empty($val['author_email'])) {
            ?>
                                        <br/><strong>Email</strong>: <?php 
            echo $val['author_email'];
            ?>
                                    <?php 
        }
        ?>
                                    <?php 
        if (!empty($val['description'])) {
            ?>
                                        <br/><strong><?php 
            echo _dg('Description');
            ?>
</strong>: <?php 
            echo $val['description'];
            ?>
                                    <?php 
        }
        ?>
                                </p>
                            </dd>
                        </dl>
                    </a>
                </li>
            <?php 
    }
    ?>
Esempio n. 24
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`
Esempio n. 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');
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');
Esempio n. 26
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');
$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`");
    }
    //TODO: Добавить удаление комментариев к новости
    $form->confirmation = true;
    $form->continueLink = '../';
    $form->successMessage = _dg('Cleaning completed');
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
Esempio n. 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');
$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');
Esempio n. 28
0
 *
 * 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('Set Gravatar'))->element('text', 'email', ['label' => 'Email', 'description' => _dg('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' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('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 = _dg('Avatar is established');
    $form->confirmation = true;
    App::view()->hideuser = true;
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
Esempio n. 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');
Esempio n. 30
0
                App::view()->extraFiles = $scanner->newFiles;
                App::view()->errormsg = _dg('Distributive inconsistency!');
            } else {
                App::view()->ok = _dg('List of files corresponds to the distributive');
            }
            break;
        case 2:
            // Сканируем на соответствие ранее созданному снимку
            $scanner->scan(true);
            if (count($scanner->whiteList) == 0) {
                App::view()->errormsg = _dg('Snapshot image is not created');
            } else {
                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 = _dg('Snapshot inconsistency');
                } else {
                    App::view()->ok = _dg('All files are consistent with previously made image');
                }
            }
            break;
        case 3:
            // Создаем снимок файлов
            $scanner->snap();
            App::view()->ok = _dg('Snapshot successfully created');
            break;
    }
}
App::view()->form = $form->display();
App::view()->setTemplate('scanner.php');