예제 #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;
$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');
예제 #2
0
        if ($param != false && ($param[0] != 48 || $param[1] != 48)) {
            $error[] = _m('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 = _m(_m('Avatar is uploaded'));
                $form->confirmation = true;
                $app->view()->hideuser = true;
            } else {
                $error[] = _m('Error uploading avatar');
            }
        } else {
            echo $error . ' <a href="../">' . _s('Back') . '</a>';
        }
    } else {
        // Если не выбран файл
        $error[] = _m('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');