Пример #1
0
/**
 * Created by PhpStorm.
 * User: Gorlum
 * Date: 17.04.2015
 * Time: 6:37
 */
function sys_user_vacation($user)
{
    global $config;
    if (sys_get_param_str('vacation') == 'leave') {
        if ($user['vacation'] < SN_TIME_NOW) {
            $user['vacation'] = 0;
            $user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout;
            db_user_set_by_id($user['id'], "`vacation` = {$user['vacation']}, `vacation_next` = {$user['vacation_next']}");
        }
    }
    if ($user['vacation']) {
        sn_sys_logout(false, true);
        $template = gettemplate('vacation', true);
        $template->assign_vars(array('NAME' => $user['username'], 'VACATION_END' => date(FMT_DATE_TIME, $user['vacation']), 'CAN_LEAVE' => $user['vacation'] <= SN_TIME_NOW, 'RANDOM' => mt_rand(1, 2)));
        display(parsetemplate($template), '', false, '', false, false);
    }
    return false;
}
Пример #2
0
        sn_db_transaction_start();
        sn_ali_fill_user_ally($user);
        if (!$user['ally']['player']['id']) {
            sn_sys_logout(false, true);
            $debug->error("User ID {$user['id']} has ally ID {$user['ally_id']} but no ally info", 'User record error', 502);
        }
        // TODO UNCOMMENT
        que_process($user['ally']['player']);
        db_user_set_by_id($user['ally']['player']['id'], '`onlinetime` = ' . SN_TIME_NOW);
        sn_db_transaction_commit();
    }
    // TODO - в режиме эмуляции, на самом деле!
    sn_db_transaction_start();
    $global_data = sys_o_get_updated($user['id'], $planet_id, SN_TIME_NOW);
    sn_db_transaction_commit();
    $planetrow = $global_data['planet'];
    if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
        sn_sys_logout(false, true);
        $debug->error("User ID {$user['id']} has no current planet and no homeworld", 'User record error', 502);
    }
    $que = $global_data['que'];
}
require_once 'includes/vars_menu.php';
if ($sn_mvc['model']['']) {
    foreach ($sn_mvc['model'][''] as $hook) {
        if (is_callable($hook_call = is_string($hook) ? $hook : (is_array($hook) ? $hook['callable'] : $hook->callable))) {
            call_user_func($hook_call);
        }
    }
}
sys_user_options_unpack($user);
Пример #3
0
<?php

/**
 * logout.php
 *
 * @version 2.0
 */
define('LOGIN_LOGOUT', true);
include 'common.' . substr(strrchr(__FILE__, '.'), 1);
sn_sys_logout(true);
Пример #4
0
function sec_login_cookie(&$result)
{
    global $user_impersonator;
    // Проверяем куку имперсонатора на доступ
    if ($_COOKIE[SN_COOKIE_I]) {
        $user_impersonator = sec_cookie_user_check($_COOKIE[SN_COOKIE_I]);
        if (empty($user_impersonator) || $user_impersonator['authlevel'] < 3) {
            sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE);
            sn_setcookie(SN_COOKIE_I, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE);
        }
    }
    $result[F_LOGIN_USER] = array();
    // Пытаемся войти по куке
    if (!isset($_COOKIE[SN_COOKIE]) || !$_COOKIE[SN_COOKIE]) {
        // Ошибка кукеса или не найден пользователь по кукесу
        sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE);
        if (!empty($user_impersonator)) {
            // Если это был корректный имперсонатор - просто выходим и редиректимся в админку
            sn_sys_logout();
        }
    } else {
        $result[F_LOGIN_USER] = sec_cookie_user_check($_COOKIE[SN_COOKIE]);
        if (empty($result[F_LOGIN_USER])) {
            $result[F_LOGIN_STATUS] = LOGIN_UNDEFINED;
        } else {
            $result[AUTH_LEVEL] = $result[F_LOGIN_USER]['authlevel'];
            sec_login_process($result);
        }
    }
}