Update more modules to throw exceptions

This commit is contained in:
Kijin Sung 2018-09-05 23:12:08 +09:00
parent c1cbc5dbdb
commit be1ce69073
21 changed files with 142 additions and 116 deletions

View file

@ -130,7 +130,7 @@ class layoutAdminController extends layout
$output = executeQuery('menu.getMenuItemByUrl', $tmpArgs);
if(!$output->toBool())
{
return $this->setError('fail_to_update');
throw new Rhymix\Framework\Exception('fail_to_update');
}
$menu_srl = $output->data->menu_srl;
@ -313,7 +313,7 @@ class layoutAdminController extends layout
if(!$output->toBool())
{
return $this->setError($output->message);
throw new Rhymix\Framework\Exception($output->message);
}
}
}
@ -356,7 +356,7 @@ class layoutAdminController extends layout
if(!$layout_srl || !$code || !$is_post)
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
$oLayoutModel = getModel('layout');
@ -377,7 +377,7 @@ class layoutAdminController extends layout
function procLayoutAdminCodeReset()
{
$layout_srl = Context::get('layout_srl');
if(!$layout_srl) return $this->setError('msg_invalid_request');
if(!$layout_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
// delete user layout file
$oLayoutModel = getModel('layout');
@ -480,13 +480,13 @@ class layoutAdminController extends layout
$oModuleModel = getModel('module');
$mid = Context::get('mid');
if(!$mid) return $this->setError('msg_invalid_request');
if(!$mid) throw new Rhymix\Framework\Exceptions\InvalidRequest;
$site_module_info = Context::get('site_module_info');
$columnList = array('layout_srl');
$module_info = $oModuleModel->getModuleInfoByMid($mid, $site_module_info->site_srl, $columnList);
$layout_srl = $module_info->layout_srl;
if(!$layout_srl) return $this->setError('msg_invalid_request');
if(!$layout_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
$oLayoutModel = getModel('layout');

View file

@ -295,11 +295,11 @@ class layoutAdminView extends layout
$layout_srl = Context::get('layout_srl');
$code = Context::get('code');
$code_css = Context::get('code_css');
if(!$layout_srl || !$code) return $this->setError('msg_invalid_request');
if(!$layout_srl || !$code) throw new Rhymix\Framework\Exceptions\InvalidRequest;
// Get the layout information
$oLayoutModel = getModel('layout');
$layout_info = $oLayoutModel->getLayout($layout_srl);
if(!$layout_info) return $this->setError('msg_invalid_request');
if(!$layout_info) throw new Rhymix\Framework\Exceptions\InvalidRequest;
// Separately handle the layout if its type is faceoff
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
// Apply CSS directly

View file

@ -55,7 +55,7 @@ class layoutView extends layout
$logged_info = Context::get('logged_info');
if($logged_info->is_admin != 'Y')
{
throw new Exception(lang('msg_invalid_request'));
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
// if module is 'ARTiCLE' and from site design setting, make content directly
@ -253,13 +253,13 @@ class layoutView extends layout
$output = executeQuery('layout.getOneModuleInstanceByModuleName', $args);
if(!$output->toBool())
{
throw new Exception($output->getMessage());
throw new Rhymix\Framework\Exception($output->getMessage());
}
// if there is no module instance, error...
if(!$output->data)
{
throw new Exception(lang('msg_unabled_preview'));
throw new Rhymix\Framework\Exception(lang('msg_unabled_preview'));
}
$mid = current($output->data)->mid;
@ -301,7 +301,7 @@ class layoutView extends layout
$oModule = $oModuleHandler->procModule();
if(!$oModule->toBool())
{
throw new Exception(lang('not_support_layout_preview'));
throw new Rhymix\Framework\Exception(lang('not_support_layout_preview'));
}
// get module html
@ -318,23 +318,23 @@ class layoutView extends layout
{
if(!checkCSRF())
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
// admin check
// this act is admin view but in normal view because do not load admin css/js files
$logged_info = Context::get('logged_info');
if($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request');
if($logged_info->is_admin != 'Y') throw new Rhymix\Framework\Exceptions\InvalidRequest;
$layout_srl = Context::get('layout_srl');
$code = Context::get('code');
$code_css = Context::get('code_css');
if(!$layout_srl || !$code) return $this->setError('msg_invalid_request');
if(!$layout_srl || !$code) throw new Rhymix\Framework\Exceptions\InvalidRequest;
// Get the layout information
$oLayoutModel = getModel('layout');
$layout_info = $oLayoutModel->getLayout($layout_srl);
if(!$layout_info) return $this->setError('msg_invalid_request');
if(!$layout_info) throw new Rhymix\Framework\Exceptions\InvalidRequest;
// Separately handle the layout if its type is faceoff
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
// Apply CSS directly