mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Update more modules to throw exceptions
This commit is contained in:
parent
c1cbc5dbdb
commit
be1ce69073
21 changed files with 142 additions and 116 deletions
|
|
@ -61,7 +61,7 @@ class Advanced_MailerAdminController extends Advanced_Mailer
|
|||
{
|
||||
if ($method !== 'default' && !isset($sending_methods[$method]))
|
||||
{
|
||||
return $this->setError('msg_advanced_mailer_sending_method_is_invalid');
|
||||
throw new Rhymix\Framework\Exception('msg_advanced_mailer_sending_method_is_invalid');
|
||||
}
|
||||
if ($method !== 'default')
|
||||
{
|
||||
|
|
@ -69,7 +69,7 @@ class Advanced_MailerAdminController extends Advanced_Mailer
|
|||
{
|
||||
if (!Rhymix\Framework\Config::get("mail.$method.$conf_name"))
|
||||
{
|
||||
return $this->setError('msg_advanced_mailer_sending_method_is_not_configured', lang('cmd_advanced_mailer_sending_method_' . $method));
|
||||
throw new Rhymix\Framework\Exception(sprintf('msg_advanced_mailer_sending_method_is_not_configured', lang('cmd_advanced_mailer_sending_method_' . $method)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -155,11 +155,11 @@ class Advanced_MailerAdminController extends Advanced_Mailer
|
|||
$clear_before_days = intval(Context::get('clear_before_days'));
|
||||
if (!in_array($status, array('success', 'error')))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
if ($clear_before_days < 0)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$obj = new stdClass();
|
||||
|
|
@ -186,11 +186,11 @@ class Advanced_MailerAdminController extends Advanced_Mailer
|
|||
$clear_before_days = intval(Context::get('clear_before_days'));
|
||||
if (!in_array($status, array('success', 'error')))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
if ($clear_before_days < 0)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$obj = new stdClass();
|
||||
|
|
|
|||
|
|
@ -250,9 +250,18 @@ class editorAdminController extends editor
|
|||
$args->enabled = $enabled;
|
||||
$args->site_srl = $site_srl;
|
||||
// Check if the component exists
|
||||
if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args);
|
||||
else $output = executeQuery('editor.isSiteComponentInserted', $args);
|
||||
if($output->data->count) return $this->setError('msg_component_is_not_founded');
|
||||
if(!$site_srl)
|
||||
{
|
||||
$output = executeQuery('editor.isComponentInserted', $args);
|
||||
{
|
||||
else
|
||||
{
|
||||
$output = executeQuery('editor.isSiteComponentInserted', $args);
|
||||
}
|
||||
if($output->data->count)
|
||||
{
|
||||
return new BaseObject(-1, 'msg_component_is_not_founded');
|
||||
}
|
||||
// Inert a component
|
||||
$args->list_order = getNextSequence();
|
||||
if(!$site_srl) $output = executeQuery('editor.insertComponent', $args);
|
||||
|
|
|
|||
|
|
@ -47,18 +47,23 @@ class editorController extends editor
|
|||
{
|
||||
$component = Context::get('component');
|
||||
$method = Context::get('method');
|
||||
if(!$component) return $this->setError('msg_component_is_not_founded', $component);
|
||||
if(!$component)
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('msg_component_is_not_founded', $component);
|
||||
}
|
||||
|
||||
$oEditorModel = getModel('editor');
|
||||
$oComponent = &$oEditorModel->getComponentObject($component);
|
||||
if(!$oComponent->toBool()) return $oComponent;
|
||||
|
||||
if(!method_exists($oComponent, $method)) return $this->setError('msg_component_is_not_founded', $component);
|
||||
if(!method_exists($oComponent, $method))
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('msg_component_is_not_founded', $component);
|
||||
}
|
||||
|
||||
//$output = call_user_method($method, $oComponent);
|
||||
//$output = call_user_func(array($oComponent, $method));
|
||||
if(method_exists($oComponent, $method)) $output = $oComponent->{$method}();
|
||||
else return $this->setError('%s method is not exists', $method);
|
||||
$output = $oComponent->{$method}();
|
||||
|
||||
if($output instanceof BaseObject && !$output->toBool()) return $output;
|
||||
|
||||
|
|
@ -93,13 +98,13 @@ class editorController extends editor
|
|||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
|
||||
if (!$module_info->module_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$module_grant = $oModuleModel->getGrant($module_info, $logged_info);
|
||||
if (!$module_grant->manager)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$module_srl[] = $srl;
|
||||
|
|
|
|||
|
|
@ -492,11 +492,11 @@ class editorModel extends editor
|
|||
// Create an object of the component and execute
|
||||
$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
|
||||
$class_file = sprintf('%s%s.class.php', $class_path, $component);
|
||||
if(!file_exists($class_file)) return $this->setError('msg_component_is_not_founded', $component);
|
||||
if(!file_exists($class_file)) return new BaseObject(-1, 'msg_component_is_not_founded', $component);
|
||||
// Create an object after loading the class file
|
||||
require_once($class_file);
|
||||
$oComponent = new $component($editor_sequence, $class_path);
|
||||
if(!$oComponent) return $this->setError('msg_component_is_not_founded', $component);
|
||||
if(!$oComponent) return new BaseObject(-1, 'msg_component_is_not_founded', $component);
|
||||
// Add configuration information
|
||||
$component_info = $this->getComponent($component, $site_srl);
|
||||
$oComponent->setInfo($component_info);
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ class menuAdminController extends menu
|
|||
{
|
||||
if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
foreach($moduleInfos as $moduleInfo)
|
||||
|
|
@ -252,7 +252,7 @@ class menuAdminController extends menu
|
|||
|
||||
$oAdmin = getClass('admin');
|
||||
if($menuInfo->title == $oAdmin->getAdminMenuName())
|
||||
return $this->setError('msg_adminmenu_cannot_delete');
|
||||
throw new Rhymix\Framework\Exception('msg_adminmenu_cannot_delete');
|
||||
|
||||
// get menu properies with child menu
|
||||
$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
|
||||
|
|
@ -283,13 +283,13 @@ class menuAdminController extends menu
|
|||
|
||||
if($isStartmenuInclude)
|
||||
{
|
||||
return $this->setError('msg_cannot_delete_homemenu');
|
||||
throw new Rhymix\Framework\Exception('msg_cannot_delete_homemenu');
|
||||
}
|
||||
|
||||
$output = $this->deleteMenu($menu_srl);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $this->setError($output->message);
|
||||
throw new Rhymix\Framework\Exception($output->message);
|
||||
}
|
||||
|
||||
$this->setMessage('success_deleted', 'info');
|
||||
|
|
@ -389,13 +389,13 @@ class menuAdminController extends menu
|
|||
|
||||
if(!$request->parent_srl || !$request->menu_name)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$this->_setMenuSrl($request->parent_srl, $request->menu_srl);
|
||||
if(!$request->menu_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
if($request->is_shortcut == 'Y')
|
||||
|
|
@ -475,7 +475,7 @@ class menuAdminController extends menu
|
|||
$itemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
|
||||
if(!$itemInfo->menu_item_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
unset($itemInfo->normal_btn, $itemInfo->hover_btn, $itemInfo->active_btn);
|
||||
|
||||
|
|
@ -540,7 +540,7 @@ class menuAdminController extends menu
|
|||
|
||||
if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
// when menu copy, module already copied
|
||||
|
|
@ -549,7 +549,7 @@ class menuAdminController extends menu
|
|||
$result = $this->_insertModule($request, $args);
|
||||
if(!$result->toBool())
|
||||
{
|
||||
return $this->setError($result->message);
|
||||
throw new Rhymix\Framework\Exception($result->message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -560,7 +560,7 @@ class menuAdminController extends menu
|
|||
|
||||
if(!$request->module_id)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$args->url = $request->module_id;
|
||||
|
|
@ -625,7 +625,7 @@ class menuAdminController extends menu
|
|||
$output = $oModuleModel->getModuleInfoByMid($request->module_id);
|
||||
if($output->module_srl)
|
||||
{
|
||||
return $this->setError('msg_module_name_exists');
|
||||
throw new Rhymix\Framework\Exception('msg_module_name_exists');
|
||||
}
|
||||
|
||||
$oModuleController = getController('module');
|
||||
|
|
@ -644,7 +644,7 @@ class menuAdminController extends menu
|
|||
|
||||
if(!$request->menu_item_srl || !$request->menu_name)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
// variables set
|
||||
|
|
@ -671,7 +671,7 @@ class menuAdminController extends menu
|
|||
$newItemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
|
||||
if(!$newItemInfo->menu_item_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$args->url = $newItemInfo->url;
|
||||
|
|
@ -691,7 +691,7 @@ class menuAdminController extends menu
|
|||
$output = $oModuleModel->getModuleInfoByMid($request->module_id);
|
||||
if($output->module_srl)
|
||||
{
|
||||
return $this->setError('msg_module_name_exists');
|
||||
throw new Rhymix\Framework\Exception('msg_module_name_exists');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -699,7 +699,7 @@ class menuAdminController extends menu
|
|||
$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url);
|
||||
if(!$moduleInfo)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$moduleInfo->mid = $request->module_id;
|
||||
|
|
@ -892,7 +892,7 @@ class menuAdminController extends menu
|
|||
$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
|
||||
if($isStartmenuInclude)
|
||||
{
|
||||
return $this->setError('msg_cannot_delete_homemenu');
|
||||
throw new Rhymix\Framework\Exception('msg_cannot_delete_homemenu');
|
||||
}
|
||||
|
||||
$oDB = DB::getInstance();
|
||||
|
|
@ -990,7 +990,7 @@ class menuAdminController extends menu
|
|||
$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $this->setError($output->message);
|
||||
throw new Rhymix\Framework\Exception($output->message);
|
||||
}
|
||||
|
||||
if(is_array($node['list']))
|
||||
|
|
@ -1013,7 +1013,7 @@ class menuAdminController extends menu
|
|||
$source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number
|
||||
$target_srl = Context::get('target_srl'); // Self menu item serial number
|
||||
|
||||
if(!$mode || !$parent_srl || !$target_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$mode || !$parent_srl || !$target_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oMenuAdminModel = getAdminModel('menu');
|
||||
|
||||
|
|
@ -1023,7 +1023,7 @@ class menuAdminController extends menu
|
|||
$targetMenuItemInfo = $oMenuAdminModel->getMenuItemInfo($target_srl);
|
||||
if(!$originalItemInfo->menu_item_srl || (!$targetMenuInfo->menu_srl && !$targetMenuItemInfo->menu_item_srl))
|
||||
{
|
||||
return $this->setError('msg_empty_menu_item');
|
||||
throw new Rhymix\Framework\Exception('msg_empty_menu_item');
|
||||
}
|
||||
|
||||
// get menu properies with child menu
|
||||
|
|
@ -1407,7 +1407,7 @@ class menuAdminController extends menu
|
|||
$oMenuAdminModel = getAdminModel('menu');
|
||||
|
||||
$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
|
||||
if($target_item->menu_item_srl != $target_srl) return $this->setError('msg_invalid_request');
|
||||
if($target_item->menu_item_srl != $target_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
// Move the menu location(change the order menu appears)
|
||||
if($mode == 'move')
|
||||
{
|
||||
|
|
@ -1418,7 +1418,7 @@ class menuAdminController extends menu
|
|||
if($source_srl)
|
||||
{
|
||||
$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
|
||||
if($source_item->menu_item_srl != $source_srl) return $this->setError('msg_invalid_request');
|
||||
if($source_item->menu_item_srl != $source_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
$args->listorder = $source_item->listorder-1;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ class menuAdminModel extends menu
|
|||
$menuItemSrl = Context::get('menu_item_srl');
|
||||
if(!$menuItemSrl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$menuItemInfo = $this->getMenuItemInfo($menuItemSrl);
|
||||
|
|
@ -622,7 +622,7 @@ class menuAdminModel extends menu
|
|||
// if menu is shortcut
|
||||
if($menuItemInfo->is_shortcut == 'Y')
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
// get module info
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class ncenterliteAdminController extends ncenterlite
|
|||
$output = $oModuleController->insertModuleConfig('ncenterlite', $config);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $this->setError('ncenterlite_msg_setting_error');
|
||||
throw new Rhymix\Framework\Exception('ncenterlite_msg_setting_error');
|
||||
}
|
||||
|
||||
$this->setMessage('success_updated');
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class ncenterliteController extends ncenterlite
|
|||
$config = $oNcenterliteModel->getConfig();
|
||||
if($config->user_notify_setting != 'Y')
|
||||
{
|
||||
return $this->setError('msg_not_use_user_setting');
|
||||
throw new Rhymix\Framework\Exception('msg_not_use_user_setting');
|
||||
}
|
||||
|
||||
$member_srl = Context::get('member_srl');
|
||||
|
|
@ -21,7 +21,7 @@ class ncenterliteController extends ncenterlite
|
|||
|
||||
if($logged_info->member_srl != $member_srl && $logged_info->is_admin != 'Y')
|
||||
{
|
||||
return $this->setError('ncenterlite_stop_no_permission_other_user_settings');
|
||||
throw new Rhymix\Framework\Exception('ncenterlite_stop_no_permission_other_user_settings');
|
||||
}
|
||||
|
||||
$user_config = $oNcenterliteModel->getUserConfig($member_srl);
|
||||
|
|
@ -959,7 +959,7 @@ class ncenterliteController extends ncenterlite
|
|||
$logged_info = Context::get('logged_info');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$output = $this->updateNotifyReadAll($logged_info->member_srl);
|
||||
|
|
@ -973,7 +973,7 @@ class ncenterliteController extends ncenterlite
|
|||
$notify = Context::get('notify');
|
||||
if(!$logged_info || !$url || !$notify)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$output = $this->updateNotifyRead($notify, $logged_info->member_srl);
|
||||
|
|
|
|||
|
|
@ -45,13 +45,13 @@ class ncenterliteView extends ncenterlite
|
|||
$config = $oNcenterliteModel->getConfig();
|
||||
if($config->user_notify_setting != 'Y')
|
||||
{
|
||||
return $this->setError('msg_not_use_user_setting');
|
||||
throw new Rhymix\Framework\Exception('msg_not_use_user_setting');
|
||||
}
|
||||
|
||||
$oMemberModel = getModel('member');
|
||||
$member_srl = Context::get('member_srl');
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!Context::get('is_logged')) return $this->setError('ncenterlite_stop_login_required');
|
||||
if(!Context::get('is_logged')) throw new Rhymix\Framework\Exception('ncenterlite_stop_login_required');
|
||||
|
||||
if($logged_info->is_admin == 'Y' && $member_srl)
|
||||
{
|
||||
|
|
@ -62,7 +62,7 @@ class ncenterliteView extends ncenterlite
|
|||
{
|
||||
if($member_srl != $logged_info->member_srl)
|
||||
{
|
||||
return $this->setError('ncenterlite_stop_no_permission_other_user');
|
||||
throw new Rhymix\Framework\Exception('ncenterlite_stop_no_permission_other_user');
|
||||
}
|
||||
}
|
||||
$output = $oNcenterliteModel->getUserConfig($member_srl);
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class pageAdminController extends page
|
|||
{
|
||||
$module_srl = Context::get('module_srl');
|
||||
$content = Context::get('content');
|
||||
if(!$module_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$module_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
$mcontent = Context::get('mcontent');
|
||||
$type = Context::get('type');
|
||||
// Guhaeom won information page
|
||||
|
|
@ -301,7 +301,7 @@ class pageAdminController extends page
|
|||
|
||||
if(!$grant->manager)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$obj = Context::getRequestVars();
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ class pageAdminView extends page
|
|||
}
|
||||
else
|
||||
{
|
||||
return $this->setError(sprintf('%s method is not exists', $method));
|
||||
throw new Rhymix\Framework\Exception(sprintf('%s method is not exists', $method));
|
||||
}
|
||||
|
||||
Context::set('module_info', $this->module_info);
|
||||
|
|
|
|||
|
|
@ -33,8 +33,14 @@ class pageMobile extends pageView
|
|||
|
||||
$page_type_name = strtolower($this->module_info->page_type);
|
||||
$method = '_get' . ucfirst($page_type_name) . 'Content';
|
||||
if (method_exists($this, $method)) $page_content = $this->{$method}();
|
||||
else return $this->setError('%s method is not exists', $method);
|
||||
if (method_exists($this, $method))
|
||||
{
|
||||
$page_content = $this->{$method}();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('%s method is not exists', $method);
|
||||
}
|
||||
|
||||
Context::set('module_info', $this->module_info);
|
||||
Context::set('page_content', $page_content);
|
||||
|
|
|
|||
|
|
@ -50,8 +50,14 @@ class pageView extends page
|
|||
|
||||
$page_type_name = strtolower($this->module_info->page_type);
|
||||
$method = '_get' . ucfirst($page_type_name) . 'Content';
|
||||
if(method_exists($this, $method)) $page_content = $this->{$method}();
|
||||
else return $this->setError('%s method is not exists', $method);
|
||||
if(method_exists($this, $method))
|
||||
{
|
||||
$page_content = $this->{$method}();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('%s method is not exists', $method);
|
||||
}
|
||||
|
||||
Context::set('module_info', $this->module_info);
|
||||
Context::set('page_content', $page_content);
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class pollController extends poll
|
|||
}
|
||||
}
|
||||
|
||||
if(!count($args->poll)) return $this->setError('cmd_null_item');
|
||||
if(!count($args->poll)) throw new Rhymix\Framework\Exception('cmd_null_item');
|
||||
|
||||
$args->stop_date = $stop_date;
|
||||
|
||||
|
|
@ -178,12 +178,12 @@ class pollController extends poll
|
|||
$poll_index_srl = (int) Context::get('index_srl');
|
||||
$poll_item_title = Context::get('title');
|
||||
|
||||
if($poll_item_title=='') return $this->setError("msg_item_title_cannot_empty");
|
||||
if($poll_item_title=='') throw new Rhymix\Framework\Exception('msg_item_title_cannot_empty');
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info) return $this->setError("msg_cannot_add_item");
|
||||
if(!$logged_info) throw new Rhymix\Framework\Exception('msg_cannot_add_item');
|
||||
|
||||
if(!$poll_srl || !$poll_index_srl) return $this->setError("msg_invalid_request");
|
||||
if(!$poll_srl || !$poll_index_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$args = new stdClass();
|
||||
$args->poll_srl = $poll_srl;
|
||||
|
|
@ -191,10 +191,10 @@ class pollController extends poll
|
|||
// Get the information related to the survey
|
||||
$columnList = array('poll_type');
|
||||
$output = executeQuery('poll.getPoll', $args, $columnList);
|
||||
if(!$output->data) return $this->setError("poll_no_poll_or_deleted_poll");
|
||||
if(!$output->data) throw new Rhymix\Framework\Exception('poll_no_poll_or_deleted_poll');
|
||||
$type = $output->data->poll_type;
|
||||
|
||||
if(!$this->isAbletoAddItem($type)) return $this->setError("msg_cannot_add_item");
|
||||
if(!$this->isAbletoAddItem($type)) throw new Rhymix\Framework\Exception('msg_cannot_add_item');
|
||||
|
||||
if($logged_info->is_admin != 'Y')
|
||||
{
|
||||
|
|
@ -227,9 +227,9 @@ class pollController extends poll
|
|||
$poll_item_srl = Context::get('item_srl');
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info) return $this->setError("msg_cannot_delete_item");
|
||||
if(!$logged_info) throw new Rhymix\Framework\Exception('msg_cannot_delete_item');
|
||||
|
||||
if(!$poll_srl || !$poll_index_srl || !$poll_item_srl) return $this->setError("msg_invalid_request");
|
||||
if(!$poll_srl || !$poll_index_srl || !$poll_item_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$args = new stdClass();
|
||||
$args->poll_srl = $poll_srl;
|
||||
|
|
@ -245,11 +245,11 @@ class pollController extends poll
|
|||
// Get the information related to the survey
|
||||
$columnList = array('member_srl');
|
||||
$output = executeQuery('poll.getPoll', $args, $columnList);
|
||||
if(!$output->data) return $this->setError("poll_no_poll_or_deleted_poll");
|
||||
if(!$output->data) throw new Rhymix\Framework\Exception('poll_no_poll_or_deleted_poll');
|
||||
$poll_member_srl = $output->data->member_srl;
|
||||
|
||||
if($add_user_srl!=$logged_info->member_srl && $poll_member_srl!=$logged_info->member_srl) return $this->setError("msg_cannot_delete_item");
|
||||
if($poll_count>0) return $this->setError("msg_cannot_delete_item_poll_exist");
|
||||
if($add_user_srl!=$logged_info->member_srl && $poll_member_srl!=$logged_info->member_srl) throw new Rhymix\Framework\Exception('msg_cannot_delete_item');
|
||||
if($poll_count>0) throw new Rhymix\Framework\Exception('msg_cannot_delete_item_poll_exist');
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
|
@ -280,9 +280,9 @@ class pollController extends poll
|
|||
// Get the information related to the survey
|
||||
$columnList = array('poll_count', 'stop_date','poll_type');
|
||||
$output = executeQuery('poll.getPoll', $args, $columnList);
|
||||
if(!$output->data) return $this->setError("poll_no_poll_or_deleted_poll");
|
||||
if(!$output->data) throw new Rhymix\Framework\Exception('poll_no_poll_or_deleted_poll');
|
||||
|
||||
if($output->data->stop_date < date("Ymd")) return $this->setError("msg_cannot_vote");
|
||||
if($output->data->stop_date < date("Ymd")) throw new Rhymix\Framework\Exception('msg_cannot_vote');
|
||||
|
||||
$columnList = array('checkcount');
|
||||
$output = executeQuery('poll.getPollTitle', $args, $columnList);
|
||||
|
|
@ -290,7 +290,7 @@ class pollController extends poll
|
|||
|
||||
$poll_srl_indexes = Context::get('poll_srl_indexes');
|
||||
$tmp_item_srls = explode(',',$poll_srl_indexes);
|
||||
//if(count($tmp_item_srls)-1>(int)$output->data->checkcount) return $this->setError("msg_exceed_max_select");
|
||||
//if(count($tmp_item_srls)-1>(int)$output->data->checkcount) throw new Rhymix\Framework\Exception('msg_exceed_max_select');
|
||||
for($i=0;$i<count($tmp_item_srls);$i++)
|
||||
{
|
||||
$srl = (int)trim($tmp_item_srls[$i]);
|
||||
|
|
@ -299,10 +299,10 @@ class pollController extends poll
|
|||
}
|
||||
|
||||
// If there is no response item, display an error
|
||||
if(!count($item_srls)) return $this->setError('msg_check_poll_item');
|
||||
if(!count($item_srls)) throw new Rhymix\Framework\Exception('msg_check_poll_item');
|
||||
// Make sure is the poll has already been taken
|
||||
$oPollModel = getModel('poll');
|
||||
if($oPollModel->isPolled($poll_srl)) return $this->setError('msg_already_poll');
|
||||
if($oPollModel->isPolled($poll_srl)) throw new Rhymix\Framework\Exception('msg_already_poll');
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
|
@ -382,7 +382,7 @@ class pollController extends poll
|
|||
*/
|
||||
function procPollGetList()
|
||||
{
|
||||
if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
|
||||
if(!Context::get('is_logged')) throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
$pollSrls = Context::get('poll_srls');
|
||||
if($pollSrls) $pollSrlList = explode(',', $pollSrls);
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class rssAdminController extends rss
|
|||
|
||||
if(isset($msg['error']))
|
||||
{
|
||||
return $this->setError($msg['error']);
|
||||
throw new Rhymix\Framework\Exception($msg['error']);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -98,7 +98,7 @@ class rssAdminController extends rss
|
|||
|
||||
if(!count($target_module_srls))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
foreach($target_module_srls as $module_srl)
|
||||
|
|
@ -144,7 +144,7 @@ class rssAdminController extends rss
|
|||
$config = getModel('rss')->getConfig();
|
||||
if(!$config->image)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
FileHandler::removeFile($config->image);
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ class trashAdminController extends trash
|
|||
|
||||
//module relation data delete...
|
||||
$output = $this->_relationDataDelete($isAll, $is_type, $trashSrls);
|
||||
if(!$output->toBool()) return $this->setError($output->message);
|
||||
if(!$output->toBool()) throw new Rhymix\Framework\Exception($output->message);
|
||||
|
||||
if(!$this->_emptyTrash($trashSrls)) return $this->setError($lang->fail_empty);
|
||||
if(!$this->_emptyTrash($trashSrls)) throw new Rhymix\Framework\Exception($lang->fail_empty);
|
||||
|
||||
$this->setMessage('success_deleted', 'info');
|
||||
|
||||
|
|
@ -114,14 +114,14 @@ class trashAdminController extends trash
|
|||
{
|
||||
//class file check
|
||||
$classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule());
|
||||
if(!is_dir(FileHandler::getRealPath($classPath))) return $this->setError('not exist restore module directory');
|
||||
if(!is_dir(FileHandler::getRealPath($classPath))) throw new Rhymix\Framework\Exception('not exist restore module directory');
|
||||
|
||||
$classFile = sprintf('%s%s.admin.controller.php', $classPath, $oTrashVO->getOriginModule());
|
||||
$classFile = FileHandler::getRealPath($classFile);
|
||||
if(!file_exists($classFile)) return $this->setError('not exist restore module class file');
|
||||
if(!file_exists($classFile)) throw new Rhymix\Framework\Exception('not exist restore module class file');
|
||||
|
||||
$oAdminController = getAdminController($oTrashVO->getOriginModule());
|
||||
if(!method_exists($oAdminController, 'emptyTrash')) return $this->setError('not exist restore method in module class file');
|
||||
if(!method_exists($oAdminController, 'emptyTrash')) throw new Rhymix\Framework\Exception('not exist restore method in module class file');
|
||||
|
||||
$output2 = $oAdminController->emptyTrash($oTrashVO->getSerializedObject());
|
||||
if(!$output2->toBool()) return $output;
|
||||
|
|
@ -154,14 +154,14 @@ class trashAdminController extends trash
|
|||
|
||||
//class file check
|
||||
$classPath = ModuleHandler::getModulePath($output->data->getOriginModule());
|
||||
if(!is_dir(FileHandler::getRealPath($classPath))) return $this->setError('not exist restore module directory');
|
||||
if(!is_dir(FileHandler::getRealPath($classPath))) throw new Rhymix\Framework\Exception('not exist restore module directory');
|
||||
|
||||
$classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule());
|
||||
$classFile = FileHandler::getRealPath($classFile);
|
||||
if(!file_exists($classFile)) return $this->setError('not exist restore module class file');
|
||||
if(!file_exists($classFile)) throw new Rhymix\Framework\Exception('not exist restore module class file');
|
||||
|
||||
$oAdminController = getAdminController($output->data->getOriginModule());
|
||||
if(!method_exists($oAdminController, 'restoreTrash')) return $this->setError('not exist restore method in module class file');
|
||||
if(!method_exists($oAdminController, 'restoreTrash')) throw new Rhymix\Framework\Exception('not exist restore method in module class file');
|
||||
|
||||
$originObject = unserialize($output->data->getSerializedObject());
|
||||
$output = $oAdminController->restoreTrash($originObject);
|
||||
|
|
@ -176,7 +176,7 @@ class trashAdminController extends trash
|
|||
// restore object delete in trash box
|
||||
if(!$this->_emptyTrash($trashSrlList)) {
|
||||
$oDB->rollback();
|
||||
return $this->setError($lang->fail_empty);
|
||||
throw new Rhymix\Framework\Exception($lang->fail_empty);
|
||||
}
|
||||
$oDB->commit();
|
||||
}
|
||||
|
|
@ -193,7 +193,7 @@ class trashAdminController extends trash
|
|||
*/
|
||||
function procTrashAdminGetList()
|
||||
{
|
||||
if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
|
||||
if(!Context::get('is_logged')) throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
$trashSrls = Context::get('trash_srls');
|
||||
if($trashSrls) $trashSrlList = explode(',', $trashSrls);
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class trashAdminView extends trash
|
|||
|
||||
$oTrashModel = getModel('trash');
|
||||
$output = $oTrashModel->getTrash($trash_srl);
|
||||
if(!$output->data->getTrashSrl()) return $this->setError('msg_invalid_request');
|
||||
if(!$output->data->getTrashSrl()) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$originObject = unserialize($output->data->getSerializedObject());
|
||||
if(is_array($originObject)) $originObject = (object)$originObject;
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ class widgetController extends widget
|
|||
function procWidgetGenerateCode()
|
||||
{
|
||||
$widget = Context::get('selected_widget');
|
||||
if(!$widget) return $this->setError('msg_invalid_request');
|
||||
if(!Context::get('skin')) return $this->setError('msg_widget_skin_is_null');
|
||||
if(!$widget) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
if(!Context::get('skin')) throw new Rhymix\Framework\Exception('msg_widget_skin_is_null');
|
||||
|
||||
$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
|
||||
|
||||
|
|
@ -63,9 +63,9 @@ class widgetController extends widget
|
|||
function procWidgetGenerateCodeInPage()
|
||||
{
|
||||
$widget = Context::get('selected_widget');
|
||||
if(!$widget) return $this->setError('msg_invalid_request');
|
||||
if(!$widget) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return $this->setError('msg_widget_skin_is_null');
|
||||
if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) throw new Rhymix\Framework\Exception('msg_widget_skin_is_null');
|
||||
|
||||
$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
|
||||
// Wanted results
|
||||
|
|
@ -112,18 +112,18 @@ class widgetController extends widget
|
|||
$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
|
||||
if(!$page_info->module_srl || $page_info->module != 'page') $err++;
|
||||
|
||||
if($err > 1) return $this->setError('msg_invalid_request');
|
||||
if($err > 1) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
// Check permissions
|
||||
$logged_info = Context::get('logged_info');
|
||||
if (!$logged_info->member_srl)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
$module_grant = $oModuleModel->getGrant($page_info, $logged_info);
|
||||
if (!$module_grant->manager)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
// Enter post
|
||||
|
|
@ -167,25 +167,25 @@ class widgetController extends widget
|
|||
$oDocumentAdminController = getAdminController('document');
|
||||
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
if(!$oDocument->isExists()) return $this->setError('msg_invalid_request');
|
||||
if(!$oDocument->isExists()) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
$module_srl = $oDocument->get('module_srl');
|
||||
|
||||
// Destination Information Wanted page module
|
||||
$oModuleModel = getModel('module');
|
||||
$columnList = array('module_srl', 'module');
|
||||
$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
|
||||
if(!$page_info->module_srl || $page_info->module != 'page') return $this->setError('msg_invalid_request');
|
||||
if(!$page_info->module_srl || $page_info->module != 'page') throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
// Check permissions
|
||||
$logged_info = Context::get('logged_info');
|
||||
if (!$logged_info->member_srl)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
$module_grant = $oModuleModel->getGrant($page_info, $logged_info);
|
||||
if (!$module_grant->manager)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0);
|
||||
|
|
@ -214,18 +214,18 @@ class widgetController extends widget
|
|||
// Destination Information Wanted page module
|
||||
$oModuleModel = getModel('module');
|
||||
$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
||||
if(!$page_info->module_srl || $page_info->module != 'page') return $this->setError('msg_invalid_request');
|
||||
if(!$page_info->module_srl || $page_info->module != 'page') throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
// Check permissions
|
||||
$logged_info = Context::get('logged_info');
|
||||
if (!$logged_info->member_srl)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
$module_grant = $oModuleModel->getGrant($page_info, $logged_info);
|
||||
if (!$module_grant->manager)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$output = $oDocumentController->deleteDocument($oDocument->get('document_srl'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue