supernova-ws /
SuperNova
| 1 | <?php |
||||
|
0 ignored issues
–
show
|
|||||
| 2 | |||||
| 3 | use Planet\DBStaticPlanet; |
||||
| 4 | |||||
| 5 | define('INSIDE', true); |
||||
| 6 | define('INSTALL', false); |
||||
| 7 | define('IN_ADMIN', true); |
||||
| 8 | |||||
| 9 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
||||
| 10 | |||||
| 11 | global $lang, $user; |
||||
| 12 | |||||
| 13 | messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
||||
| 14 | |||||
| 15 | messageBoxAdmin('Временно не работает'); |
||||
| 16 | |||||
| 17 | require("includes/admin_planet_edit.inc" . DOT_PHP_EX); |
||||
| 18 | |||||
| 19 | $template = gettemplate('admin/admin_planet_edit', true); |
||||
| 20 | |||||
| 21 | $mode = admin_planet_edit_mode($template, $admin_planet_edit_mode_list); |
||||
| 22 | $planet_id = sys_get_param_id('planet_id'); |
||||
| 23 | |||||
| 24 | $unit_list = sys_get_param('unit_list'); |
||||
| 25 | if(sys_get_param('change_data') && !empty($unit_list)) |
||||
| 26 | { |
||||
| 27 | $query_string = array(); |
||||
| 28 | foreach($unit_list as $unit_id => $unit_amount) |
||||
| 29 | { |
||||
| 30 | if($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
||||
| 31 | { |
||||
| 32 | $query_string[] = $unit_query_string; |
||||
| 33 | } |
||||
| 34 | } |
||||
| 35 | |||||
| 36 | if(!empty($query_string)) |
||||
| 37 | { |
||||
| 38 | DBStaticPlanet::db_planet_set_by_id($planet_id, implode(', ', $query_string)); |
||||
| 39 | } |
||||
| 40 | } |
||||
| 41 | |||||
| 42 | if($planet_id) |
||||
| 43 | { |
||||
| 44 | $edit_planet_row = DBStaticPlanet::db_planet_by_id($planet_id); |
||||
|
0 ignored issues
–
show
It seems like
$planet_id can also be of type string; however, parameter $planet_id of Planet\DBStaticPlanet::db_planet_by_id() does only seem to accept integer, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 45 | admin_planet_edit_template($template, $edit_planet_row, $mode); |
||||
| 46 | } |
||||
| 47 | |||||
| 48 | foreach($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
||||
| 49 | { |
||||
| 50 | $template->assign_block_vars('page_menu', array( |
||||
| 51 | 'ID' => $page_mode, |
||||
| 52 | 'TEXT' => $mode_locale, |
||||
| 53 | )); |
||||
| 54 | } |
||||
| 55 | |||||
| 56 | $template->assign_vars(array( |
||||
| 57 | 'MODE' => $mode, |
||||
| 58 | 'PLANET_ID' => $planet_id, |
||||
| 59 | 'PLANET_NAME' => empty($edit_planet_row) ? '' : $lang['sys_planet_type'][$edit_planet_row['planet_type']] . ' ' . uni_render_planet($edit_planet_row), |
||||
| 60 | 'PAGE_HINT' => $lang['adm_planet_edit_hint'], |
||||
| 61 | )); |
||||
| 62 | |||||
| 63 | display($template, $lang['adm_am_ttle']); |
||||
| 64 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.