Файл: wboard/source/system/controller/settings.php
Строк: 13
<?php
/**
 * WBoard
 * User Settings
 * @author Screamer
 * @copyright 2013
 */
class Module_Settings extends Module
{
    /**
     * Display form
     * @return (void)
     */
    public function index()
    {
        $error = FALSE;
        if (!empty($_POST)) {
            if (isset($_POST['ok'])) {
                $expire = time() + 86400 * 365;
                // Set CSS style
                if (isset($_POST['user']['style'])) {
                    $error = !$this->helper->css_exists($_POST['user']['style']);
                    if ($error === FALSE) {
                        setcookie('css_style', htmlspecialchars($_POST['user']['style']), $expire, '/');
                    }
                }
                // Setup timeshift
                if (isset($_POST['timeshift'])) {
                    $_POST['timeshift'] = intval($_POST['timeshift']);
                    $_POST['timeshift'] = $_POST['timeshift'] > 12 || $_POST['timeshift'] < -12 ? 0 : $_POST['timeshift'];
                    setcookie('timeshift', $_POST['timeshift'], $expire, '/');
                }
            }
            if (empty($error)) {
                $this->redirect();
            }
        }
        $this->tpl->title = $this->lng->settings;
        $this->tpl->set_output($this->tpl->load('settings', array(
            'error' => $error,
            'css_styles' => $this->helper->css_styles_list($error),
            'server_time' => date('d.m.Y / H:i:s', time()),
            'timeshift' => $this->settings['user']['timeshift'],
        )));
    }
}