Skip to content

Commit

Permalink
Merge pull request #777 from exodus4d/develop
Browse files Browse the repository at this point in the history
v1.5.1
  • Loading branch information
exodus4d authored May 11, 2019
2 parents 38c1a26 + 2b68ccc commit ef6676c
Show file tree
Hide file tree
Showing 240 changed files with 6,452 additions and 4,410 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ Temporary Items
/public/js/vX.X.X/
/vendor/
/history/
/package-lock.json
4 changes: 2 additions & 2 deletions app/environment.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CCP_SSO_DOWNTIME = 11:00
; CCP ESI API
CCP_ESI_URL = https://esi.evetech.net
CCP_ESI_DATASOURCE = singularity
CCP_ESI_SCOPES = esi-location.read_online.v1,esi-location.read_location.v1,esi-location.read_ship_type.v1,esi-ui.write_waypoint.v1,esi-ui.open_window.v1,esi-universe.read_structures.v1,esi-corporations.read_corporation_membership.v1
CCP_ESI_SCOPES = esi-location.read_online.v1,esi-location.read_location.v1,esi-location.read_ship_type.v1,esi-ui.write_waypoint.v1,esi-ui.open_window.v1,esi-universe.read_structures.v1,esi-corporations.read_corporation_membership.v1,esi-clones.read_clones.v1
CCP_ESI_SCOPES_ADMIN =

; SMTP settings (optional)
Expand Down Expand Up @@ -88,7 +88,7 @@ CCP_SSO_DOWNTIME = 11:00
; CCP ESI API
CCP_ESI_URL = https://esi.evetech.net
CCP_ESI_DATASOURCE = tranquility
CCP_ESI_SCOPES = esi-location.read_online.v1,esi-location.read_location.v1,esi-location.read_ship_type.v1,esi-ui.write_waypoint.v1,esi-ui.open_window.v1,esi-universe.read_structures.v1,esi-corporations.read_corporation_membership.v1
CCP_ESI_SCOPES = esi-location.read_online.v1,esi-location.read_location.v1,esi-location.read_ship_type.v1,esi-ui.write_waypoint.v1,esi-ui.open_window.v1,esi-universe.read_structures.v1,esi-corporations.read_corporation_membership.v1,esi-clones.read_clones.v1
CCP_ESI_SCOPES_ADMIN =

; SMTP settings (optional)
Expand Down
207 changes: 161 additions & 46 deletions app/lib/db/cortex.php

Large diffs are not rendered by default.

35 changes: 24 additions & 11 deletions app/lib/db/sql/schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
* https://github.com/ikkez/F3-Sugar/
*
* @package DB
* @version 2.2.2
* @date 06.03.2018
* @version 2.2.3
* @date 15.05.2018
**/


Expand Down Expand Up @@ -375,7 +375,8 @@ protected function _addIndex($index_cols, $search_cols, $unique, $length)
if(strtoupper($search_cols[$index_cols[$i]]['type']) == 'TEXT')
$col.='('.$length.')';
$cols = implode(',', $quotedCols);
$name = $this->db->quotekey($this->name.'___'.implode('__', $index_cols));
$name = $this->assembleIndexKey($index_cols,$this->name);
$name = $this->db->quotekey($name);
$table = $this->db->quotekey($this->name);
$index = $unique ? 'UNIQUE INDEX' : 'INDEX';
$cmd = array(
Expand All @@ -388,6 +389,22 @@ protected function _addIndex($index_cols, $search_cols, $unique, $length)
$this->queries[] = $query;
}

/**
* create index name from one or more given column names, max. 64 char lengths
* @param string|array $index_cols
* @return string
*/
protected function assembleIndexKey($index_cols,$table_name) {
if (!is_array($index_cols))
$index_cols = array($index_cols);
$name = $table_name.'___'.implode('__', $index_cols);
if (strlen($name)>64)
$name=$table_name.'___'.\Base::instance()->hash(implode('__', $index_cols));
if (strlen($name)>64)
$name='___'.\Base::instance()->hash($table_name.'___'.implode('__', $index_cols));
return $name;
}

