IGB Header support implemented
This commit is contained in:
@@ -170,4 +170,5 @@ class AccessController extends Controller {
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -85,5 +85,44 @@ class Controller {
|
||||
$this->setTemplate('templates/view/login.html');
|
||||
}
|
||||
|
||||
/**
|
||||
* check weather the page is IGB trusted or not
|
||||
* @return mixed
|
||||
*/
|
||||
static function isIGBTrusted(){
|
||||
|
||||
$igbHeaderData = self::getIGBHeaderData();
|
||||
|
||||
return $igbHeaderData->trusted;
|
||||
}
|
||||
|
||||
/**
|
||||
* extract all eve IGB specific header data
|
||||
* @return object
|
||||
*/
|
||||
static function getIGBHeaderData(){
|
||||
$data = (object) [];
|
||||
$data->trusted = false;
|
||||
$data->values = [];
|
||||
$headerData = apache_request_headers();
|
||||
|
||||
foreach($headerData as $key => $value){
|
||||
if (strpos($key, 'EVE_') === 0) {
|
||||
$key = str_replace('EVE_', '', $key);
|
||||
$key = strtolower($key);
|
||||
|
||||
if (
|
||||
$key === 'trusted' &&
|
||||
$value === 'Yes'
|
||||
) {
|
||||
$data->trusted = true;
|
||||
}
|
||||
|
||||
$data->values[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace Controller;
|
||||
|
||||
class MapController extends Controller {
|
||||
class MapController extends \Controller\AccessController {
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
@@ -16,8 +16,11 @@ class MapController extends Controller {
|
||||
|
||||
|
||||
public function showMap() {
|
||||
$this->setTemplate('templates/view/map.html');
|
||||
|
||||
// set trust attribute to template
|
||||
$this->f3->set('trusted', (int)self::isIGBTrusted());
|
||||
|
||||
$this->setTemplate('templates/view/map.html');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -305,6 +305,9 @@ class Map extends \Controller\AccessController {
|
||||
// check if data for specific system is requested
|
||||
$systemData = (array)$f3->get('POST.systemData');
|
||||
|
||||
// update current location (IGB data)
|
||||
$user->updateCharacterLog();
|
||||
|
||||
$userData = (object) [];
|
||||
// data for the current user
|
||||
$userData->userData = $user->getData();
|
||||
|
||||
Reference in New Issue
Block a user