Fix #15996 - local setup doc links are broken
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
parent
78c6d38173
commit
db02eea620
@ -785,7 +785,8 @@ class FormDisplay
|
||||
}
|
||||
return Util::getDocuLink(
|
||||
'config',
|
||||
'cfg_' . $this->_getOptName($path)
|
||||
'cfg_' . $this->_getOptName($path),
|
||||
'../'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ class Sanitize
|
||||
'./server_privileges.php?',
|
||||
'./tbl_structure.php?',
|
||||
];
|
||||
$is_setup = $GLOBALS['PMA_Config'] !== null && $GLOBALS['PMA_Config']->get('is_setup');
|
||||
$is_setup = Sanitize::isSetup();
|
||||
// Adjust path to setup script location
|
||||
if ($is_setup) {
|
||||
foreach ($valid_starts as $key => $value) {
|
||||
@ -84,6 +84,16 @@ class Sanitize
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we are currently on a setup folder page
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function isSetup(): bool
|
||||
{
|
||||
return $GLOBALS['PMA_Config'] !== null && $GLOBALS['PMA_Config']->get('is_setup');
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function for replacing [a@link@target] links in bb code.
|
||||
*
|
||||
@ -144,7 +154,7 @@ class Sanitize
|
||||
$page = 'setup';
|
||||
}
|
||||
}
|
||||
$link = Util::getDocuLink($page, $anchor);
|
||||
$link = Util::getDocuLink($page, $anchor, Sanitize::isSetup() ? '../' : '');
|
||||
return '<a href="' . $link . '" target="documentation">';
|
||||
}
|
||||
|
||||
|
||||
@ -443,12 +443,13 @@ class Util
|
||||
/**
|
||||
* Returns link to documentation.
|
||||
*
|
||||
* @param string $page Page in documentation
|
||||
* @param string $anchor Optional anchor in page
|
||||
* @param string $page Page in documentation
|
||||
* @param string $anchor Optional anchor in page
|
||||
* @param string $pathPrefix Optional path in case it is called in a folder (e.g. setup)
|
||||
*
|
||||
* @return string URL
|
||||
*/
|
||||
public static function getDocuLink($page, $anchor = '')
|
||||
public static function getDocuLink($page, $anchor = '', string $pathPrefix = '')
|
||||
{
|
||||
/* Construct base URL */
|
||||
$url = $page . '.html';
|
||||
@ -460,7 +461,7 @@ class Util
|
||||
* provide consistent URL for testsuite
|
||||
*/
|
||||
if (! defined('TESTSUITE') && @file_exists(ROOT_PATH . 'doc/html/index.html')) {
|
||||
return 'doc/html/' . $url;
|
||||
return $pathPrefix . 'doc/html/' . $url;
|
||||
}
|
||||
|
||||
return Core::linkURL('https://docs.phpmyadmin.net/en/latest/' . $url);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user