/**
* set primary / composite key to table
* @param string|array $pkeys
Expand Down Expand Up @@ -651,9 +668,6 @@ protected function _sqlite_rebuild($exec=true)
unset($existing_columns[$name]);
// drop index
foreach (array_keys($indexes) as $col) {
// for backward compatibility
if ($col == $name)
unset($indexes[$name]);
// new index names
if ($col == $this->name.'___'.$name)
unset($indexes[$this->name.'___'.$name]);
Expand All @@ -663,11 +677,10 @@ protected function _sqlite_rebuild($exec=true)
$col = explode('___', $col);
$ci = explode('__', $col[1]);
$col = implode('___',$col);
} else // for backward compatibility
$ci = explode('__', $col);
// drop combined index
if (in_array($name, $ci))
unset($indexes[$col]);
// drop combined index
if (in_array($name, $ci))
unset($indexes[$col]);
}
}
}
}
Expand Down
24 changes: 10 additions & 14 deletions app/main/controller/accesscontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

namespace Controller;

use lib\Config;
use lib\Socket;
use Model;

use Model\Pathfinder;

class AccessController extends Controller {

Expand All @@ -20,9 +19,8 @@ class AccessController extends Controller {
* @param $params
* @return bool
* @throws \Exception
* @throws \ZMQSocketException
*/
function beforeroute(\Base $f3, $params): bool {
function beforeroute(\Base $f3, $params) : bool {
if($return = parent::beforeroute($f3, $params)){
// Any route/endpoint of a child class of this one,
// requires a valid logged in user!
Expand All @@ -43,7 +41,7 @@ function beforeroute(\Base $f3, $params): bool {
* @return string
* @throws \Exception
*/
protected function isLoggedIn(\Base $f3): string {
protected function isLoggedIn(\Base $f3) : string {
$loginStatus = 'UNKNOWN';
if($character = $this->getCharacter()){
if($character->checkLoginTimer()){
Expand All @@ -65,7 +63,7 @@ protected function isLoggedIn(\Base $f3): string {
$f3->get('DEBUG') === 3
){
self::getLogger('CHARACTER_ACCESS')->write(
sprintf(Model\CharacterModel::LOG_ACCESS,
sprintf(Pathfinder\CharacterModel::LOG_ACCESS,
$character->_id ,
$loginStatus,
$character->name
Expand All @@ -79,23 +77,21 @@ protected function isLoggedIn(\Base $f3): string {
/**
* broadcast map data to clients
* -> send over TCP Socket
* @param Model\MapModel $map
* @return int (number of active connections for this map)
* @param Pathfinder\MapModel $map
* @throws \Exception
* @throws \ZMQSocketException
*/
protected function broadcastMapData(Model\MapModel $map){
protected function broadcastMapData(Pathfinder\MapModel $map) : void {
$mapData = $this->getFormattedMapData($map);
return (int)(new Socket( Config::getSocketUri() ))->sendData('mapUpdate', $mapData);
$this->getF3()->webSocket()->write('mapUpdate', $mapData);
}

/**
* get formatted Map Data
* @param Model\MapModel $map
* @param Pathfinder\MapModel $map
* @return array
* @throws \Exception
*/
protected function getFormattedMapData(Model\MapModel $map){
protected function getFormattedMapData(Pathfinder\MapModel $map) : array {
$mapData = $map->getData();

return [
Expand Down
12 changes: 6 additions & 6 deletions app/main/controller/admin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created by PhpStorm.
* User: exodu
* User: Exodus 4D
* Date: 12.05.2017
* Time: 20:30
*/
Expand All @@ -11,10 +11,10 @@

use Controller\Ccp\Sso;
use lib\Config;
use Model\CharacterModel;
use Model\CorporationModel;
use Model\MapModel;
use Model\RoleModel;
use Model\Pathfinder\CharacterModel;
use Model\Pathfinder\CorporationModel;
use Model\Pathfinder\MapModel;
use Model\Pathfinder\RoleModel;

class Admin extends Controller{

Expand Down Expand Up @@ -348,7 +348,7 @@ protected function filterValidMaps(CharacterModel $character, int $mapId) {
* @param string $type
* @return \Log
*/
static function getLogger($type = 'ADMIN'){
static function getLogger($type = 'ADMIN') : \Log {
return parent::getLogger('ADMIN');
}

Expand Down
8 changes: 4 additions & 4 deletions app/main/controller/api/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Controller\Api;

use Controller;
use Model;
use Model\Pathfinder;

class Access extends Controller\AccessController {

Expand All @@ -33,13 +33,13 @@ public function search($f3, $params){
$accessModel = null;
switch($searchType){
case 'character':
$accessModel = Model\BasicModel::getNew('CharacterModel');
$accessModel = Pathfinder\AbstractPathfinderModel::getNew('CharacterModel');
break;
case 'corporation':
$accessModel = Model\BasicModel::getNew('CorporationModel');
$accessModel = Pathfinder\AbstractPathfinderModel::getNew('CorporationModel');
break;
case 'alliance':
$accessModel = Model\BasicModel::getNew('AllianceModel');
$accessModel = Pathfinder\AbstractPathfinderModel::getNew('AllianceModel');
break;
}

Expand Down
Loading

0 comments on commit ef6676c

Please sign in to comment.