/** * send rally point information by mail */ protected function sendRallyPointMail() { $recipient = Config::getNotificationMail('RALLY_SET'); if ($recipient && \Audit::instance()->email($recipient)) { $updatedCharacterId = (int) $this->get('updatedCharacterId', true); /** * @var $character CharacterModel */ $character = $this->rel('updatedCharacterId'); $character->getById($updatedCharacterId); if (!$character->dry()) { $body = []; $body[] = "Map:\t\t" . $this->mapId->name; $body[] = "System:\t\t" . $this->name; $body[] = "Region:\t\t" . $this->region; $body[] = "Security:\t" . $this->security; $body[] = "Character:\t" . $character->name; $body[] = "Time:\t\t" . date('g:i a; F j, Y', strtotime($this->rallyUpdated)); $bodyMsg = implode("\r\n", $body); (new MailController())->sendRallyPoint($recipient, $bodyMsg); } } }
/** * Get all required static config data for program initialization * @param \Base $f3 */ public function init(\Base $f3) { // expire time in seconds $expireTimeHead = 60 * 60 * 12; $expireTimeSQL = 60 * 60 * 12; $f3->expire($expireTimeHead); $return = (object) []; $return->error = []; // static program data ---------------------------------------------------------------------------------------- $return->timer = $f3->get('PATHFINDER.TIMER'); // get all available map types -------------------------------------------------------------------------------- $mapType = Model\BasicModel::getNew('MapTypeModel'); $rows = $mapType->find('active = 1', null, $expireTimeSQL); $mapTypeData = []; foreach ((array) $rows as $rowData) { $data = ['id' => $rowData->id, 'label' => $rowData->label, 'class' => $rowData->class, 'classTab' => $rowData->classTab]; $mapTypeData[$rowData->name] = $data; } $return->mapTypes = $mapTypeData; // get all available map scopes ------------------------------------------------------------------------------- $mapScope = Model\BasicModel::getNew('MapScopeModel'); $rows = $mapScope->find('active = 1', null, $expireTimeSQL); $mapScopeData = []; foreach ((array) $rows as $rowData) { $data = ['id' => $rowData->id, 'label' => $rowData->label]; $mapScopeData[$rowData->name] = $data; } $return->mapScopes = $mapScopeData; // get all available system status ---------------------------------------------------------------------------- $systemStatus = Model\BasicModel::getNew('SystemStatusModel'); $rows = $systemStatus->find('active = 1', null, $expireTimeSQL); $systemScopeData = []; foreach ((array) $rows as $rowData) { $data = ['id' => $rowData->id, 'label' => $rowData->label, 'class' => $rowData->class]; $systemScopeData[$rowData->name] = $data; } $return->systemStatus = $systemScopeData; // get all available system types ----------------------------------------------------------------------------- $systemType = Model\BasicModel::getNew('SystemTypeModel'); $rows = $systemType->find('active = 1', null, $expireTimeSQL); $systemTypeData = []; foreach ((array) $rows as $rowData) { $data = ['id' => $rowData->id, 'name' => $rowData->name]; $systemTypeData[$rowData->name] = $data; } $return->systemType = $systemTypeData; // get available connection scopes ---------------------------------------------------------------------------- $connectionScope = Model\BasicModel::getNew('ConnectionScopeModel'); $rows = $connectionScope->find('active = 1', null, $expireTimeSQL); $connectionScopeData = []; foreach ((array) $rows as $rowData) { $data = ['id' => $rowData->id, 'label' => $rowData->label, 'connectorDefinition' => $rowData->connectorDefinition]; $connectionScopeData[$rowData->name] = $data; } $return->connectionScopes = $connectionScopeData; // get available character status ----------------------------------------------------------------------------- $characterStatus = Model\BasicModel::getNew('CharacterStatusModel'); $rows = $characterStatus->find('active = 1', null, $expireTimeSQL); $characterStatusData = []; foreach ((array) $rows as $rowData) { $data = ['id' => $rowData->id, 'name' => $rowData->name, 'class' => $rowData->class]; $characterStatusData[$rowData->name] = $data; } $return->characterStatus = $characterStatusData; // get max number of shared entities per map ------------------------------------------------------------------ $maxSharedCount = ['character' => $f3->get('PATHFINDER.MAP.PRIVATE.MAX_SHARED'), 'corporation' => $f3->get('PATHFINDER.MAP.CORPORATION.MAX_SHARED'), 'alliance' => $f3->get('PATHFINDER.MAP.ALLIANCE.MAX_SHARED')]; $return->maxSharedCount = $maxSharedCount; // get program routes ----------------------------------------------------------------------------------------- $return->routes = ['ssoLogin' => $this->getF3()->alias('sso', ['action' => 'requestAuthorization'])]; // get notification status ------------------------------------------------------------------------------------ $return->notificationStatus = ['rallySet' => (bool) Config::getNotificationMail('RALLY_SET')]; // get SSO error messages that should be shown immediately ---------------------------------------------------- // -> e.g. errors while character switch from previous HTTP requests if ($f3->exists(Controller\Ccp\Sso::SESSION_KEY_SSO_ERROR)) { $ssoError = (object) []; $ssoError->type = 'error'; $ssoError->title = 'Login failed'; $ssoError->message = $f3->get(Controller\Ccp\Sso::SESSION_KEY_SSO_ERROR); $return->error[] = $ssoError; $f3->clear(Controller\Ccp\Sso::SESSION_KEY_SSO_ERROR); } echo json_encode($return); }