Fix #2072 redirect to proper URL if a document with is_notice=A is requested without mid

This commit is contained in:
Kijin Sung 2023-03-23 22:44:47 +09:00
parent c6523706f8
commit 87a34af69e
2 changed files with 12 additions and 7 deletions

View file

@ -733,7 +733,12 @@ class ModuleHandler extends Handler
/** /**
* Check the value of $document_srl. This method is called during init(). * Check the value of $document_srl. This method is called during init().
* *
* @return object|false * This method returns:
* - Module info object if the document can be shown in the module,
* - null if the document can be shown but the module is unspecified,
* - false if we should redirect to another module.
*
* @return object|null|false
*/ */
protected function _checkDocumentSrl() protected function _checkDocumentSrl()
{ {
@ -745,7 +750,7 @@ class ModuleHandler extends Handler
if(!$this->mid || $this->mid !== $module_info->mid) if(!$this->mid || $this->mid !== $module_info->mid)
{ {
// If the document is notice-all, preserve the current mid. // If the document is notice-all, preserve the current mid.
if($module_info->is_notice === 'A') if($module_info->is_notice === 'A' && !empty($this->mid))
{ {
return null; return null;
} }

View file

@ -51,7 +51,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<tr loop="$document_list => $no, $oDocument"> <tr loop="$document_list => $no, $oDocument">
<td class="title"> <td class="title">
<a href="{getUrl('','document_srl',$oDocument->document_srl)}" target="_blank"><!--@if(trim($oDocument->getTitleText()) !== '')-->{escape($oDocument->getTitleText(), false)}<!--@else--><em>{$lang->no_title_document}</em><!--@end--></a> <a href="{$oDocument->getPermanentUrl()}" target="_blank"><!--@if(trim($oDocument->getTitleText()) !== '')-->{escape($oDocument->getTitleText(), false)}<!--@else--><em>{$lang->no_title_document}</em><!--@end--></a>
<span cond="isset($module_list[$oDocument->get('module_srl')])"> <span cond="isset($module_list[$oDocument->get('module_srl')])">
- <a href="{getUrl('', 'mid', $module_list[$oDocument->get('module_srl')]->mid)}" target="_blank">{$module_list[$oDocument->get('module_srl')]->browser_title}</a> - <a href="{getUrl('', 'mid', $module_list[$oDocument->get('module_srl')]->mid)}" target="_blank">{$module_list[$oDocument->get('module_srl')]->browser_title}</a>