new: [setting] Added new setting to set external baseurl

- idea is to decouple the baseurl (used to prepend links) from the announce baseurl (for sharing groups / emailing)
pull/4194/head
iglocska 2019-02-19 09:37:56 +01:00
parent c16157ff60
commit fede678d5d
1 changed files with 20 additions and 0 deletions

View File

@ -144,6 +144,14 @@ class Server extends AppModel
'test' => 'testBaseURL',
'type' => 'string',
),
'external_baseurl' => array(
'level' => 0,
'description' => __('The base url of the application (in the format https://www.mymispinstance.com) as visible externally/by other MISPs. MISP will encode this URL in sharing groups when including itself. If this value is not set, the baseurl is used as a fallback.'),
'value' => '',
'errorMessage' => '',
'test' => 'testURL',
'type' => 'string',
),
'live' => array(
'level' => 0,
'description' => __('Unless set to true, the instance will only be accessible by site admins.'),
@ -2879,6 +2887,18 @@ class Server extends AppModel
return true;
}
public function testURL($value)
{
// only run this check via the GUI, via the CLI it won't work
if (!empty($value) && !preg_match('/^http(s)?:\/\//i', $value)) {
return 'Invalid baseurl, please make sure that the protocol is set.';
}
if ($this->testForEmpty($value) !== true) {
return $this->testForEmpty($value);
}
return true;
}
public function testDisableEmail($value)
{
if (isset($value) && $value) {