-
Notifications
You must be signed in to change notification settings - Fork 23
/
options.php
43 lines (40 loc) · 1.42 KB
/
options.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
require('lib/header.php');
require_once('lib/lib_achievements.php');
$action = GET('act', '');
switch ($action) {
case 'save':
save_user_options(POST('options'));
alert_set('success','Настройки сохранены');
header('Location:options.php');
break;
case 'save_team':
$team_id = POST('team_id', 0);
$team_name = POST('new_team_name', false);
save_user_team($team_id, $team_name);
if ($team_id || $team_name) {
$am = new AchievementsManager((int)$_SESSION['user_id']);
$am->emit(EventTypes::JOINED_TEAM);
}
alert_set('success','Настройки сохранены');
header('Location:options.php');
break;
case 'readonly_on':
set_readonly_on();
header('Location:options.php');
break;
case 'readonly_off':
set_readonly_off();
header('Location:options.php');
break;
default:
check_logged();
$mgr = new UserOptionsManager();
$smarty->assign('meta', $mgr->get_all_options(true));
$smarty->assign('current_email', get_user_email($_SESSION['user_id']));
$smarty->assign('current_name', get_user_shown_name($_SESSION['user_id']));
$smarty->assign('teams',get_team_list());
$smarty->assign('user_team',get_user_team($_SESSION['user_id']));
$smarty->display('options.tpl');
}
log_timing();