These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
||
4 | |||
5 | View Code Duplication | if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
6 | message(classLocale::$lang['sys_blitz_page_disabled'], classLocale::$lang['sys_error'], 'overview.php', 10); |
||
7 | die(); |
||
8 | } |
||
9 | |||
10 | define('SN_IN_ALLY', true); |
||
11 | |||
12 | // Main admin page save themes |
||
13 | lng_include('alliance'); |
||
14 | |||
15 | $mode = sys_get_param_str('mode'); |
||
16 | |||
17 | if($mode == 'ainfo') { |
||
18 | include('includes/alliance/ali_info.inc'); |
||
19 | } |
||
20 | |||
21 | if(!$user['ally_id']) { |
||
22 | $user_request = DBStaticAlly::db_ally_request_get_by_user_id($user['id']); |
||
23 | if($user_request['id_user']) { |
||
24 | require('includes/alliance/ali_external_request.inc'); |
||
25 | } else { |
||
26 | switch($mode) { |
||
27 | case 'search': |
||
28 | require('includes/alliance/ali_external_search.inc'); |
||
29 | break; |
||
30 | |||
31 | case 'apply': |
||
32 | require('includes/alliance/ali_external_request.inc'); |
||
33 | break; |
||
34 | |||
35 | case 'make': |
||
36 | require('includes/alliance/ali_external_create_ally.inc'); |
||
37 | break; |
||
38 | |||
39 | default: |
||
40 | display(parsetemplate(gettemplate('ali_external', true)), classLocale::$lang['alliance']); |
||
41 | break; |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 | |||
46 | sn_ali_fill_user_ally($user); |
||
47 | if(!isset($user['ally'])) { |
||
48 | DBStaticUser::db_user_set_by_id_DEPRECATED($user['id'], "`ally_id` = null, `ally_name` = null, `ally_register_time` = 0, `ally_rank_id` = 0"); |
||
0 ignored issues
–
show
|
|||
49 | message(classLocale::$lang['ali_sys_notFound'], classLocale::$lang['your_alliance'], 'alliance.php'); |
||
50 | } |
||
51 | $ally = &$user['ally']; |
||
52 | /* |
||
53 | $ally_rights = array( |
||
54 | 0 => 'name', |
||
55 | 1 => 'mail', |
||
56 | 2 => 'online', |
||
57 | 3 => 'invite', |
||
58 | 4 => 'kick', |
||
59 | 5 => 'admin', |
||
60 | 6 => 'forum', |
||
61 | 7 => 'diplomacy' |
||
62 | ); |
||
63 | */ |
||
64 | $rights_old = array( |
||
65 | 0 => 'name', |
||
66 | 1 => 'mails', |
||
67 | 2 => 'onlinestatus', |
||
68 | 3 => 'bewerbungenbearbeiten', |
||
69 | 4 => 'kick', |
||
70 | 5 => 'rechtehand' |
||
71 | ); |
||
72 | |||
73 | // This piece converting old ally data to new one |
||
74 | // unset($ally['ranklist']); |
||
75 | if(!$ally['ranklist'] && $ally['ally_ranks']) { |
||
76 | $ally_ranks = unserialize($ally['ally_ranks']); |
||
77 | $i = 0; |
||
78 | foreach($ally_ranks as $rank_id => $rank) { |
||
79 | foreach($ally_rights as $key => $value) { |
||
80 | $ranks[$i][$value] = $rank[$rights_old[$key]]; |
||
81 | } |
||
82 | DBStaticUser::db_user_list_set_ally_deprecated_convert_ranks($user['ally_id'], $i, $rank_id); |
||
0 ignored issues
–
show
|
|||
83 | $i++; |
||
84 | } |
||
85 | |||
86 | if(!empty($ranks)) { |
||
87 | ali_rank_list_save($ranks); |
||
88 | } |
||
89 | } |
||
90 | |||
91 | $ranks = ally_get_ranks($ally); |
||
92 | |||
93 | $isAllyOwner = $ally['ally_owner'] == $user['id']; |
||
94 | $user_can_send_mails = $ranks[$user['ally_rank_id']]['mail'] || $isAllyOwner; |
||
95 | $userCanPostForum = $ranks[$user['ally_rank_id']]['forum'] || $isAllyOwner; |
||
96 | $user_onlinestatus = $ranks[$user['ally_rank_id']]['online'] || $isAllyOwner; |
||
97 | $user_admin_applications = $ranks[$user['ally_rank_id']]['invite'] || $isAllyOwner; |
||
98 | $user_can_kick = $ranks[$user['ally_rank_id']]['kick'] || $isAllyOwner; |
||
99 | $user_can_negotiate = $ranks[$user['ally_rank_id']]['diplomacy'] || $isAllyOwner; |
||
100 | $user_can_edit_rights = $user_admin = $ranks[$user['ally_rank_id']]['admin'] || $isAllyOwner; |
||
101 | |||
102 | $edit = sys_get_param_str('edit'); |
||
103 | ally_pre_call(); |
||
104 | switch($mode) { |
||
105 | case 'admin': |
||
106 | if(!array_key_exists($edit, $sn_ali_admin_internal)) { |
||
107 | $edit = 'default'; |
||
108 | } |
||
109 | if($sn_ali_admin_internal[$edit]['include']) { |
||
110 | require("includes/{$sn_ali_admin_internal[$edit]['include']}"); |
||
111 | } |
||
112 | if(isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) { |
||
113 | call_user_func($sn_ali_admin_internal[$edit]['function']); |
||
114 | } |
||
115 | break; |
||
116 | |||
117 | case 'memberslist': |
||
118 | require('includes/alliance/ali_internal_members.inc'); |
||
119 | break; |
||
120 | case 'circular': |
||
121 | require('includes/alliance/ali_internal_admin_mail.inc'); |
||
122 | break; |
||
123 | default: |
||
124 | require('includes/alliance/ali_info.inc'); |
||
125 | break; |
||
126 | } |
||
127 | |||
128 | function ally_pre_call() { |
||
129 | $func_args = func_get_args(); |
||
130 | |||
131 | return sn_function_call(__FUNCTION__, $func_args); |
||
132 | } |
||
133 |
This method has been deprecated.