supernova-ws /
SuperNova
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * admin/add_moon.php |
||||
| 5 | * |
||||
| 6 | * @version 2 |
||||
| 7 | * @copyright 2014 Gorlum for http://supernova.ws |
||||
| 8 | */ |
||||
| 9 | |||||
| 10 | use DBAL\db_mysql; |
||||
| 11 | use Planet\DBStaticPlanet; |
||||
| 12 | use Universe\Universe; |
||||
|
0 ignored issues
–
show
|
|||||
| 13 | |||||
| 14 | define('INSIDE', true); |
||||
| 15 | define('INSTALL', false); |
||||
| 16 | define('IN_ADMIN', true); |
||||
| 17 | |||||
| 18 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
||||
| 19 | |||||
| 20 | global $lang, $user; |
||||
| 21 | |||||
| 22 | SnTemplate::messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
||||
| 23 | |||||
| 24 | $template = SnTemplate::gettemplate("admin/add_moon", true); |
||||
|
0 ignored issues
–
show
true of type true is incompatible with the type null|template expected by parameter $template of SnTemplate::gettemplate().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 25 | |||||
| 26 | if(sys_get_param_str('mode') == 'addit') |
||||
| 27 | { |
||||
| 28 | $PlanetID = sys_get_param_id('user'); |
||||
| 29 | $MoonName = sys_get_param_str('name'); |
||||
| 30 | |||||
| 31 | db_mysql::db_transaction_start(); |
||||
| 32 | $PlanetSelected = DBStaticPlanet::db_planet_by_id($PlanetID, true); |
||||
| 33 | uni_create_moon($PlanetSelected['galaxy'], $PlanetSelected['system'], $PlanetSelected['planet'], $PlanetSelected['id_owner'], Universe::moonSizeRandom(), false, ['name' => $MoonName]); |
||||
| 34 | db_mysql::db_transaction_commit(); |
||||
| 35 | |||||
| 36 | SnTemplate::messageBoxAdmin($lang['addm_done'], $lang['addm_title']); |
||||
| 37 | } |
||||
| 38 | |||||
| 39 | SnTemplate::display($template, $lang['addm_title']); |
||||
| 40 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: