Ejemplo n.º 1
0
 /**
  * @return array
  */
 public function getSettings()
 {
     $vl = $this->_main->getValidator();
     $this->_settings = $this->getDefaultSettings();
     $theme = $vl->getVariable('theme', 'value');
     $middletext = $vl->getVariable('middletext', 'value');
     $hidetime = $vl->getVariable('hidetime', 'value');
     $merge = $vl->getVariable('merge', 'value');
     $advanced = $vl->getVariable('advanced', 'value');
     $quotes = $vl->getVariable('spoiler', 'value');
     if ($theme != "" && isset($this->_themes[$theme])) {
         $this->_settings['theme'] = $theme;
     }
     if ($middletext != "") {
         $this->_settings['middle_text'] = $middletext;
     }
     if ($hidetime != '1') {
         $this->_settings['hide_time'] = false;
     }
     if ($merge != '1') {
         $this->_settings['merge_fleets'] = false;
     }
     if ($advanced == '1') {
         $this->_settings['advanced_summary'] = true;
     }
     if ($quotes == '1') {
         $this->_settings['harvest_spoiler'] = true;
     }
     $this->_settings['lang'] = $this->_main->getLang();
     return $this->_settings;
 }
Ejemplo n.º 2
0
<?php

/**
 * Created by PhpStorm.
 * User: developer
 */
session_start();
define('appDir', __DIR__);
$errors = FALSE;
$check = FALSE;
require_once appDir . '/class/main.class.php';
$userModel = new Main();
$userModel->checkNewLang();
$pageLang = $userModel->getLang();
$shaKey = $userModel->getSha1();
//если куки есть, проверяем, есть ли у нас в базе такие же, и если есть - ставим в переменную флаг - true
if (isset($_COOKIE[$shaKey]) && !empty($_COOKIE[$shaKey])) {
    $userCookie = $_COOKIE[$shaKey];
    $check = $userModel->checkSession($userCookie);
}
// проверяем существование глобальной переменной, и присваиваем ее переменной
$getAction = isset($_GET["action"]) && !empty($_GET["action"]) ? $_GET["action"] : false;
// если пользователь не залогинен, ему можна показать страницу авторизации, или регистрации
// иначе - профиль или выход
$action = $getAction ? $check ? $getAction : ($getAction != "register" ? "login" : $getAction) : ($check ? "index" : "login");
// действия в зависимости от переменной $action
switch ($action) {
    case "index":
        $userUid = $userModel->getSessionUID($userCookie);
        $user = $userModel->getUser($userUid);
        break;