supernova-ws /
SuperNova
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) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 6 | message($lang['sys_blitz_page_disabled'], $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 | { |
||
| 19 | include('includes/alliance/ali_info.inc'); |
||
| 20 | } |
||
| 21 | |||
| 22 | if(!$user['ally_id']) |
||
| 23 | { |
||
| 24 | $user_request = doquery("SELECT * FROM {{alliance_requests}} WHERE `id_user` ='{$user['id']}' LIMIT 1;", '', true); |
||
| 25 | if($user_request['id_user']) |
||
| 26 | { |
||
| 27 | require('includes/alliance/ali_external_request.inc'); |
||
| 28 | } |
||
| 29 | else |
||
| 30 | { |
||
| 31 | switch($mode) |
||
| 32 | { |
||
| 33 | case 'search': |
||
| 34 | require('includes/alliance/ali_external_search.inc'); |
||
| 35 | break; |
||
| 36 | |||
| 37 | case 'apply': |
||
| 38 | require('includes/alliance/ali_external_request.inc'); |
||
| 39 | break; |
||
| 40 | |||
| 41 | case 'make': |
||
| 42 | require('includes/alliance/ali_external_create_ally.inc'); |
||
| 43 | break; |
||
| 44 | |||
| 45 | default: |
||
| 46 | display(parsetemplate(gettemplate('ali_external', true)), $lang['alliance']); |
||
| 47 | break; |
||
| 48 | } |
||
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | sn_ali_fill_user_ally($user); |
||
| 53 | //$ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$user['ally_id']}'", '', true); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
60% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 54 | if(!isset($user['ally'])) |
||
| 55 | { |
||
| 56 | db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_register_time` = 0, `ally_rank_id` = 0"); |
||
| 57 | message($lang['ali_sys_notFound'], $lang['your_alliance'], 'alliance.php'); |
||
| 58 | } |
||
| 59 | $ally = &$user['ally']; |
||
| 60 | /* |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
56% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 61 | $ally_rights = array( |
||
| 62 | 0 => 'name', |
||
| 63 | 1 => 'mail', |
||
| 64 | 2 => 'online', |
||
| 65 | 3 => 'invite', |
||
| 66 | 4 => 'kick', |
||
| 67 | 5 => 'admin', |
||
| 68 | 6 => 'forum', |
||
| 69 | 7 => 'diplomacy' |
||
| 70 | ); |
||
| 71 | */ |
||
| 72 | $rights_old = array( |
||
| 73 | 0 => 'name', |
||
| 74 | 1 => 'mails', |
||
| 75 | 2 => 'onlinestatus', |
||
| 76 | 3 => 'bewerbungenbearbeiten', |
||
| 77 | 4 => 'kick', |
||
| 78 | 5 => 'rechtehand' |
||
| 79 | ); |
||
| 80 | |||
| 81 | // This piece converting old ally data to new one |
||
| 82 | // unset($ally['ranklist']); |
||
| 83 | if(!$ally['ranklist'] && $ally['ally_ranks']) |
||
| 84 | { |
||
| 85 | $ally_ranks = unserialize($ally['ally_ranks']); |
||
| 86 | $i = 0; |
||
| 87 | foreach($ally_ranks as $rank_id => $rank) |
||
| 88 | { |
||
| 89 | foreach($ally_rights as $key => $value) |
||
| 90 | { |
||
| 91 | $ranks[$i][$value] = $rank[$rights_old[$key]]; |
||
| 92 | } |
||
| 93 | db_user_list_set_ally_deprecated_convert_ranks($user['ally_id'], $i, $rank_id); |
||
| 94 | $i++; |
||
| 95 | } |
||
| 96 | |||
| 97 | if(!empty($ranks)) |
||
| 98 | { |
||
| 99 | ali_rank_list_save($ranks); |
||
| 100 | } |
||
| 101 | } |
||
| 102 | |||
| 103 | $ranks = ally_get_ranks($ally); |
||
| 104 | |||
| 105 | $isAllyOwner = $ally['ally_owner'] == $user['id']; |
||
| 106 | $user_can_send_mails = $ranks[$user['ally_rank_id']]['mail'] || $isAllyOwner; |
||
| 107 | $userCanPostForum = $ranks[$user['ally_rank_id']]['forum'] || $isAllyOwner; |
||
| 108 | $user_onlinestatus = $ranks[$user['ally_rank_id']]['online'] || $isAllyOwner; |
||
| 109 | $user_admin_applications = $ranks[$user['ally_rank_id']]['invite'] || $isAllyOwner; |
||
| 110 | $user_can_kick = $ranks[$user['ally_rank_id']]['kick'] || $isAllyOwner; |
||
| 111 | $user_can_negotiate = $ranks[$user['ally_rank_id']]['diplomacy'] || $isAllyOwner; |
||
| 112 | $user_can_edit_rights = $user_admin = $ranks[$user['ally_rank_id']]['admin'] || $isAllyOwner; |
||
| 113 | |||
| 114 | $edit = sys_get_param_str('edit'); |
||
| 115 | ally_pre_call(); |
||
| 116 | switch($mode) |
||
| 117 | { |
||
| 118 | case 'admin': |
||
| 119 | if(!array_key_exists($edit , $sn_ali_admin_internal)) |
||
| 120 | { |
||
| 121 | $edit = 'default'; |
||
| 122 | } |
||
| 123 | if($sn_ali_admin_internal[$edit]['include']) |
||
| 124 | { |
||
| 125 | require("includes/{$sn_ali_admin_internal[$edit]['include']}"); |
||
| 126 | } |
||
| 127 | if(isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) |
||
| 128 | { |
||
| 129 | call_user_func($sn_ali_admin_internal[$edit]['function']); |
||
| 130 | } |
||
| 131 | break; |
||
| 132 | |||
| 133 | case 'memberslist': require('includes/alliance/ali_internal_members.inc'); break; |
||
| 134 | case 'circular': require('includes/alliance/ali_internal_admin_mail.inc'); break; |
||
| 135 | default: require('includes/alliance/ali_info.inc'); break; |
||
| 136 | } |
||
| 137 | |||
| 138 | function ally_pre_call(){$func_args = func_get_args();return sn_function_call('ally_pre_call', $func_args);} |
||
| 139 | |||
| 140 | ?> |
||
|
0 ignored issues
–
show
It is not recommended to use PHP's closing tag
?> in files other than templates.
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore. A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever. Loading history...
|
|||
| 141 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.