mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Ensure that all board config variables are available on all config screens #2433
This commit is contained in:
parent
967f67ec99
commit
936e1931c0
6 changed files with 166 additions and 39 deletions
|
|
@ -20,6 +20,9 @@ class BoardController extends Board
|
|||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
// Fix any missing module configurations
|
||||
BoardModel::fixModuleConfig($this->module_info);
|
||||
|
||||
// setup variables
|
||||
$obj = Context::getRequestVars();
|
||||
$obj->module_srl = $this->module_srl;
|
||||
|
|
@ -27,7 +30,7 @@ class BoardController extends Board
|
|||
unset($obj->extra_vars);
|
||||
|
||||
// Remove disallowed Unicode symbols.
|
||||
if ($this->module_info->filter_specialchars !== 'N')
|
||||
if ($this->module_info->filter_specialchars === 'Y')
|
||||
{
|
||||
if (isset($obj->title))
|
||||
{
|
||||
|
|
@ -50,14 +53,14 @@ class BoardController extends Board
|
|||
}
|
||||
|
||||
// Return error if content is too large.
|
||||
$document_length_limit = ($this->module_info->document_length_limit ?: 1024) * 1024;
|
||||
$document_length_limit = $this->module_info->document_length_limit * 1024;
|
||||
if (strlen($obj->content) > $document_length_limit && !$this->grant->manager)
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('msg_content_too_long');
|
||||
}
|
||||
|
||||
// Return error if content conains excessively large data URLs.
|
||||
$inline_data_url_limit = ($this->module_info->inline_data_url_limit ?: 64) * 1024;
|
||||
$inline_data_url_limit = $this->module_info->inline_data_url_limit * 1024;
|
||||
preg_match_all('!src="\s*(data:[^,]*,[a-z0-9+/=%$!._-]+)!i', (string)$obj->content, $matches);
|
||||
foreach ($matches[1] as $match)
|
||||
{
|
||||
|
|
@ -85,7 +88,7 @@ class BoardController extends Board
|
|||
$obj->category_srl = 0;
|
||||
}
|
||||
}
|
||||
if (!$obj->category_srl && ($this->module_info->allow_no_category ?? 'N') !== 'Y')
|
||||
if (!$obj->category_srl && $this->module_info->allow_no_category !== 'Y')
|
||||
{
|
||||
if (!$this->grant->manager)
|
||||
{
|
||||
|
|
@ -135,7 +138,7 @@ class BoardController extends Board
|
|||
$oDocument = DocumentModel::getDocument($obj->document_srl);
|
||||
|
||||
// Set anonymous information when insert mode or status is temp
|
||||
if($this->module_info->use_anonymous == 'Y' && (!$this->grant->manager || ($this->module_info->anonymous_except_admin ?? 'N') !== 'Y') && (!$oDocument->isExists() || $oDocument->get('status') == DocumentModel::getConfigStatus('temp')))
|
||||
if($this->module_info->use_anonymous == 'Y' && (!$this->grant->manager || $this->module_info->anonymous_except_admin === 'N') && (!$oDocument->isExists() || $oDocument->get('status') == DocumentModel::getConfigStatus('temp')))
|
||||
{
|
||||
if(!$obj->document_srl)
|
||||
{
|
||||
|
|
@ -143,7 +146,7 @@ class BoardController extends Board
|
|||
}
|
||||
|
||||
$manual = true;
|
||||
$anonymous_name = $this->module_info->anonymous_name ?: 'anonymous';
|
||||
$anonymous_name = $this->module_info->anonymous_name ?: BoardModel::DEFAULT_MODULE_CONFIG['anonymous_name'];
|
||||
$anonymous_name = $this->createAnonymousName($anonymous_name, $logged_info->member_srl, $obj->document_srl);
|
||||
|
||||
$obj->notify_message = 'N';
|
||||
|
|
@ -172,7 +175,7 @@ class BoardController extends Board
|
|||
}
|
||||
|
||||
// Protect admin document
|
||||
if ($this->module_info->protect_admin_content_update !== 'N')
|
||||
if ($this->module_info->protect_admin_content_update === 'Y')
|
||||
{
|
||||
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl'));
|
||||
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
|
||||
|
|
@ -361,6 +364,9 @@ class BoardController extends Board
|
|||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
// Fix any missing module configurations
|
||||
BoardModel::fixModuleConfig($this->module_info);
|
||||
|
||||
// check protect content
|
||||
if($this->module_info->protect_content == 'Y' || $this->module_info->protect_delete_content == 'Y')
|
||||
{
|
||||
|
|
@ -370,7 +376,7 @@ class BoardController extends Board
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->module_info->protect_admin_content_delete !== 'N' && $this->user->is_admin !== 'Y')
|
||||
if ($this->module_info->protect_admin_content_delete === 'Y' && $this->user->is_admin !== 'Y')
|
||||
{
|
||||
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl'));
|
||||
if($member_info->is_admin === 'Y')
|
||||
|
|
@ -462,8 +468,11 @@ class BoardController extends Board
|
|||
// Comments belong in the same module_srl as the document.
|
||||
$obj->module_srl = $oDocument->get('module_srl');
|
||||
|
||||
// Fix any missing module configurations
|
||||
BoardModel::fixModuleConfig($this->module_info);
|
||||
|
||||
// Remove disallowed Unicode symbols.
|
||||
if ($this->module_info->filter_specialchars !== 'N')
|
||||
if ($this->module_info->filter_specialchars === 'Y')
|
||||
{
|
||||
if (isset($obj->content))
|
||||
{
|
||||
|
|
@ -495,12 +504,14 @@ class BoardController extends Board
|
|||
}
|
||||
}
|
||||
|
||||
if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC';
|
||||
if(!$this->module_info->use_status)
|
||||
{
|
||||
$this->module_info->use_status = 'PUBLIC';
|
||||
}
|
||||
if(!is_array($this->module_info->use_status))
|
||||
{
|
||||
$this->module_info->use_status = explode('|@|', $this->module_info->use_status);
|
||||
}
|
||||
|
||||
if(in_array('SECRET', $this->module_info->use_status))
|
||||
{
|
||||
$this->module_info->secret = 'Y';
|
||||
|
|
@ -512,7 +523,7 @@ class BoardController extends Board
|
|||
}
|
||||
|
||||
// For anonymous use, remove writer's information and notifying information
|
||||
if($this->module_info->use_anonymous == 'Y' && (!$this->grant->manager || ($this->module_info->anonymous_except_admin ?? 'N') !== 'Y'))
|
||||
if($this->module_info->use_anonymous == 'Y' && (!$this->grant->manager || $this->module_info->anonymous_except_admin === 'N'))
|
||||
{
|
||||
$obj->notify_message = 'N';
|
||||
$obj->member_srl = -1*$logged_info->member_srl;
|
||||
|
|
@ -547,7 +558,7 @@ class BoardController extends Board
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->module_info->protect_admin_content_update !== 'N')
|
||||
if ($this->module_info->protect_admin_content_update === 'Y')
|
||||
{
|
||||
$member_info = MemberModel::getMemberInfo($comment->member_srl);
|
||||
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
|
||||
|
|
@ -651,6 +662,9 @@ class BoardController extends Board
|
|||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
// Fix any missing module configurations
|
||||
BoardModel::fixModuleConfig($this->module_info);
|
||||
|
||||
$childs = null;
|
||||
if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false)
|
||||
{
|
||||
|
|
@ -661,7 +675,7 @@ class BoardController extends Board
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->module_info->protect_admin_content_delete !== 'N' && $this->user->is_admin !== 'Y')
|
||||
if ($this->module_info->protect_admin_content_delete === 'Y' && $this->user->is_admin !== 'Y')
|
||||
{
|
||||
$member_info = MemberModel::getMemberInfo($comment->get('member_srl'));
|
||||
if($member_info->is_admin === 'Y')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue