- improved _auto-connections_ for _podded_ pilots, closed #752, closed #355, closed #259, closed #235
This commit is contained in:
@@ -317,7 +317,7 @@ class Map extends Controller\AccessController {
|
||||
$mapDataSystems = (array)$mapDataData['systems'];
|
||||
$mapDataConnections = (array)$mapDataData['connections'];
|
||||
$systemCount = count($mapDataSystems);
|
||||
if( $systemCount <= $defaultConfig['max_systems']){
|
||||
if($systemCount <= $defaultConfig['max_systems']){
|
||||
|
||||
$map->copyfrom($mapDataConfig, ['name', 'icon', 'position', 'locked', 'rallyUpdated', 'rallyPoke']);
|
||||
$map->typeId = $mapType;
|
||||
@@ -583,7 +583,7 @@ class Map extends Controller\AccessController {
|
||||
}
|
||||
// reload the same map model (refresh)
|
||||
// this makes sure all data is up2date
|
||||
$map->getById( $map->_id, 0 );
|
||||
$map->getById($map->_id, 0);
|
||||
|
||||
// broadcast map Access -> and send map Data
|
||||
$this->broadcastMapAccess($map);
|
||||
@@ -717,7 +717,7 @@ class Map extends Controller\AccessController {
|
||||
|
||||
$return->status = $status;
|
||||
|
||||
echo json_encode( $return );
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -817,7 +817,7 @@ class Map extends Controller\AccessController {
|
||||
$return->userData = $activeCharacter->getUser()->getData();
|
||||
}
|
||||
|
||||
echo json_encode( $return );
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -901,7 +901,7 @@ class Map extends Controller\AccessController {
|
||||
// add error (if exists)
|
||||
$return->error = [];
|
||||
|
||||
echo json_encode( $return );
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
|
||||
@@ -987,6 +987,7 @@ class Map extends Controller\AccessController {
|
||||
$addSourceSystem = false;
|
||||
$addTargetSystem = false;
|
||||
$addConnection = false;
|
||||
$route = [];
|
||||
|
||||
switch($mapScope->name){
|
||||
case 'all':
|
||||
@@ -1031,10 +1032,9 @@ class Map extends Controller\AccessController {
|
||||
){
|
||||
// check distance between systems (in jumps)
|
||||
// -> if > 1 it is !very likely! a wormhole
|
||||
$routeController = new Route();
|
||||
$route = $routeController->searchRoute($sourceSystem->systemId, $targetSystem->systemId, 1);
|
||||
$route = (new Route())->searchRoute($sourceSystem->systemId, $targetSystem->systemId, 1);
|
||||
|
||||
if( !$route['routePossible'] ){
|
||||
if(!$route['routePossible']){
|
||||
$addSourceSystem = true;
|
||||
$addTargetSystem = true;
|
||||
$addConnection = true;
|
||||
@@ -1043,7 +1043,7 @@ class Map extends Controller\AccessController {
|
||||
break;
|
||||
}
|
||||
|
||||
// save source system ---------------------------------------------------------------------------------
|
||||
// save source system =============================================================================
|
||||
if(
|
||||
$addSourceSystem &&
|
||||
$sourceSystem &&
|
||||
@@ -1061,7 +1061,7 @@ class Map extends Controller\AccessController {
|
||||
}
|
||||
}
|
||||
|
||||
// save target system ---------------------------------------------------------------------------------
|
||||
// save target system =============================================================================
|
||||
if(
|
||||
$addTargetSystem &&
|
||||
$targetSystem &&
|
||||
@@ -1082,23 +1082,52 @@ class Map extends Controller\AccessController {
|
||||
$sourceSystem &&
|
||||
$targetSystem
|
||||
){
|
||||
$connection = $map->searchConnection( $sourceSystem, $targetSystem);
|
||||
$connection = $map->searchConnection($sourceSystem, $targetSystem);
|
||||
|
||||
// save connection --------------------------------------------------------------------------------
|
||||
// save connection ============================================================================
|
||||
if(
|
||||
$addConnection &&
|
||||
!$connection
|
||||
){
|
||||
$connection = $map->getNewConnection($sourceSystem, $targetSystem);
|
||||
$connection = $map->saveConnection($connection, $character);
|
||||
// get updated maps object
|
||||
if($connection){
|
||||
$map = $connection->mapId;
|
||||
$mapDataChanged = true;
|
||||
// .. do not add connection if character got "podded" -------------------------------------
|
||||
if(
|
||||
$log->shipTypeId == 670 &&
|
||||
$character->cloneLocationId
|
||||
){
|
||||
// .. current character location must be clone location
|
||||
if(
|
||||
(
|
||||
'station' == $character->cloneLocationType &&
|
||||
$character->cloneLocationId == $log->stationId
|
||||
) || (
|
||||
'structure' == $character->cloneLocationType &&
|
||||
$character->cloneLocationId == $log->structureId
|
||||
)
|
||||
){
|
||||
// .. now we need to check jump distance between systems
|
||||
// -> if > 1 it is !very likely! podded jump
|
||||
if(empty($route)){
|
||||
$route = (new Route())->searchRoute($sourceSystem->systemId, $targetSystem->systemId, 1);
|
||||
}
|
||||
|
||||
if(!$route['routePossible']){
|
||||
$addConnection = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($addConnection){
|
||||
$connection = $map->getNewConnection($sourceSystem, $targetSystem);
|
||||
$connection = $map->saveConnection($connection, $character);
|
||||
// get updated maps object
|
||||
if($connection){
|
||||
$map = $connection->mapId;
|
||||
$mapDataChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// log jump mass ----------------------------------------------------------------------------------
|
||||
// log jump mass ==============================================================================
|
||||
if(
|
||||
$connection &&
|
||||
$connection->isWormhole()
|
||||
@@ -1122,7 +1151,7 @@ class Map extends Controller\AccessController {
|
||||
* @param \Base $f3
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getConnectionData (\Base $f3){
|
||||
public function getConnectionData(\Base $f3){
|
||||
$postData = (array)$f3->get('POST');
|
||||
|
||||
$addData = (array)$postData['addData'];
|
||||
@@ -1217,16 +1246,3 @@ class Map extends Controller\AccessController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class User extends Controller\Controller{
|
||||
|
||||
/**
|
||||
* valid reasons for captcha images
|
||||
* @var string array
|
||||
* @var array
|
||||
*/
|
||||
private static $captchaReason = [self::SESSION_CAPTCHA_ACCOUNT_UPDATE, self::SESSION_CAPTCHA_ACCOUNT_DELETE];
|
||||
|
||||
@@ -68,25 +68,27 @@ class User extends Controller\Controller{
|
||||
is_null($currentUser) ||
|
||||
$currentUser->_id !== $user->_id
|
||||
){
|
||||
// user has changed OR new user ---------------------------------------------------
|
||||
// user has changed OR new user -----------------------------------------------------------------------
|
||||
//-> set user/character data to session
|
||||
$this->getF3()->set(self::SESSION_KEY_USER, [
|
||||
'ID' => $user->_id,
|
||||
'NAME' => $user->name
|
||||
]);
|
||||
}else{
|
||||
// user has NOT changed -----------------------------------------------------------
|
||||
// user has NOT changed -------------------------------------------------------------------------------
|
||||
$sessionCharacters = $character::mergeSessionCharacterData($sessionCharacters);
|
||||
}
|
||||
|
||||
$this->getF3()->set(self::SESSION_KEY_CHARACTERS, $sessionCharacters);
|
||||
|
||||
// save user login information --------------------------------------------------------
|
||||
$character->roleId = $character->requestRole();
|
||||
$character->updateCloneData();
|
||||
$character->updateRoleData();
|
||||
|
||||
// save user login information ----------------------------------------------------------------------------
|
||||
$character->touch('lastLogin');
|
||||
$character->save();
|
||||
|
||||
// write login log --------------------------------------------------------------------
|
||||
// write login log ----------------------------------------------------------------------------------------
|
||||
self::getLogger('CHARACTER_LOGIN')->write(
|
||||
sprintf(self::LOG_LOGGED_IN,
|
||||
$user->_id,
|
||||
@@ -96,7 +98,7 @@ class User extends Controller\Controller{
|
||||
)
|
||||
);
|
||||
|
||||
// set temp character data ------------------------------------------------------------
|
||||
// set temp character data --------------------------------------------------------------------------------
|
||||
// -> pass character data over for next http request (reroute())
|
||||
$this->setTempCharacterData($character->_id);
|
||||
|
||||
@@ -263,7 +265,7 @@ class User extends Controller\Controller{
|
||||
if($activeCharacter = $this->getCharacter()){
|
||||
$user = $activeCharacter->getUser();
|
||||
|
||||
// captcha is send -> check captcha -------------------------------------------
|
||||
// captcha is send -> check captcha ---------------------------------------------------------------
|
||||
if(
|
||||
isset($formData['captcha']) &&
|
||||
!empty($formData['captcha'])
|
||||
@@ -303,7 +305,7 @@ class User extends Controller\Controller{
|
||||
}
|
||||
}
|
||||
|
||||
// sharing config -------------------------------------------------------------
|
||||
// sharing config ---------------------------------------------------------------------------------
|
||||
if(isset($formData['share'])){
|
||||
$privateSharing = (int)$formData['privateSharing'];
|
||||
$corporationSharing = (int)$formData['corporationSharing'];
|
||||
@@ -327,7 +329,7 @@ class User extends Controller\Controller{
|
||||
$activeCharacter->save();
|
||||
}
|
||||
|
||||
// character config -----------------------------------------------------------
|
||||
// character config -------------------------------------------------------------------------------
|
||||
if(isset($formData['character'])){
|
||||
$activeCharacter->copyfrom($formData, ['logLocation', 'selectLocation']);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class Sso extends Api\User{
|
||||
isset($params['characterId']) &&
|
||||
( $activeCharacter = $this->getCharacter() )
|
||||
){
|
||||
// authentication restricted to a characterId -----------------------------------------------
|
||||
// authentication restricted to a characterId -------------------------------------------------------------
|
||||
// restrict login to this characterId e.g. for character switch on map page
|
||||
$characterId = (int)trim((string)$params['characterId']);
|
||||
|
||||
@@ -114,7 +114,7 @@ class Sso extends Api\User{
|
||||
$f3->set(self::SESSION_KEY_SSO_FROM, 'map');
|
||||
}
|
||||
|
||||
// redirect to CCP SSO ----------------------------------------------------------------------
|
||||
// redirect to CCP SSO ----------------------------------------------------------------------------------------
|
||||
$scopes = self::getScopesByAuthType();
|
||||
$this->rerouteAuthorization($f3, $scopes);
|
||||
}
|
||||
|
||||
@@ -384,13 +384,11 @@ class Controller {
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getSessionCharacterData(){
|
||||
public function getSessionCharacterData() : array {
|
||||
$data = [];
|
||||
|
||||
if($user = $this->getUser()){
|
||||
$header = self::getRequestHeaders();
|
||||
$requestedCharacterId = (int)$header['Pf-Character'];
|
||||
|
||||
if( !$this->getF3()->get('AJAX') ){
|
||||
$requestedCharacterId = (int)$_COOKIE['old_char_id'];
|
||||
if(!$requestedCharacterId){
|
||||
@@ -398,7 +396,6 @@ class Controller {
|
||||
if((int)$tempCharacterData['ID'] > 0){
|
||||
$requestedCharacterId = (int)$tempCharacterData['ID'];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1376,7 +1376,6 @@ class Setup extends Controller {
|
||||
ksort($requiredTables);
|
||||
|
||||
$this->databases[$dbAlias]['info'] = [
|
||||
// 'db' => $db,
|
||||
'label' => $dbLabel,
|
||||
'host' => $dbConfigValues['SOCKET'] ? : $dbConfigValues['HOST'],
|
||||
'port' => $dbConfigValues['PORT'] && !$dbConfigValues['SOCKET'] ? $dbConfigValues['PORT'] : '',
|
||||
|
||||
Reference in New Issue
Block a user