mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Cleanup path handling
This commit is contained in:
parent
aa3eb6b991
commit
0ec245dce1
4 changed files with 10 additions and 16 deletions
|
|
@ -919,7 +919,7 @@ class Actions
|
||||||
|
|
||||||
$bAppJsDebug = $this->oConfig->Get('labs', 'use_app_debug_js', false);
|
$bAppJsDebug = $this->oConfig->Get('labs', 'use_app_debug_js', false);
|
||||||
|
|
||||||
$aResult['StaticLibsJs'] = $this->StaticPath('js/' . ($bAppJsDebug ? '' : 'min/') .
|
$aResult['StaticLibsJs'] = Utils::WebStaticPath('js/' . ($bAppJsDebug ? '' : 'min/') .
|
||||||
'libs' . ($bAppJsDebug ? '' : '.min') . '.js');
|
'libs' . ($bAppJsDebug ? '' : '.min') . '.js');
|
||||||
|
|
||||||
// IDN
|
// IDN
|
||||||
|
|
@ -1297,9 +1297,4 @@ class Actions
|
||||||
\header('Location: ' . $sUrl);
|
\header('Location: ' . $sUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function StaticPath(string $sPath): string
|
|
||||||
{
|
|
||||||
return Utils::WebStaticPath() . $sPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,15 +169,15 @@ abstract class Service
|
||||||
|
|
||||||
$sFaviconUrl = (string) $oConfig->Get('webmail', 'favicon_url', '');
|
$sFaviconUrl = (string) $oConfig->Get('webmail', 'favicon_url', '');
|
||||||
|
|
||||||
$sFaviconPngLink = $sFaviconUrl ? $sFaviconUrl : $oActions->StaticPath('apple-touch-icon.png');
|
$sFaviconPngLink = $sFaviconUrl ? $sFaviconUrl : Utils::WebStaticPath('apple-touch-icon.png');
|
||||||
$sAppleTouchLink = $sFaviconUrl ? '' : $oActions->StaticPath('apple-touch-icon.png');
|
$sAppleTouchLink = $sFaviconUrl ? '' : Utils::WebStaticPath('apple-touch-icon.png');
|
||||||
|
|
||||||
$aTemplateParameters = array(
|
$aTemplateParameters = array(
|
||||||
'{{BaseAppFaviconPngLinkTag}}' => $sFaviconPngLink ? '<link type="image/png" rel="shortcut icon" href="'.$sFaviconPngLink.'">' : '',
|
'{{BaseAppFaviconPngLinkTag}}' => $sFaviconPngLink ? '<link type="image/png" rel="shortcut icon" href="'.$sFaviconPngLink.'">' : '',
|
||||||
'{{BaseAppFaviconTouchLinkTag}}' => $sAppleTouchLink ? '<link type="image/png" rel="apple-touch-icon" href="'.$sAppleTouchLink.'">' : '',
|
'{{BaseAppFaviconTouchLinkTag}}' => $sAppleTouchLink ? '<link type="image/png" rel="apple-touch-icon" href="'.$sAppleTouchLink.'">' : '',
|
||||||
'{{BaseAppMainCssLink}}' => $oActions->StaticPath('css/'.($bAdmin ? 'admin' : 'app').$sAppCssMin.'.css'),
|
'{{BaseAppMainCssLink}}' => Utils::WebStaticPath('css/'.($bAdmin ? 'admin' : 'app').$sAppCssMin.'.css'),
|
||||||
'{{BaseAppThemeCssLink}}' => $oActions->ThemeLink($bAdmin),
|
'{{BaseAppThemeCssLink}}' => $oActions->ThemeLink($bAdmin),
|
||||||
'{{BaseAppManifestLink}}' => $oActions->StaticPath('manifest.json'),
|
'{{BaseAppManifestLink}}' => Utils::WebStaticPath('manifest.json'),
|
||||||
'{{LoadingDescriptionEsc}}' => \htmlspecialchars($oConfig->Get('webmail', 'loading_description', 'SnappyMail'), ENT_QUOTES|ENT_IGNORE, 'UTF-8'),
|
'{{LoadingDescriptionEsc}}' => \htmlspecialchars($oConfig->Get('webmail', 'loading_description', 'SnappyMail'), ENT_QUOTES|ENT_IGNORE, 'UTF-8'),
|
||||||
'{{BaseAppAdmin}}' => $bAdmin ? 1 : 0
|
'{{BaseAppAdmin}}' => $bAdmin ? 1 : 0
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -616,7 +616,6 @@ class ServiceActions
|
||||||
|
|
||||||
\header('Content-Type: text/html; charset=utf-8');
|
\header('Content-Type: text/html; charset=utf-8');
|
||||||
return \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/BadBrowser.html'), array(
|
return \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/BadBrowser.html'), array(
|
||||||
'{{BaseWebStaticPath}}' => Utils::WebStaticPath(),
|
|
||||||
'{{ErrorTitle}}' => $sTitle,
|
'{{ErrorTitle}}' => $sTitle,
|
||||||
'{{ErrorHeader}}' => $sTitle,
|
'{{ErrorHeader}}' => $sTitle,
|
||||||
'{{ErrorDesc}}' => $sDesc
|
'{{ErrorDesc}}' => $sDesc
|
||||||
|
|
@ -809,7 +808,6 @@ class ServiceActions
|
||||||
public function ErrorTemplates(string $sTitle, string $sDesc, bool $bShowBackLink = true)
|
public function ErrorTemplates(string $sTitle, string $sDesc, bool $bShowBackLink = true)
|
||||||
{
|
{
|
||||||
return \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Error.html'), array(
|
return \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Error.html'), array(
|
||||||
'{{BaseWebStaticPath}}' => Utils::WebStaticPath(),
|
|
||||||
'{{ErrorTitle}}' => $sTitle,
|
'{{ErrorTitle}}' => $sTitle,
|
||||||
'{{ErrorHeader}}' => $sTitle,
|
'{{ErrorHeader}}' => $sTitle,
|
||||||
'{{ErrorDesc}}' => $sDesc,
|
'{{ErrorDesc}}' => $sDesc,
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,9 @@ class Utils
|
||||||
{
|
{
|
||||||
static $sAppPath;
|
static $sAppPath;
|
||||||
if (!$sAppPath) {
|
if (!$sAppPath) {
|
||||||
$sAppPath = Api::Config()->Get('webmail', 'app_path', '')
|
$sAppPath = \rtrim(Api::Config()->Get('webmail', 'app_path', '')
|
||||||
?: \preg_replace('#index\\.php.*$#D', '', $_SERVER['SCRIPT_NAME']);
|
?: \preg_replace('#index\\.php.*$#D', '', $_SERVER['SCRIPT_NAME']),
|
||||||
|
'/') . '/';
|
||||||
}
|
}
|
||||||
return $sAppPath;
|
return $sAppPath;
|
||||||
}
|
}
|
||||||
|
|
@ -159,9 +160,9 @@ class Utils
|
||||||
return self::WebPath().'snappymail/v/'.APP_VERSION.'/';
|
return self::WebPath().'snappymail/v/'.APP_VERSION.'/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function WebStaticPath() : string
|
public static function WebStaticPath(string $path = '') : string
|
||||||
{
|
{
|
||||||
return self::WebVersionPath().'static/';
|
return self::WebVersionPath() . 'static/' . $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function RemoveSuggestionDuplicates(array $aSuggestions) : array
|
public static function RemoveSuggestionDuplicates(array $aSuggestions) : array
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue