diff --git a/app/main/controller/api/route.php b/app/main/controller/api/route.php index 885b0dd6..a6b69e59 100644 --- a/app/main/controller/api/route.php +++ b/app/main/controller/api/route.php @@ -109,12 +109,14 @@ class Route extends Controller\AccessController { * @param array $filterData */ private function setDynamicJumpData($mapIds = [], $filterData = []){ + // make sure, mapIds are integers (protect against SQL injections) + $mapIds = array_unique( array_map('intval', $mapIds), SORT_NUMERIC); if( !empty($mapIds) ){ - // make sure, mapIds are integers (protect against SQL injections) - $mapIds = array_map('intval', $mapIds); + // map filter --------------------------------------------------------------------------------------------- + $whereMapIdsQuery = (count($mapIds) == 1) ? " = " . reset($mapIds) : " IN (" . implode(', ', $mapIds) . ")"; - // connection filter -------------------------------------------------------- + // connection filter -------------------------------------------------------------------------------------- $whereQuery = ""; $includeScopes = []; $includeTypes = []; @@ -157,7 +159,7 @@ class Route extends Controller\AccessController { } } - // search connections ------------------------------------------------------- + // search connections ------------------------------------------------------------------------------------- if( !empty($includeScopes) ){ $whereQuery .= " `connection`.`scope` IN ('" . implode("', '", $includeScopes) . "') AND "; @@ -188,7 +190,7 @@ class Route extends Controller\AccessController { `system_tar`.`id` = `connection`.`source` OR `system_tar`.`id` = `connection`.`target` WHERE - `connection`.`mapId` IN (" . implode(', ', $mapIds) . ") AND + `connection`.`mapId` " . $whereMapIdsQuery . " AND `connection`.`active` = 1 AND ( `connection`.`source` = `system_src`.`id` OR @@ -204,7 +206,7 @@ class Route extends Controller\AccessController { `map` ON `map`.`id` = `system_src`.`mapId` WHERE - `system_src`.`mapId` IN (" . implode(', ', $mapIds) . ") AND + `system_src`.`mapId` " . $whereMapIdsQuery . " AND `system_src`.`active` = 1 AND `map`.`active` = 1 HAVING @@ -237,7 +239,7 @@ class Route extends Controller\AccessController { $systemId = (int)$row['systemId']; $secStatus = (float)$row['trueSec']; - // fill "nameArray" data ---------------------------------------------------- + // fill "nameArray" data ---------------------------------------------------------------------------------- if( !isset($this->nameArray[$systemId]) ){ $this->nameArray[$systemId][0] = $systemName; $this->nameArray[$systemId][1] = $regionId; @@ -245,12 +247,12 @@ class Route extends Controller\AccessController { $this->nameArray[$systemId][3] = $secStatus; } - // fill "idArray" data ------------------------------------------------------ + // fill "idArray" data ------------------------------------------------------------------------------------ if( !isset($this->idArray[$systemName]) ){ $this->idArray[$systemName] = $systemId; } - // fill "jumpArray" data ---------------------------------------------------- + // fill "jumpArray" data ---------------------------------------------------------------------------------- if( !is_array($this->jumpArray[$systemName]) ){ $this->jumpArray[$systemName] = []; } @@ -536,7 +538,7 @@ class Route extends Controller\AccessController { $mapData = (array)$routeData['mapIds']; $mapData = array_flip( array_map('intval', $mapData) ); - // check map access (filter requested mapIDs and format) -------------------- + // check map access (filter requested mapIDs and format) ---------------------------------------------- array_walk($mapData, function(&$item, &$key, $data){ if( isset($data[1][$key]) ){ diff --git a/app/main/controller/api/system.php b/app/main/controller/api/system.php index c384e064..725554d0 100644 --- a/app/main/controller/api/system.php +++ b/app/main/controller/api/system.php @@ -429,14 +429,14 @@ class System extends Controller\AccessController { if( $system = $map->getSystemById($systemId) ){ // check whether system should be deleted OR set "inactive" if( - empty($system->alias) && - empty($system->description) + !empty($system->description) || + ( !empty($system->alias) && ($system->alias != $system->name) ) ){ - $system->erase(); - }else{ // keep data -> set "inactive" $system->setActive(false); $system->save(); + }else{ + $system->erase(); } $system->reset(); diff --git a/app/main/model/systemmodel.php b/app/main/model/systemmodel.php index f46c9548..f3fd8941 100644 --- a/app/main/model/systemmodel.php +++ b/app/main/model/systemmodel.php @@ -283,6 +283,22 @@ class SystemModel extends BasicModel { return $systemData; } + /** + * setter for system alias + * @param string $alias + * @return string + */ + public function set_alias($alias){ + $alias = trim($alias); + + // we donĀ“t need redundant data. "name" is always preferred if "alias" is empty + if($alias === $this->name){ + $alias = ''; + } + + return $alias; + } + /** * setter for system security value * @param float $trueSec diff --git a/composer.json b/composer.json index 3207a1f8..f6d0fd16 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,6 @@ "php-64bit": ">=7.0", "ext-zmq": "1.1.*", "react/zmq": "0.3.*", - "exodus4d/pathfinder_esi": "dev-master" + "exodus4d/pathfinder_esi": "dev-master#v1.0.0" } } diff --git a/js/app/map/local.js b/js/app/map/local.js index 53a878b0..3cb6f093 100644 --- a/js/app/map/local.js +++ b/js/app/map/local.js @@ -1,5 +1,5 @@ /** - * map overlay functions for "Near by" table + * map overlay functions for "Nearby" table * Created by Exodus on 13.04.2017. */ @@ -329,7 +329,7 @@ define([ class: config.overlayLocalHeadlineClass }).append( $('', { - html: 'Near by   ', + html: 'Nearby   ', class: 'pull-left' }), $(''), diff --git a/js/app/map/map.js b/js/app/map/map.js index 6f308f4b..32b1baaa 100644 --- a/js/app/map/map.js +++ b/js/app/map/map.js @@ -2893,7 +2893,7 @@ define([ // current user system is on this map currentSystemData = currentSystemData[0]; - // check for active users "near by" (x jumps radius) + // check for active users "nearby" (x jumps radius) let nearBySystemData = Util.getNearBySystemData(currentSystemData, currentMapData, MapUtil.config.defaultLocalJumpRadius); let nearByCharacterData = Util.getNearByCharacterData(nearBySystemData, userData.data.systems); diff --git a/js/app/map/util.js b/js/app/map/util.js index 06b0fc3f..fe328300 100644 --- a/js/app/map/util.js +++ b/js/app/map/util.js @@ -12,7 +12,7 @@ define([ let config = { mapSnapToGridDimension: 20, // px for grid snapping (grid YxY) - defaultLocalJumpRadius: 3, // default search radius (in jumps) for "near by" pilots + defaultLocalJumpRadius: 3, // default search radius (in jumps) for "nearby" pilots // local storage characterLocalStoragePrefix: 'character_', // prefix for character data local storage key diff --git a/js/app/util.js b/js/app/util.js index 09d43199..9a20b59c 100644 --- a/js/app/util.js +++ b/js/app/util.js @@ -1872,7 +1872,7 @@ define([ }; /** - * get current character data from all characters who are "near by" the current user + * get current character data from all characters who are "nearby" the current user * -> see getNearBySystemData() * @param nearBySystems * @param userData diff --git a/public/js/v1.2.2/app/map/local.js b/public/js/v1.2.2/app/map/local.js index 53a878b0..3cb6f093 100644 --- a/public/js/v1.2.2/app/map/local.js +++ b/public/js/v1.2.2/app/map/local.js @@ -1,5 +1,5 @@ /** - * map overlay functions for "Near by" table + * map overlay functions for "Nearby" table * Created by Exodus on 13.04.2017. */ @@ -329,7 +329,7 @@ define([ class: config.overlayLocalHeadlineClass }).append( $('', { - html: 'Near by   ', + html: 'Nearby   ', class: 'pull-left' }), $(''), diff --git a/public/js/v1.2.2/app/map/map.js b/public/js/v1.2.2/app/map/map.js index 6f308f4b..32b1baaa 100644 --- a/public/js/v1.2.2/app/map/map.js +++ b/public/js/v1.2.2/app/map/map.js @@ -2893,7 +2893,7 @@ define([ // current user system is on this map currentSystemData = currentSystemData[0]; - // check for active users "near by" (x jumps radius) + // check for active users "nearby" (x jumps radius) let nearBySystemData = Util.getNearBySystemData(currentSystemData, currentMapData, MapUtil.config.defaultLocalJumpRadius); let nearByCharacterData = Util.getNearByCharacterData(nearBySystemData, userData.data.systems); diff --git a/public/js/v1.2.2/app/map/util.js b/public/js/v1.2.2/app/map/util.js index 06b0fc3f..fe328300 100644 --- a/public/js/v1.2.2/app/map/util.js +++ b/public/js/v1.2.2/app/map/util.js @@ -12,7 +12,7 @@ define([ let config = { mapSnapToGridDimension: 20, // px for grid snapping (grid YxY) - defaultLocalJumpRadius: 3, // default search radius (in jumps) for "near by" pilots + defaultLocalJumpRadius: 3, // default search radius (in jumps) for "nearby" pilots // local storage characterLocalStoragePrefix: 'character_', // prefix for character data local storage key diff --git a/public/js/v1.2.2/app/util.js b/public/js/v1.2.2/app/util.js index 09d43199..9a20b59c 100644 --- a/public/js/v1.2.2/app/util.js +++ b/public/js/v1.2.2/app/util.js @@ -1872,7 +1872,7 @@ define([ }; /** - * get current character data from all characters who are "near by" the current user + * get current character data from all characters who are "nearby" the current user * -> see getNearBySystemData() * @param nearBySystems * @param userData diff --git a/public/templates/ui/notice.html b/public/templates/ui/notice.html index 63feb25e..c69e2423 100644 --- a/public/templates/ui/notice.html +++ b/public/templates/ui/notice.html @@ -7,7 +7,7 @@
    -
  • New "Near by" map overlay shows active pilots within 3 jumps around your current location
  • +
  • New "Nearby" map overlay shows active pilots within 3 jumps around your current location
  • Switch to CCPs new ESI API. Replaces CREST API.
  • New UI options added. E.g. Remote open inGame information windows
  • Added new filter option for "Frigat wormholes" to route finder
  • diff --git a/public/templates/view/index.html b/public/templates/view/index.html index a9b751d7..84f4233d 100644 --- a/public/templates/view/index.html +++ b/public/templates/view/index.html @@ -53,7 +53,25 @@ {* Youtube verification code *} - + {* Resources *} + + + + + + + {* Prefetch / Preload *} + + + + + + + + + + + @@ -61,7 +79,7 @@ - +