mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-08 19:42:15 +09:00
Display the current site's favicon if favicon.ico is requested
This commit is contained in:
parent
8c951d2aed
commit
9fcd472d3f
3 changed files with 51 additions and 6 deletions
|
|
@ -64,6 +64,12 @@ class Router
|
||||||
'extra_vars' => ['act' => 'dispAdminRewriteTest'],
|
'extra_vars' => ['act' => 'dispAdminRewriteTest'],
|
||||||
'priority' => 0,
|
'priority' => 0,
|
||||||
),
|
),
|
||||||
|
'favicon\.ico' => array(
|
||||||
|
'regexp' => '#^favicon\.ico$#',
|
||||||
|
'vars' => [],
|
||||||
|
'extra_vars' => ['module' => 'module', 'act' => 'dispModuleCurrentSiteFavicon'],
|
||||||
|
'priority' => 0,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
<action name="dispModuleSkinInfo" type="view" permission="all-managers" meta-noindex="true" />
|
<action name="dispModuleSkinInfo" type="view" permission="all-managers" meta-noindex="true" />
|
||||||
<action name="dispModuleFileBox" type="view" permission="root" meta-noindex="true" />
|
<action name="dispModuleFileBox" type="view" permission="root" meta-noindex="true" />
|
||||||
<action name="dispModuleFileBoxAdd" type="view" permission="root" meta-noindex="true" />
|
<action name="dispModuleFileBoxAdd" type="view" permission="root" meta-noindex="true" />
|
||||||
|
<action name="dispModuleCurrentSiteFavicon" type="view" standalone="true" />
|
||||||
<action name="dispModuleChangeLang" type="view" />
|
<action name="dispModuleChangeLang" type="view" />
|
||||||
|
|
||||||
<action name="getModuleSkinInfoList" type="model" permission="root" />
|
<action name="getModuleSkinInfoList" type="model" permission="root" />
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,44 @@ class ModuleView extends Module
|
||||||
$this->setTemplateFile('filebox_add');
|
$this->setTemplateFile('filebox_add');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the current site's favicon
|
||||||
|
*/
|
||||||
|
public function dispModuleCurrentSiteFavicon()
|
||||||
|
{
|
||||||
|
$domain = ModuleModel::getSiteInfoByDomain($_SERVER['HTTP_HOST']) ?: ModuleModel::getDefaultDomainInfo();
|
||||||
|
$domain_srl = $domain->domain_srl ?? 0;
|
||||||
|
$filename = \RX_BASEDIR . 'files/attach/xeicon/' . ($domain_srl ? ($domain_srl . '/') : '') . 'favicon.ico';
|
||||||
|
|
||||||
|
if (Rhymix\Framework\Storage::exists($filename))
|
||||||
|
{
|
||||||
|
// Handle 304 Not Modified
|
||||||
|
if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) > filemtime($uploaded_filename))
|
||||||
|
{
|
||||||
|
header('HTTP/1.1 304 Not Modified');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear buffer
|
||||||
|
while(ob_get_level()) ob_end_clean();
|
||||||
|
|
||||||
|
// Set headers
|
||||||
|
header('Content-Type: image/x-icon');
|
||||||
|
header('Content-Length: ' . filesize($filename));
|
||||||
|
header('Cache-Control: private; max-age=3600');
|
||||||
|
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||||
|
|
||||||
|
// Print icon and exit
|
||||||
|
readfile($filename);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->stop('msg_not_founded');
|
||||||
|
$this->setHttpStatusCode(404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moved from mobile class
|
* Moved from mobile class
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue