mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +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'],
|
||||
'priority' => 0,
|
||||
),
|
||||
'favicon\.ico' => array(
|
||||
'regexp' => '#^favicon\.ico$#',
|
||||
'vars' => [],
|
||||
'extra_vars' => ['module' => 'module', 'act' => 'dispModuleCurrentSiteFavicon'],
|
||||
'priority' => 0,
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,17 +6,18 @@
|
|||
<action name="dispModuleSkinInfo" type="view" permission="all-managers" 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="dispModuleCurrentSiteFavicon" type="view" standalone="true" />
|
||||
<action name="dispModuleChangeLang" type="view" />
|
||||
|
||||
|
||||
<action name="getModuleSkinInfoList" type="model" permission="root" />
|
||||
<action name="getFileBoxListHtml" type="model" permission="root" />
|
||||
<action name="getModuleInfoByMenuItemSrl" type="model" permission="root" />
|
||||
<action name="getLangListByLangcodeForAutoComplete" type="model" permission="manager" />
|
||||
<action name="getLangByLangcode" type="model" />
|
||||
|
||||
|
||||
<action name="procModuleFileBoxAdd" type="controller" permission="root" />
|
||||
<action name="procModuleFileBoxDelete" type="controller" permission="root" />
|
||||
|
||||
|
||||
<action name="dispModuleAdminContent" type="view" menu_name="installedModule" menu_index="true" admin_index="true" />
|
||||
<action name="dispModuleAdminCategory" type="view" menu_name="installedModule" />
|
||||
<action name="dispModuleAdminInfo" type="view" />
|
||||
|
|
@ -26,7 +27,7 @@
|
|||
<action name="dispModuleAdminCopyModule" type="view" />
|
||||
<action name="dispModuleAdminFileBox" type="view" menu_name="filebox" menu_index="true" />
|
||||
<action name="dispModuleAdminLangcode" type="view" menu_name="multilingual" menu_index="true" />
|
||||
|
||||
|
||||
<action name="getModuleAdminModuleList" type="model" />
|
||||
<action name="getModuleAdminModuleInfo" type="model" />
|
||||
<action name="getModuleAdminGrant" type="model" />
|
||||
|
|
@ -36,12 +37,12 @@
|
|||
<action name="getModuleAdminModuleSearcherHtml" type="model" />
|
||||
<action name="getModuleAdminMultilingualHtml" type="model" permission="manager" />
|
||||
<action name="getModuleAdminLangListHtml" type="model" permission="manager" />
|
||||
|
||||
|
||||
<action name="procModuleAdminInsertCategory" type="controller" ruleset="insertCategory" />
|
||||
<action name="procModuleAdminUpdateCategory" type="controller" ruleset="updateCategory" />
|
||||
<action name="procModuleAdminDeleteCategory" type="controller" ruleset="deleteCategory" />
|
||||
<action name="procModuleAdminModuleSetup" type="controller" ruleset="insertModuleSetup" />
|
||||
<action name="procModuleAdminModuleGrantSetup" type="controller" ruleset="insertModulesGrant" />
|
||||
<action name="procModuleAdminModuleGrantSetup" type="controller" ruleset="insertModulesGrant" />
|
||||
<action name="procModuleAdminCopyModule" type="controller" ruleset="copyModule" />
|
||||
<action name="procModuleAdminInsertGrant" type="controller" permission="manager" check_var="module_srl" />
|
||||
<action name="procModuleAdminUpdateSkinInfo" type="controller" permission="manager" check_var="module_srl" />
|
||||
|
|
|
|||
|
|
@ -143,6 +143,44 @@ class ModuleView extends Module
|
|||
$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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue