diff --git a/customer_domains.php b/customer_domains.php index 1fb05339..c87105c0 100644 --- a/customer_domains.php +++ b/customer_domains.php @@ -72,7 +72,7 @@ if ($page == 'overview' || $page == 'domains') { } $actions_links[] = [ - 'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/domains/', + 'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/domains/', 'target' => '_blank', 'icon' => 'fa-solid fa-circle-info', 'class' => 'btn-outline-secondary' diff --git a/customer_email.php b/customer_email.php index c3d8e6f5..dc55aed0 100644 --- a/customer_email.php +++ b/customer_email.php @@ -77,7 +77,7 @@ if ($page == 'overview' || $page == 'emails') { } $actions_links[] = [ - 'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/emails/', + 'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/emails/', 'target' => '_blank', 'icon' => 'fa-solid fa-circle-info', 'class' => 'btn-outline-secondary' @@ -139,7 +139,7 @@ if ($page == 'email_domain') { ]; } $actions_links[] = [ - 'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/emails/', + 'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/emails/', 'target' => '_blank', 'icon' => 'fa-solid fa-circle-info', 'class' => 'btn-outline-secondary' diff --git a/customer_extras.php b/customer_extras.php index 16cb4f9d..0656241d 100644 --- a/customer_extras.php +++ b/customer_extras.php @@ -75,7 +75,7 @@ if ($page == 'overview' || $page == 'htpasswds') { ]; $actions_links[] = [ - 'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/extras/', + 'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/extras/', 'target' => '_blank', 'icon' => 'fa-solid fa-circle-info', 'class' => 'btn-outline-secondary' @@ -200,7 +200,7 @@ if ($page == 'overview' || $page == 'htpasswds') { ]; $actions_links[] = [ - 'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/extras/', + 'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/extras/', 'target' => '_blank', 'icon' => 'fa-solid fa-circle-info', 'class' => 'btn-outline-secondary' @@ -349,7 +349,7 @@ if ($page == 'overview' || $page == 'htpasswds') { $actions_links = [ [ - 'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/extras/', + 'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/extras/', 'target' => '_blank', 'icon' => 'fa-solid fa-circle-info', 'class' => 'btn-outline-secondary' diff --git a/customer_ftp.php b/customer_ftp.php index 234929d5..05e16923 100644 --- a/customer_ftp.php +++ b/customer_ftp.php @@ -65,7 +65,7 @@ if ($page == 'overview' || $page == 'accounts') { ]; } $actions_links[] = [ - 'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/ftp-accounts/', + 'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/ftp-accounts/', 'target' => '_blank', 'icon' => 'fa-solid fa-circle-info', 'class' => 'btn-outline-secondary' diff --git a/customer_mysql.php b/customer_mysql.php index b8bdffd0..e2372448 100644 --- a/customer_mysql.php +++ b/customer_mysql.php @@ -89,7 +89,7 @@ if ($page == 'overview' || $page == 'mysqls') { } $actions_links[] = [ - 'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/databases/', + 'href' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/databases/', 'target' => '_blank', 'icon' => 'fa-solid fa-circle-info', 'class' => 'btn-outline-secondary' diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index dcebc533..87ccc013 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -39,7 +39,7 @@ final class Froxlor // Distribution branding-tag (used for Debian etc.) const BRANDING = ''; - const DOCS_URL = 'https://docs.froxlor.org/v2.2/'; + const DOCS_URL = 'https://docs.froxlor.org'; /** * return path to where froxlor is installed, e.g. @@ -52,6 +52,14 @@ final class Froxlor return dirname(__DIR__, 2) . '/'; } + public static function getDocsUrl(): string + { + if (preg_match('/(.+)-(dev|beta|rc)\d+$/', self::VERSION)) { + return self::DOCS_URL . '/dev/'; + } + return self::DOCS_URL . '/v' . self::getShortVersion() . '/'; + } + /** * return basic version * @@ -62,6 +70,16 @@ final class Froxlor return self::VERSION; } + /** + * return short basic version + * + * @return string + */ + public static function getShortVersion(): string + { + return explode(".", self::VERSION)[0] . '.' . explode(".", self::VERSION)[1]; + } + /** * return version + branding and database-version * diff --git a/lib/navigation/00.froxlor.main.php b/lib/navigation/00.froxlor.main.php index 08b63583..5e7d3230 100644 --- a/lib/navigation/00.froxlor.main.php +++ b/lib/navigation/00.froxlor.main.php @@ -161,13 +161,13 @@ return [ 'show_element' => (!Settings::IsInList('panel.customer_hide_options', 'misc.documentation')), 'elements' => [ [ - 'url' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/', + 'url' => \Froxlor\Froxlor::getDocsUrl() . 'user-guide/', 'label' => lng('admin.userguide'), 'new_window' => true, 'is_external' => true, ], [ - 'url' => \Froxlor\Froxlor::DOCS_URL . 'api-guide/', + 'url' => \Froxlor\Froxlor::getDocsUrl() . 'api-guide/', 'label' => lng('admin.apiguide'), 'new_window' => true, 'show_element' => Settings::Get('api.enabled') == 1 && CurrentUser::getField('api_allowed') == 1, @@ -348,13 +348,13 @@ return [ 'icon' => 'fa-solid fa-circle-info', 'elements' => [ [ - 'url' => \Froxlor\Froxlor::DOCS_URL . 'admin-guide/', + 'url' => \Froxlor\Froxlor::getDocsUrl() . 'admin-guide/', 'label' => lng('admin.adminguide'), 'new_window' => true, 'is_external' => true, ], [ - 'url' => \Froxlor\Froxlor::DOCS_URL . 'api-guide/', + 'url' => \Froxlor\Froxlor::getDocsUrl() . 'api-guide/', 'label' => lng('admin.apiguide'), 'new_window' => true, 'show_element' => Settings::Get('api.enabled') == 1,