From d8a0773b978b01aaabdf4fc0cb7f9439f06bab09 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 6 Sep 2018 00:19:47 +0900 Subject: [PATCH] Replace $this->stop() with proper exceptions --- modules/admin/admin.admin.controller.php | 6 +-- modules/admin/admin.admin.view.php | 6 +-- .../adminlogging/adminlogging.controller.php | 2 +- .../autoinstall/autoinstall.admin.view.php | 8 +-- modules/board/board.admin.view.php | 5 +- modules/board/board.view.php | 13 +++-- modules/comment/comment.admin.controller.php | 8 +-- .../document/document.admin.controller.php | 9 ++-- modules/document/document.view.php | 5 +- modules/editor/editor.admin.view.php | 6 +-- modules/editor/editor.view.php | 6 +-- modules/file/file.admin.controller.php | 4 +- modules/file/file.controller.php | 53 ++++++++++++++----- modules/install/install.controller.php | 2 +- modules/install/install.view.php | 2 +- modules/krzip/krzip.model.php | 2 +- modules/layout/layout.admin.controller.php | 10 ++-- modules/layout/layout.admin.model.php | 2 +- modules/layout/layout.admin.view.php | 8 +-- modules/menu/menu.admin.controller.php | 4 +- modules/module/module.model.php | 3 +- modules/module/module.view.php | 4 +- modules/page/page.admin.view.php | 2 +- modules/poll/poll.admin.controller.php | 2 +- modules/poll/poll.admin.view.php | 4 +- modules/widget/widget.admin.view.php | 2 +- 26 files changed, 109 insertions(+), 69 deletions(-) diff --git a/modules/admin/admin.admin.controller.php b/modules/admin/admin.admin.controller.php index df0830f20..275ec2730 100644 --- a/modules/admin/admin.admin.controller.php +++ b/modules/admin/admin.admin.controller.php @@ -18,11 +18,9 @@ class adminAdminController extends admin function init() { // forbit access if the user is not an administrator - $oMemberModel = getModel('member'); - $logged_info = $oMemberModel->getLoggedInfo(); - if($logged_info->is_admin != 'Y') + if (!$this->user->isAdmin()) { - return $this->stop("admin.msg_is_not_administrator"); + throw new Rhymix\Framework\Exceptions\NotPermitted('admin.msg_is_not_administrator'); } } diff --git a/modules/admin/admin.admin.view.php b/modules/admin/admin.admin.view.php index b68d61f4d..5650b4f05 100644 --- a/modules/admin/admin.admin.view.php +++ b/modules/admin/admin.admin.view.php @@ -36,11 +36,9 @@ class adminAdminView extends admin function init() { // forbit access if the user is not an administrator - $oMemberModel = getModel('member'); - $logged_info = $oMemberModel->getLoggedInfo(); - if($logged_info->is_admin != 'Y') + if (!$this->user->isAdmin()) { - return $this->stop("admin.msg_is_not_administrator"); + throw new Rhymix\Framework\Exceptions\NotPermitted('admin.msg_is_not_administrator'); } // change into administration layout diff --git a/modules/adminlogging/adminlogging.controller.php b/modules/adminlogging/adminlogging.controller.php index 2b6b330fb..98269664f 100644 --- a/modules/adminlogging/adminlogging.controller.php +++ b/modules/adminlogging/adminlogging.controller.php @@ -23,7 +23,7 @@ class adminloggingController extends adminlogging $logged_info = $oMemberModel->getLoggedInfo(); if($logged_info->is_admin != 'Y') { - return $this->stop("admin.msg_is_not_administrator"); + throw new Rhymix\Framework\Exceptions\NotPermitted('admin.msg_is_not_administrator'); } } diff --git a/modules/autoinstall/autoinstall.admin.view.php b/modules/autoinstall/autoinstall.admin.view.php index 77f660fee..0f9cb7ec4 100644 --- a/modules/autoinstall/autoinstall.admin.view.php +++ b/modules/autoinstall/autoinstall.admin.view.php @@ -414,7 +414,7 @@ class autoinstallAdminView extends autoinstall if(!$updateDate) { - return $this->stop('msg_connection_fail'); + throw new Rhymix\Framework\Exception('msg_connection_fail'); } $oModel = getModel('autoinstall'); @@ -535,13 +535,13 @@ class autoinstallAdminView extends autoinstall if(!$type || $type == "core") { - return $this->stop("msg_invalid_request"); + throw new Rhymix\Framework\Exceptions\InvalidRequest; } $config_file = $oModel->getConfigFilePath($type); if(!$config_file) { - return $this->stop("msg_invalid_request"); + throw new Rhymix\Framework\Exceptions\InvalidRequest; } $output = $oAdminModel->checkUseDirectModuleInstall($installedPackage); @@ -579,7 +579,7 @@ class autoinstallAdminView extends autoinstall } else { - return $this->stop('msg_connection_fail'); + throw new Rhymix\Framework\Exception('msg_connection_fail'); } } diff --git a/modules/board/board.admin.view.php b/modules/board/board.admin.view.php index 2a0c7f130..75cf3ce11 100644 --- a/modules/board/board.admin.view.php +++ b/modules/board/board.admin.view.php @@ -39,7 +39,10 @@ class boardAdminView extends board { } } - if($module_info && $module_info->module != 'board') return $this->stop("msg_invalid_request"); + if($module_info && $module_info->module != 'board') + { + throw new Rhymix\Framework\Exceptions\InvalidRequest; + } // get the module category list $module_category = $oModuleModel->getModuleCategories(); diff --git a/modules/board/board.view.php b/modules/board/board.view.php index 838c5dd8f..76a4e7899 100644 --- a/modules/board/board.view.php +++ b/modules/board/board.view.php @@ -262,7 +262,7 @@ class boardView extends board // if the module srl is not consistent if($oDocument->get('module_srl')!=$this->module_info->module_srl ) { - return $this->stop('msg_invalid_request'); + throw new Rhymix\Framework\Exceptions\InvalidRequest; } // check the manage grant @@ -383,7 +383,11 @@ class boardView extends board if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) { - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); + if(!Context::get('is_logged')) + { + throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download'); + } + $logged_info = Context::get('logged_info'); if($logged_info->is_admin != 'Y') { @@ -406,7 +410,10 @@ class boardView extends board break; } } - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); + if(!$is_permitted) + { + throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download'); + } } } } diff --git a/modules/comment/comment.admin.controller.php b/modules/comment/comment.admin.controller.php index 4f572b88d..183746461 100644 --- a/modules/comment/comment.admin.controller.php +++ b/modules/comment/comment.admin.controller.php @@ -56,7 +56,7 @@ class commentAdminController extends comment $cart = Context::get('cart'); if(!$cart) { - return $this->stop('msg_cart_is_null'); + throw new Rhymix\Framework\Exception('msg_cart_is_null'); } if(!is_array($cart)) { @@ -171,7 +171,7 @@ class commentAdminController extends comment $cart = Context::get('cart'); if(!$cart) { - return $this->stop('msg_cart_is_null'); + throw new Rhymix\Framework\Exception('msg_cart_is_null'); } if(!is_array($cart)) { @@ -184,7 +184,7 @@ class commentAdminController extends comment $comment_count = count($comment_srl_list); if(!$comment_count) { - return $this->stop('msg_cart_is_null'); + throw new Rhymix\Framework\Exception('msg_cart_is_null'); } $oCommentController = getController('comment'); @@ -329,7 +329,7 @@ class commentAdminController extends comment $oCommentController = getController('comment'); $oComment = $oCommentModel->getComment($comment_srl, false); - if(!$oComment->isGranted()) return $this->stop('msg_not_permitted'); + if(!$oComment->isGranted()) throw new Rhymix\Framework\Exceptions\NotPermitted; $message_content = ""; $this->_moveCommentToTrash(array($comment_srl), $oCommentController, $oDB, $message_content); diff --git a/modules/document/document.admin.controller.php b/modules/document/document.admin.controller.php index 811758cc2..7c72b26d6 100644 --- a/modules/document/document.admin.controller.php +++ b/modules/document/document.admin.controller.php @@ -27,10 +27,10 @@ class documentAdminController extends document { // error appears if no doc is selected $cart = Context::get('cart'); - if(!$cart) return $this->stop('msg_cart_is_null'); + if(!$cart) throw new Rhymix\Framework\Exception('msg_cart_is_null'); $document_srl_list= explode('|@|', $cart); $document_count = count($document_srl_list); - if(!$document_count) return $this->stop('msg_cart_is_null'); + if(!$document_count) throw new Rhymix\Framework\Exception('msg_cart_is_null'); // Delete a doc $oDocumentController = getController('document'); for($i=0;$i<$document_count;$i++) @@ -314,7 +314,10 @@ class documentAdminController extends document $oDocumentModel = getModel('document'); $oDocumentController = getController('document'); $oDocument = $oDocumentModel->getDocument($document_srl, false, false); - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); + if(!$oDocument->isGranted()) + { + throw new Rhymix\Framework\Exceptions\NotPermitted; + } $oMemberModel = getModel('member'); $member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl')); diff --git a/modules/document/document.view.php b/modules/document/document.view.php index a9cf17eb3..1a0d3dace 100644 --- a/modules/document/document.view.php +++ b/modules/document/document.view.php @@ -172,7 +172,10 @@ class documentView extends document $oMemberModel = getModel('member'); // A message appears if the user is not logged-in - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); + if(!$oMemberModel->isLogged()) + { + throw new Rhymix\Framework\Exceptions\MustLogin; + } // Get the saved document (module_srl is set to member_srl instead) $logged_info = Context::get('logged_info'); $args = new stdClass(); diff --git a/modules/editor/editor.admin.view.php b/modules/editor/editor.admin.view.php index 06b4eae66..a2aadde52 100644 --- a/modules/editor/editor.admin.view.php +++ b/modules/editor/editor.admin.view.php @@ -106,9 +106,9 @@ class editorAdminView extends editor $oEditorModel = getModel('editor'); $component = $oEditorModel->getComponent($component_name,$site_srl); - if(!$component->component_name) { - $this->stop('msg_invalid_request'); - return; + if(!$component->component_name) + { + throw new Rhymix\Framework\Exceptions\InvalidRequest; } Context::set('component', $component); diff --git a/modules/editor/editor.view.php b/modules/editor/editor.view.php index e1fbbb345..a13b84b6e 100644 --- a/modules/editor/editor.view.php +++ b/modules/editor/editor.view.php @@ -97,9 +97,9 @@ class editorView extends editor $oEditorModel = getModel('editor'); $component = $oEditorModel->getComponent($component_name, $site_srl); - if(!$component->component_name) { - $this->stop('msg_invalid_request'); - return; + if(!$component->component_name) + { + throw new Rhymix\Framework\Exceptions\InvalidRequest; } Context::set('component', $component); diff --git a/modules/file/file.admin.controller.php b/modules/file/file.admin.controller.php index bcc3fc3d5..46ba168a4 100644 --- a/modules/file/file.admin.controller.php +++ b/modules/file/file.admin.controller.php @@ -32,11 +32,11 @@ class fileAdminController extends file { // An error appears if no document is selected $cart = Context::get('cart'); - if(!$cart) return $this->stop('msg_file_cart_is_null'); + if(!$cart) throw new Rhymix\Framework\Exception('msg_file_cart_is_null'); if(!is_array($cart)) $file_srl_list= explode('|@|', $cart); else $file_srl_list = $cart; $file_count = count($file_srl_list); - if(!$file_count) return $this->stop('msg_file_cart_is_null'); + if(!$file_count) throw new Rhymix\Framework\Exception('msg_file_cart_is_null'); $oFileController = getController('file'); // Delete the post diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index b9837068e..0c165c264 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -145,7 +145,10 @@ class fileController extends file $this->add('upload_target_srl', $output->get('upload_target_srl')); $this->add('download_url', $oFileModel->getDirectFileUrl($output->get('uploaded_filename'))); - if($output->error != '0') $this->stop($output->message); + if($output->error != '0') + { + throw new Rhymix\Framework\Exception($output->message); + } } /** @@ -283,9 +286,15 @@ class fileController extends file $columnList = array('file_srl', 'sid', 'isvalid', 'source_filename', 'module_srl', 'uploaded_filename', 'file_size', 'member_srl', 'upload_target_srl', 'upload_target_type'); $file_obj = $oFileModel->getFile($file_srl, $columnList); // If the requested file information is incorrect, an error that file cannot be found appears - if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found'); + if($file_obj->file_srl != $file_srl || $file_obj->sid !== $sid) + { + throw new Rhymix\Framework\Exceptions\TargetNotFound('msg_file_not_found'); + } // Notify that file download is not allowed when standing-by(Only a top-administrator is permitted) - if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download'); + if($logged_info->is_admin != 'Y' && $file_obj->isvalid != 'Y') + { + throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download'); + } // File name $filename = $file_obj->source_filename; $file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl); @@ -334,7 +343,10 @@ class fileController extends file } else $file_module_config->allow_outlink = 'Y'; } - if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); + if($file_module_config->allow_outlink != 'Y') + { + throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_allowed_outlink'); + } } // Check if a permission for file download is granted @@ -347,7 +359,11 @@ class fileController extends file if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) { - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); + if(!Context::get('is_logged')) + { + throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download'); + } + $logged_info = Context::get('logged_info'); if($logged_info->is_admin != 'Y') { @@ -370,14 +386,27 @@ class fileController extends file break; } } - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); + if(!$is_permitted) + { + throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download'); + } } } } // Call a trigger (before) $output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj); - if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download'); + if(!$output->toBool()) + { + if ($output->message) + { + throw new Rhymix\Framework\Exception($output->message); + } + else + { + throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download'); + } + } // Increase download_count $args = new stdClass(); @@ -416,20 +445,20 @@ class fileController extends file // Check file key if(strlen($file_key) != 32 || !isset($_SESSION['__XE_FILE_KEY__']) || !is_string($_SESSION['__XE_FILE_KEY__'])) { - return $this->stop('msg_invalid_request'); + throw new Rhymix\Framework\Exceptions\InvalidRequest; } $file_key_data = $file_srl . $file_obj->file_size . $file_obj->uploaded_filename . $_SERVER['REMOTE_ADDR']; $file_key_compare = substr(hash_hmac('sha256', $file_key_data, $_SESSION['__XE_FILE_KEY__']), 0, 32); if($file_key !== $file_key_compare) { - return $this->stop('msg_invalid_request'); + throw new Rhymix\Framework\Exceptions\InvalidRequest; } // Check if file exists $uploaded_filename = $file_obj->uploaded_filename; if(!file_exists($uploaded_filename)) { - return $this->stop('msg_file_not_found'); + throw new Rhymix\Framework\Exceptions\TargetNotFound('msg_file_not_found'); } // If client sent an If-None-Match header with the correct ETag, do not download again @@ -456,7 +485,7 @@ class fileController extends file $fp = fopen($uploaded_filename, 'rb'); if(!$fp) { - return $this->stop('msg_file_not_found'); + throw new Rhymix\Framework\Exceptions\TargetNotFound('msg_file_not_found'); } // Take care of pause and resume @@ -842,7 +871,7 @@ class fileController extends file if(!in_array($uploaded_ext, $ext)) { - return $this->stop('msg_not_allowed_filetype'); + throw new Rhymix\Framework\Exception('msg_not_allowed_filetype'); } } diff --git a/modules/install/install.controller.php b/modules/install/install.controller.php index 087699d17..c4a2b8980 100644 --- a/modules/install/install.controller.php +++ b/modules/install/install.controller.php @@ -17,7 +17,7 @@ class installController extends install // Stop if already installed. if (Context::isInstalled()) { - $this->stop('msg_already_installed'); + throw new Rhymix\Framework\Exception('msg_already_installed'); } // Increase time limit. diff --git a/modules/install/install.view.php b/modules/install/install.view.php index a2696ae3a..f539ddcbb 100644 --- a/modules/install/install.view.php +++ b/modules/install/install.view.php @@ -19,7 +19,7 @@ class installView extends install // Stop if already installed. if (Context::isInstalled()) { - return $this->stop('msg_already_installed'); + throw new Rhymix\Framework\Exception('msg_already_installed'); } // Set the browser title. diff --git a/modules/krzip/krzip.model.php b/modules/krzip/krzip.model.php index 3edbd4cc1..9980f2bc3 100644 --- a/modules/krzip/krzip.model.php +++ b/modules/krzip/krzip.model.php @@ -104,7 +104,7 @@ class krzipModel extends krzip $query = trim(strval($query)); if($query === '') { - return $this->stop('msg_krzip_no_query'); + return $this->setError('msg_krzip_no_query'); } $output = $this->getEpostapiSearch($query); diff --git a/modules/layout/layout.admin.controller.php b/modules/layout/layout.admin.controller.php index 575bd660c..3e170a4ba 100644 --- a/modules/layout/layout.admin.controller.php +++ b/modules/layout/layout.admin.controller.php @@ -23,7 +23,7 @@ class layoutAdminController extends layout */ function procLayoutAdminInsert() { - if(Context::get('layout') == 'faceoff') return $this->stop('not supported'); + if(Context::get('layout') == 'faceoff') throw new Rhymix\Framework\Exception('not supported'); // Get information to create a layout $site_module_info = Context::get('site_module_info'); @@ -683,7 +683,7 @@ class layoutAdminController extends layout */ function procLayoutAdminUserLayoutImport() { - return $this->stop('not supported'); + throw new Rhymix\Framework\Exception('not supported'); // check upload if(!Context::isUploaded()) exit(); @@ -713,12 +713,12 @@ class layoutAdminController extends layout $sourceArgs = Context::getRequestVars(); if($sourceArgs->layout == 'faceoff') { - return $this->stop('not supported'); + throw new Rhymix\Framework\Exception('not supported'); } if(!$sourceArgs->layout_srl) { - return $this->stop('msg_empty_origin_layout'); + throw new Rhymix\Framework\Exception('msg_empty_origin_layout'); } $oLayoutModel = getModel('layout'); @@ -731,7 +731,7 @@ class layoutAdminController extends layout if(!is_array($sourceArgs->title) || count($sourceArgs->title) == 0) { - return $this->stop('msg_empty_target_layout'); + throw new Rhymix\Framework\Exception('msg_empty_target_layout'); } $output = $oLayoutModel->getLayoutRawData($sourceArgs->layout_srl, array('extra_vars')); diff --git a/modules/layout/layout.admin.model.php b/modules/layout/layout.admin.model.php index 7d6de7f67..004879a12 100644 --- a/modules/layout/layout.admin.model.php +++ b/modules/layout/layout.admin.model.php @@ -67,7 +67,7 @@ class layoutAdminModel extends layout // Error appears if there is no layout information is registered if(!$layout_info) { - return $this->stop('msg_invalid_request'); + throw new Rhymix\Framework\Exceptions\InvalidRequest; } // Get a menu list diff --git a/modules/layout/layout.admin.view.php b/modules/layout/layout.admin.view.php index aa178845f..9dc793a9b 100644 --- a/modules/layout/layout.admin.view.php +++ b/modules/layout/layout.admin.view.php @@ -140,11 +140,11 @@ class layoutAdminView extends layout $layout = Context::get('layout'); if(!in_array($type, array('P', 'M'))) $type = 'P'; - if(!$layout) return $this->stop('msg_invalid_request'); + if(!$layout) throw new Rhymix\Framework\Exceptions\InvalidRequest; $oLayoutModel = getModel('layout'); $layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type); - if(!$layout_info) return $this->stop('msg_invalid_request'); + if(!$layout_info) throw new Rhymix\Framework\Exceptions\InvalidRequest; Context::set('layout_info', $layout_info); @@ -175,10 +175,10 @@ class layoutAdminView extends layout // Get layout info $layout = Context::get('layout'); - if($layout == 'faceoff') return $this->stop('not supported'); + if($layout == 'faceoff') throw new Rhymix\Framework\Exception('not supported'); $layout_info = $oModel->getLayoutInfo($layout, null, $type); - if(!$layout_info) return $this->stop('msg_invalid_request'); + if(!$layout_info) throw new Rhymix\Framework\Exceptions\InvalidRequest; // get Menu list $oMenuAdminModel = getAdminModel('menu'); diff --git a/modules/menu/menu.admin.controller.php b/modules/menu/menu.admin.controller.php index 4a90f9cd5..d7ef3a697 100644 --- a/modules/menu/menu.admin.controller.php +++ b/modules/menu/menu.admin.controller.php @@ -867,7 +867,7 @@ class menuAdminController extends menu $oAdmin = getClass('admin'); if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0) { - return $this->stop('msg_cannot_delete_for_admin_topmenu'); + return new BaseObject(-1002, 'msg_cannot_delete_for_admin_topmenu'); } if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl; @@ -892,7 +892,7 @@ class menuAdminController extends menu $this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude); if($isStartmenuInclude) { - throw new Rhymix\Framework\Exception('msg_cannot_delete_homemenu'); + return new BaseObject(-1003, 'msg_cannot_delete_homemenu'); } $oDB = DB::getInstance(); diff --git a/modules/module/module.model.php b/modules/module/module.model.php index 38dd1ff90..cfd6ecb7a 100644 --- a/modules/module/module.model.php +++ b/modules/module/module.model.php @@ -267,8 +267,7 @@ class moduleModel extends module if(!$menuItemSrl) { - $this->stop(-1, 'msg_invalid_request'); - return; + throw new Rhymix\Framework\Exceptions\InvalidRequest; } $args = new stdClass(); diff --git a/modules/module/module.view.php b/modules/module/module.view.php index 7446464e7..3247a6b8e 100644 --- a/modules/module/module.view.php +++ b/modules/module/module.view.php @@ -25,10 +25,10 @@ class moduleView extends module $skin = Context::get('skin'); // Get modules/skin information $module_path = sprintf("./modules/%s/", $selected_module); - if(!is_dir($module_path)) $this->stop("msg_invalid_request"); + if(!is_dir($module_path)) throw new Rhymix\Framework\Exceptions\InvalidRequest; $skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin); - if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request"); + if(!file_exists($skin_info_xml)) throw new Rhymix\Framework\Exceptions\InvalidRequest; $oModuleModel = getModel('module'); $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); diff --git a/modules/page/page.admin.view.php b/modules/page/page.admin.view.php index 850804de3..86ce7b89b 100644 --- a/modules/page/page.admin.view.php +++ b/modules/page/page.admin.view.php @@ -163,7 +163,7 @@ class pageAdminView extends page { if($this->module_info->page_type == 'OUTSIDE') { - return $this->stop(-1, 'msg_invalid_request'); + throw new Rhymix\Framework\Exceptions\InvalidRequest; } if($this->module_srl) diff --git a/modules/poll/poll.admin.controller.php b/modules/poll/poll.admin.controller.php index a3fd0028f..8be1eae7e 100644 --- a/modules/poll/poll.admin.controller.php +++ b/modules/poll/poll.admin.controller.php @@ -44,7 +44,7 @@ class pollAdminController extends poll else $poll_srl_list= explode('|@|', $cart); $poll_count = count($poll_srl_list); - if(!$poll_count) return $this->stop('msg_cart_is_null'); + if(!$poll_count) throw new Rhymix\Framework\Exception('msg_cart_is_null'); // Delete the post for($i=0;$i<$poll_count;$i++) { diff --git a/modules/poll/poll.admin.view.php b/modules/poll/poll.admin.view.php index 3d8a7650b..e65742301 100644 --- a/modules/poll/poll.admin.view.php +++ b/modules/poll/poll.admin.view.php @@ -139,7 +139,7 @@ class pollAdminView extends poll $args->poll_index_srl = Context::get('poll_index_srl'); $output = executeQuery('poll.getPoll', $args); - if(!$output->data) return $this->stop('msg_poll_not_exists'); + if(!$output->data) throw new Rhymix\Framework\Exception('msg_poll_not_exists'); $poll = new stdClass(); $poll->stop_date = $output->data->stop_date; @@ -148,7 +148,7 @@ class pollAdminView extends poll $output = executeQuery('poll.getPollTitle', $args); if(!$output->data) { - return $this->stop('msg_poll_not_exists'); + throw new Rhymix\Framework\Exception('msg_poll_not_exists'); } $tmp = &$poll->poll[$args->poll_index_srl]; diff --git a/modules/widget/widget.admin.view.php b/modules/widget/widget.admin.view.php index 712e56610..702b44091 100644 --- a/modules/widget/widget.admin.view.php +++ b/modules/widget/widget.admin.view.php @@ -59,7 +59,7 @@ class widgetAdminView extends widget function dispWidgetAdminAddContent() { $module_srl = Context::get('module_srl'); - if(!$module_srl) return $this->stop("msg_invalid_request"); + if(!$module_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest; $document_srl = Context::get('document_srl'); $oDocumentModel = getModel('document');