mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 03:52:15 +09:00
Clean up procBoardRevertDocument #2515
This commit is contained in:
parent
b9014efb9d
commit
1be734edc1
1 changed files with 24 additions and 15 deletions
|
|
@ -290,30 +290,30 @@ class BoardController extends Board
|
||||||
public function procBoardRevertDocument()
|
public function procBoardRevertDocument()
|
||||||
{
|
{
|
||||||
$update_id = Context::get('update_id');
|
$update_id = Context::get('update_id');
|
||||||
$logged_info = Context::get('logged_info');
|
if (!$update_id)
|
||||||
if(!$update_id)
|
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('msg_no_update_id');
|
throw new Rhymix\Framework\Exception('msg_no_update_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocumentController = DocumentController::getInstance();
|
|
||||||
$update_log = DocumentModel::getUpdateLog($update_id);
|
$update_log = DocumentModel::getUpdateLog($update_id);
|
||||||
|
if (!$update_log)
|
||||||
if($logged_info->is_admin != 'Y')
|
|
||||||
{
|
|
||||||
$Exists_log = DocumentModel::getUpdateLogAdminisExists($update_log->document_srl);
|
|
||||||
if($Exists_log === true)
|
|
||||||
{
|
|
||||||
throw new Rhymix\Framework\Exception('msg_admin_update_log');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$update_log)
|
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('msg_no_update_log');
|
throw new Rhymix\Framework\Exception('msg_no_update_log');
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocument = DocumentModel::getDocument($update_log->document_srl);
|
$oDocument = DocumentModel::getDocument($update_log->document_srl);
|
||||||
|
if (!$oDocument->isGranted())
|
||||||
|
{
|
||||||
|
throw new Rhymix\Framework\Exceptions\NotPermitted();
|
||||||
|
}
|
||||||
|
if (!$this->user->isAdmin())
|
||||||
|
{
|
||||||
|
if (DocumentModel::getUpdateLogAdminisExists($update_log->document_srl))
|
||||||
|
{
|
||||||
|
throw new Rhymix\Framework\Exception('msg_admin_update_log');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
$obj->title = $update_log->title;
|
$obj->title = $update_log->title;
|
||||||
$obj->document_srl = $update_log->document_srl;
|
$obj->document_srl = $update_log->document_srl;
|
||||||
|
|
@ -322,10 +322,19 @@ class BoardController extends Board
|
||||||
$obj->content = $update_log->content;
|
$obj->content = $update_log->content;
|
||||||
$obj->update_log_setting = 'Y';
|
$obj->update_log_setting = 'Y';
|
||||||
$obj->reason_update = lang('board.revert_reason_update');
|
$obj->reason_update = lang('board.revert_reason_update');
|
||||||
|
$oDocumentController = DocumentController::getInstance();
|
||||||
$output = $oDocumentController->updateDocument($oDocument, $obj);
|
$output = $oDocumentController->updateDocument($oDocument, $obj);
|
||||||
$this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'),'act', '', 'document_srl', $update_log->document_srl));
|
if (!$output->toBool())
|
||||||
|
{
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
$this->add('mid', Context::get('mid'));
|
$this->add('mid', Context::get('mid'));
|
||||||
$this->add('document_srl', $update_log->document_srl);
|
$this->add('document_srl', $update_log->document_srl);
|
||||||
|
$this->setRedirectUrl(getNotEncodedUrl([
|
||||||
|
'mid' => Context::get('mid'),
|
||||||
|
'document_srl' => $update_log->document_srl,
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue