Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.4.3 #721

Merged
merged 14 commits into from
Dec 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 113 additions & 64 deletions app/config.ini
Original file line number Diff line number Diff line change
@@ -1,74 +1,123 @@
; Global Framework Config

[SERVER]
SERVER_NAME = PATHFINDER
SERVER_NAME = PATHFINDER

[globals]
; Default Verbosity level of the stack trace.
; Assign values between 0 to 3 for increasing verbosity levels. Check (environment.ini) config for overwriting
; (default: 0)
DEBUG = 0

; If TRUE, the framework, after having logged stack trace and errors, stops execution
; -> (die without any status) when a non-fatal error is detected. (default: FALSE)
HALT = FALSE

; Timezone to use. Sync program with eve server time. (default: UTC)
TZ = UTC

; Cache key prefix. Same for all cache values for this installation
; CLI (cronjob) scripts use it for cache manipulation
SEED = {{ md5(@SERVER.SERVER_NAME) }}

; Cache backend. Can handle Redis, Memcache module, APC, WinCache, XCache and a filesystem-based cache.
; (default: folder=tmp/cache/)
CACHE = folder=tmp/cache/
;CACHE = redis=localhost:6379

; Cache backend used by Session handler.
; default
; -If CACHE is enabled (see above), the same location is used for Session data (e.g. fileCache, RedisDB)
; mysql
; - Session data get stored in your 'PathfinderDB' table 'sessions' (faster)
SESSION_CACHE = mysql
; Verbosity level of error stack trace for errors
; This affects error logging and stack traces returned to clients on error.
; DEBUG level can be overwritten in environment.ini
; Syntax: 0 | 1 | 2 | 3
; Default: 0
DEBUG = 0

; How to behave on 'non-fatal' errors
; If TRUE, the framework, after having logged stack trace and errors, stops execution
; (die without any status) when a non-fatal error is detected.
; Tip: You should not change this.
; Syntax: TRUE | FALSE
; Default: FALSE
HALT = FALSE

; Timezone to use
; Sync Pathfinder with EVE server time.
; Tip: You should not change this.
; Default: UTC
TZ = UTC

; Default language
; Overwrites HTTP Accept-Language request header.
; Used by setlocale() and affects number formatting.
; Syntax: String
; Default: en-US
LANGUAGE = en-US

; Cache key prefix
; Same for all cache values for this installation.
; CLI (cronjob) scripts use it for cache manipulation.
; Tip: You should not change this.
; Syntax String
; Default: {{ md5(@SERVER.SERVER_NAME) }}
SEED = {{ md5(@SERVER.SERVER_NAME) }}

; Cache backend
; Can handle Redis, Memcache module, APC, WinCache, XCache and a filesystem-based cache.
; Tip: Redis is recommended and gives the best performance.
; Syntax: folder=[DIR] | redis=[SERVER]
; Default: folder=tmp/cache/
; Value: folder=[DIR]
; - Cache data is stored on disc
; redis=[SERVER]
; - Cache data is stored in Redis (e.g. redis=localhost:6379)
CACHE = folder=tmp/cache/

; Cache backend used by PHPs Session handler.
; Tip1: Best performance and recommended configuration for Pathfinder is to configured Redis as PHPs default Session handler
; in your php.ini and set 'default' value here in order to use Redis (fastest)
; Tip2: If Redis is not available for you, leave this at 'mysql' (faster than PHPs default files bases Sessions)
; Syntax: mysql | default
; Default: mysql
; Value: mysql
; - Session data get stored in 'pathfinder'.'sessions' table (environment.ini → DB_PF_NAME).
; Table `sessions` is auto created if not exist.
; default
; - Session data get stored in PHPs default Session handler (php.ini → session.save_handler and session.save_path)
; PHPs default session.save_handler is `files` and each Session is written to disc (slowest)
SESSION_CACHE = mysql

; Callback functions ==============================================================================
ONERROR = Controller\Controller->showError
UNLOAD = Controller\Controller->unload
ONERROR = Controller\Controller->showError
UNLOAD = Controller\Controller->unload

; Path configurations =============================================================================
; relative to "BASE" dir

; Temporary folder for cache, filesystem locks, compiled F3 templates, etc. (default: tmp/)
TEMP = tmp/

; Log file folder. (default: logs/)
LOGS = logs/

; UI/template folder. (default: public/)
UI = public/

; Autoloader for user-defined PHP classes that the framework will attempt to autoload at runtime. (default: app/main/)
AUTOLOAD = app/main/

; Favicons. (default: favicon/)
FAVICON = favicon/

; Export folder (e.g. static table data). (default: export/)
EXPORT = export/

; Default language (overwrites HTTP Accept-Language request header) used for "setlocale()" affects number formatting. (default: en-US)
LANGUAGE = en-US

; custom *.ini file folder, can be used to overwrite default *.ini files
CONF.CUSTOM = conf/
CONF.DEFAULT = app/

; load additional config files
; DO NOT load environment.ini, it is loaded automatically
; All path configurations are relative to BASE dir and should NOT be changed

; Temporary folder for cache
; Used for compiled templates.
; Syntax: [DIR]
; Default: tmp/
TEMP = tmp/

; Log file folder
; Syntax: [DIR]
; Default: logs/
LOGS = logs/

; UI folder
; Where all the public assets (templates, images, styles, scripts) are located.
; Syntax: [DIR]
; Default: public/
UI = public/

; Autoload folder
; Where PHP attempts to autoload PHP classes at runtime.
; Syntax: [DIR]
; Default: app/main/
AUTOLOAD = app/main/

; Favicon folder
; Syntax: [DIR]
; Default: favicon/
FAVICON = favicon/

; Export folder
; Where DB dump files are located/created at.
; Syntax: [DIR]
; Default: export/
EXPORT = export/

; Custom *.ini file folder
; Can be used to overwrite default *.ini files and settings
; See: https://github.com/exodus4d/pathfinder/wiki/Configuration#custom-confpathfinderini
; Syntax: [DIR]
CONF.CUSTOM = conf/
CONF.DEFAULT = app/

; Load additional config files
; DO NOT load environment.ini, it is loaded automatically
[configs]
{{@CONF.DEFAULT}}routes.ini = true
{{@CONF.DEFAULT}}pathfinder.ini = true
{{@CONF.CUSTOM}}pathfinder.ini = true
{{@CONF.DEFAULT}}requirements.ini = true
{{@CONF.DEFAULT}}cron.ini = true
{{@CONF.DEFAULT}}routes.ini = true
{{@CONF.DEFAULT}}pathfinder.ini = true
{{@CONF.CUSTOM}}pathfinder.ini = true
{{@CONF.DEFAULT}}requirements.ini = true
{{@CONF.DEFAULT}}cron.ini = true
2 changes: 2 additions & 0 deletions app/environment.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ DB_UNIVERSE_PASS =
CCP_SSO_URL = https://sisilogin.testeveonline.com
CCP_SSO_CLIENT_ID =
CCP_SSO_SECRET_KEY =
CCP_SSO_DOWNTIME = 11:00

; CCP ESI API
CCP_ESI_URL = https://esi.tech.ccp.is
Expand Down Expand Up @@ -82,6 +83,7 @@ DB_CCP_PASS =
CCP_SSO_URL = https://login.eveonline.com
CCP_SSO_CLIENT_ID =
CCP_SSO_SECRET_KEY =
CCP_SSO_DOWNTIME = 11:00

; CCP ESI API
CCP_ESI_URL = https://esi.tech.ccp.is
Expand Down
15 changes: 1 addition & 14 deletions app/main/controller/accesscontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class AccessController extends Controller {
* @param $params
* @return bool
* @throws \Exception
* @throws \Exception\PathfinderException
* @throws \ZMQSocketException
*/
function beforeroute(\Base $f3, $params): bool {
Expand All @@ -29,15 +28,7 @@ function beforeroute(\Base $f3, $params): bool {
// requires a valid logged in user!
if( !$this->isLoggedIn($f3) ){
// no character found or login timer expired
$this->logoutCharacter();

if($f3->get('AJAX')){
// unauthorized request
$f3->status(403);
}else{
// redirect to landing page
$f3->reroute(['login']);
}
$this->logoutCharacter($f3);
// skip route handler and afterroute()
$return = false;
}
Expand All @@ -51,7 +42,6 @@ function beforeroute(\Base $f3, $params): bool {
* @param \Base $f3
* @return bool
* @throws \Exception
* @throws \Exception\PathfinderException
*/
protected function isLoggedIn(\Base $f3): bool {
$loginCheck = false;
Expand All @@ -71,7 +61,6 @@ protected function isLoggedIn(\Base $f3): bool {
* @param \Base $f3
* @param Model\CharacterModel $character
* @return bool
* @throws \Exception\PathfinderException
*/
private function checkLogTimer(\Base $f3, Model\CharacterModel $character){
$loginCheck = false;
Expand Down Expand Up @@ -104,7 +93,6 @@ private function checkLogTimer(\Base $f3, Model\CharacterModel $character){
* @param Model\MapModel $map
* @return int (number of active connections for this map)
* @throws \Exception
* @throws \Exception\PathfinderException
* @throws \ZMQSocketException
*/
protected function broadcastMapData(Model\MapModel $map){
Expand All @@ -117,7 +105,6 @@ protected function broadcastMapData(Model\MapModel $map){
* @param Model\MapModel $map
* @return array
* @throws \Exception
* @throws \Exception\PathfinderException
*/
protected function getFormattedMapData(Model\MapModel $map){
$mapData = $map->getData();
Expand Down
12 changes: 1 addition & 11 deletions app/main/controller/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class Admin extends Controller{
* @param $params
* @return bool
* @throws \Exception
* @throws \Exception\PathfinderException
*/
function beforeroute(\Base $f3, $params): bool {
$return = parent::beforeroute($f3, $params);
Expand All @@ -50,7 +49,7 @@ function beforeroute(\Base $f3, $params): bool {
$this->dispatch($f3, $params, $character);
}

$f3->set('tplAuthType', $f3->alias( 'sso', ['action' => 'requestAdminAuthorization']));
$f3->set('tplAuthType', $f3->get('BASE') . $f3->alias( 'sso', ['action' => 'requestAdminAuthorization']));

// page title
$f3->set('tplPageTitle', 'Admin | ' . Config::getPathfinderData('name'));
Expand All @@ -67,7 +66,6 @@ function beforeroute(\Base $f3, $params): bool {
/**
* event handler after routing
* @param \Base $f3
* @throws \Exception\PathfinderException
*/
public function afterroute(\Base $f3) {
// js view (file)
Expand Down Expand Up @@ -123,7 +121,6 @@ protected function getAdminCharacter(\Base $f3){
* @param $params
* @param null $character
* @throws \Exception
* @throws \Exception\PathfinderException
*/
public function dispatch(\Base $f3, $params, $character = null){
if($character instanceof CharacterModel){
Expand Down Expand Up @@ -232,7 +229,6 @@ protected function saveSettings(CharacterModel $character, int $corporationId, a
* @param CharacterModel $character
* @param int $kickCharacterId
* @param int $minutes
* @throws \Exception\PathfinderException
*/
protected function kickCharacter(CharacterModel $character, $kickCharacterId, $minutes){
$kickOptions = self::KICK_OPTIONS;
Expand Down Expand Up @@ -262,7 +258,6 @@ protected function kickCharacter(CharacterModel $character, $kickCharacterId, $m
* @param CharacterModel $character
* @param int $banCharacterId
* @param int $value
* @throws \Exception\PathfinderException
*/
protected function banCharacter(CharacterModel $character, $banCharacterId, $value){
$banCharacters = $this->filterValidCharacters($character, $banCharacterId);
Expand Down Expand Up @@ -309,7 +304,6 @@ protected function filterValidCharacters(CharacterModel $character, $characterId
* @param CharacterModel $character
* @param int $mapId
* @param int $value
* @throws \Exception\PathfinderException
*/
protected function activateMap(CharacterModel $character, int $mapId, int $value){
$maps = $this->filterValidMaps($character, $mapId);
Expand All @@ -322,7 +316,6 @@ protected function activateMap(CharacterModel $character, int $mapId, int $value
/**
* @param CharacterModel $character
* @param int $mapId
* @throws \Exception\PathfinderException
*/
protected function deleteMap(CharacterModel $character, int $mapId){
$maps = $this->filterValidMaps($character, $mapId);
Expand All @@ -336,7 +329,6 @@ protected function deleteMap(CharacterModel $character, int $mapId){
* @param CharacterModel $character
* @param int $mapId
* @return \DB\CortexCollection[]|MapModel[]
* @throws \Exception\PathfinderException
*/
protected function filterValidMaps(CharacterModel $character, int $mapId) {
$maps = [];
Expand All @@ -355,7 +347,6 @@ protected function filterValidMaps(CharacterModel $character, int $mapId) {
* get log file for "admin" logs
* @param string $type
* @return \Log
* @throws \Exception\PathfinderException
*/
static function getLogger($type = 'ADMIN'){
return parent::getLogger('ADMIN');
Expand Down Expand Up @@ -406,7 +397,6 @@ protected function initMembers(\Base $f3, CharacterModel $character){
* init /maps page data
* @param \Base $f3
* @param CharacterModel $character
* @throws \Exception\PathfinderException
*/
protected function initMaps(\Base $f3, CharacterModel $character){
$data = (object) [];
Expand Down
3 changes: 0 additions & 3 deletions app/main/controller/api/github.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ protected function getBaseRequestOptions() : array {
/**
* get HTTP request options for API (curl) request
* @return array
* @throws \Exception\PathfinderException
*/
protected function getRequestReleaseOptions() : array {
$options = $this->getBaseRequestOptions();
Expand All @@ -41,7 +40,6 @@ protected function getRequestReleaseOptions() : array {
* get HTTP request options for API (curl) request
* @param string $text
* @return array
* @throws \Exception\PathfinderException
*/
protected function getRequestMarkdownOptions(string $text) : array {
$params = [
Expand All @@ -59,7 +57,6 @@ protected function getRequestMarkdownOptions(string $text) : array {
/**
* get release information from GitHub
* @param \Base $f3
* @throws \Exception\PathfinderException
*/
public function releases(\Base $f3){
$cacheKey = 'CACHE_GITHUB_RELEASES';
Expand Down
Loading