Update some modules to throw exceptions instead of BaseObject

This commit is contained in:
Kijin Sung 2018-08-27 00:03:12 +09:00
parent f6fa7493f6
commit 1863edcbb8
12 changed files with 118 additions and 118 deletions

View file

@ -477,7 +477,7 @@ class adminAdminController extends admin
}
else
{
return $this->setError('fail_to_delete');
throw new Rhymix\Framework\Exception('fail_to_delete');
}
$this->setMessage('success_deleted');
}
@ -501,7 +501,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set('use_sso', $vars->use_sso === 'Y');
if (!Rhymix\Framework\Config::save())
{
return $this->setError('msg_failed_to_save_config');
throw new Rhymix\Framework\Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
@ -521,19 +521,19 @@ class adminAdminController extends admin
// Validate the mail sender's information.
if (!$vars->mail_default_name)
{
return $this->setError('msg_advanced_mailer_sender_name_is_empty');
throw new Rhymix\Framework\Exception('msg_advanced_mailer_sender_name_is_empty');
}
if (!$vars->mail_default_from)
{
return $this->setError('msg_advanced_mailer_sender_email_is_empty');
throw new Rhymix\Framework\Exception('msg_advanced_mailer_sender_email_is_empty');
}
if (!Mail::isVaildMailAddress($vars->mail_default_from))
{
return $this->setError('msg_advanced_mailer_sender_email_is_invalid');
throw new Rhymix\Framework\Exception('msg_advanced_mailer_sender_email_is_invalid');
}
if ($vars->mail_default_reply_to && !Mail::isVaildMailAddress($vars->mail_default_reply_to))
{
return $this->setError('msg_advanced_mailer_reply_to_is_invalid');
throw new Rhymix\Framework\Exception('msg_advanced_mailer_reply_to_is_invalid');
}
// Validate the mail driver.
@ -541,7 +541,7 @@ class adminAdminController extends admin
$mail_driver = $vars->mail_driver;
if (!array_key_exists($mail_driver, $mail_drivers))
{
return $this->setError('msg_advanced_mailer_sending_method_is_invalid');
throw new Rhymix\Framework\Exception('msg_advanced_mailer_sending_method_is_invalid');
}
// Validate the mail driver settings.
@ -551,7 +551,7 @@ class adminAdminController extends admin
$conf_value = $vars->{'mail_' . $mail_driver . '_' . $conf_name} ?: null;
if (!$conf_value)
{
return $this->setError('msg_advanced_mailer_smtp_host_is_invalid');
throw new Rhymix\Framework\Exception('msg_advanced_mailer_smtp_host_is_invalid');
}
$mail_driver_config[$conf_name] = $conf_value;
}
@ -561,7 +561,7 @@ class adminAdminController extends admin
$sms_driver = $vars->sms_driver;
if (!array_key_exists($sms_driver, $sms_drivers))
{
return $this->setError('msg_advanced_mailer_sending_method_is_invalid');
throw new Rhymix\Framework\Exception('msg_advanced_mailer_sending_method_is_invalid');
}
// Validate the SMS driver settings.
@ -571,7 +571,7 @@ class adminAdminController extends admin
$conf_value = $vars->{'sms_' . $sms_driver . '_' . $conf_name} ?: null;
if (!$conf_value)
{
return $this->setError('msg_advanced_mailer_smtp_host_is_invalid');
throw new Rhymix\Framework\Exception('msg_advanced_mailer_smtp_host_is_invalid');
}
$sms_driver_config[$conf_name] = $conf_value;
}
@ -610,7 +610,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set("sms.allow_split.lms", toBool($vars->allow_split_lms));
if (!Rhymix\Framework\Config::save())
{
return $this->setError('msg_failed_to_save_config');
throw new Rhymix\Framework\Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
@ -665,7 +665,7 @@ class adminAdminController extends admin
return $item !== '';
}));
if (!Rhymix\Framework\Filters\IpFilter::validateRanges($allowed_ip)) {
return $this->setError('msg_invalid_ip');
throw new Rhymix\Framework\Exception('msg_invalid_ip');
}
$denied_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_denied_ip));
@ -673,13 +673,13 @@ class adminAdminController extends admin
return $item !== '';
}));
if (!Rhymix\Framework\Filters\IpFilter::validateRanges($denied_ip)) {
return $this->setError('msg_invalid_ip');
throw new Rhymix\Framework\Exception('msg_invalid_ip');
}
$oMemberAdminModel = getAdminModel('member');
if (!$oMemberAdminModel->getMemberAdminIPCheck($allowed_ip, $denied_ip))
{
return $this->setError('msg_current_ip_will_be_denied');
throw new Rhymix\Framework\Exception('msg_current_ip_will_be_denied');
}
Rhymix\Framework\Config::set('admin.allow', array_values($allowed_ip));
@ -691,7 +691,7 @@ class adminAdminController extends admin
// Save
if (!Rhymix\Framework\Config::save())
{
return $this->setError('msg_failed_to_save_config');
throw new Rhymix\Framework\Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
@ -734,7 +734,7 @@ class adminAdminController extends admin
}
if (!Rhymix\Framework\Cache::getDriverInstance($vars->object_cache_type, $cache_servers))
{
return $this->setError('msg_cache_handler_not_supported');
throw new Rhymix\Framework\Exception('msg_cache_handler_not_supported');
}
Rhymix\Framework\Config::set('cache', array(
'type' => $vars->object_cache_type,
@ -794,7 +794,7 @@ class adminAdminController extends admin
// Save
if (!Rhymix\Framework\Config::save())
{
return $this->setError('msg_failed_to_save_config');
throw new Rhymix\Framework\Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
@ -832,15 +832,15 @@ class adminAdminController extends admin
), $log_filename);
if (file_exists(RX_BASEDIR . $log_filename_today) && !is_writable(RX_BASEDIR . $log_filename_today))
{
return $this->setError('msg_debug_log_filename_not_writable');
throw new Rhymix\Framework\Exception('msg_debug_log_filename_not_writable');
}
if (!file_exists(dirname(RX_BASEDIR . $log_filename)) && !FileHandler::makeDir(dirname(RX_BASEDIR . $log_filename)))
{
return $this->setError('msg_debug_log_filename_not_writable');
throw new Rhymix\Framework\Exception('msg_debug_log_filename_not_writable');
}
if (!is_writable(dirname(RX_BASEDIR . $log_filename)))
{
return $this->setError('msg_debug_log_filename_not_writable');
throw new Rhymix\Framework\Exception('msg_debug_log_filename_not_writable');
}
Rhymix\Framework\Config::set('debug.log_filename', $log_filename);
@ -850,14 +850,14 @@ class adminAdminController extends admin
return $item !== '';
}));
if (!Rhymix\Framework\Filters\IpFilter::validateRanges($allowed_ip)) {
return $this->setError('msg_invalid_ip');
throw new Rhymix\Framework\Exception('msg_invalid_ip');
}
Rhymix\Framework\Config::set('debug.allow', array_values($allowed_ip));
// Save
if (!Rhymix\Framework\Config::save())
{
return $this->setError('msg_failed_to_save_config');
throw new Rhymix\Framework\Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
@ -890,7 +890,7 @@ class adminAdminController extends admin
// Save
if (!Rhymix\Framework\Config::save())
{
return $this->setError('msg_failed_to_save_config');
throw new Rhymix\Framework\Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
@ -911,7 +911,7 @@ class adminAdminController extends admin
if (!Rhymix\Framework\Filters\IpFilter::validateRanges($allowed_ip))
{
return $this->setError('msg_invalid_ip');
throw new Rhymix\Framework\Exception('msg_invalid_ip');
}
Rhymix\Framework\Config::set('lock.locked', $vars->sitelock_locked === 'Y');
@ -920,7 +920,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set('lock.allow', array_values($allowed_ip));
if (!Rhymix\Framework\Config::save())
{
return $this->setError('msg_failed_to_save_config');
throw new Rhymix\Framework\Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
@ -941,7 +941,7 @@ class adminAdminController extends admin
$domain_info = getModel('module')->getSiteInfo($domain_srl);
if ($domain_info->domain_srl != $domain_srl)
{
return $this->setError('msg_domain_not_found');
throw new Rhymix\Framework\Exception('msg_domain_not_found');
}
}
@ -950,7 +950,7 @@ class adminAdminController extends admin
$vars->subtitle = utf8_trim($vars->subtitle);
if ($vars->title === '')
{
return $this->setError('msg_site_title_is_empty');
throw new Rhymix\Framework\Exception('msg_site_title_is_empty');
}
// Validate the domain.
@ -968,12 +968,12 @@ class adminAdminController extends admin
}
if (!$vars->domain)
{
return $this->setError('msg_invalid_domain');
throw new Rhymix\Framework\Exception('msg_invalid_domain');
}
$existing_domain = getModel('module')->getSiteInfoByDomain($vars->domain);
if ($existing_domain && $existing_domain->domain == $vars->domain && (!$domain_info || $existing_domain->domain_srl != $domain_info->domain_srl))
{
return $this->setError('msg_domain_already_exists');
throw new Rhymix\Framework\Exception('msg_domain_already_exists');
}
// Validate the ports.
@ -987,11 +987,11 @@ class adminAdminController extends admin
}
if ($vars->http_port !== 0 && ($vars->http_port < 1 || $vars->http_port > 65535 || $vars->http_port == 443))
{
return $this->setError('msg_invalid_http_port');
throw new Rhymix\Framework\Exception('msg_invalid_http_port');
}
if ($vars->https_port !== 0 && ($vars->https_port < 1 || $vars->https_port > 65535 || $vars->https_port == 80))
{
return $this->setError('msg_invalid_https_port');
throw new Rhymix\Framework\Exception('msg_invalid_https_port');
}
// Validate the security setting.
@ -1005,7 +1005,7 @@ class adminAdminController extends admin
$module_info = getModel('module')->getModuleInfoByModuleSrl(intval($vars->index_module_srl));
if (!$module_info || $module_info->module_srl != $vars->index_module_srl)
{
return $this->setError('msg_invalid_index_module_srl');
throw new Rhymix\Framework\Exception('msg_invalid_index_module_srl');
}
// Validate the index document setting.
@ -1014,11 +1014,11 @@ class adminAdminController extends admin
$oDocument = getModel('document')->getDocument($vars->index_document_srl);
if (!$oDocument || !$oDocument->isExists())
{
return $this->setError('msg_invalid_index_document_srl');
throw new Rhymix\Framework\Exception('msg_invalid_index_document_srl');
}
if (intval($oDocument->get('module_srl')) !== intval($vars->index_module_srl))
{
return $this->setError('msg_invalid_index_document_srl_module_srl');
throw new Rhymix\Framework\Exception('msg_invalid_index_document_srl_module_srl');
}
}
else
@ -1030,14 +1030,14 @@ class adminAdminController extends admin
$enabled_lang = Rhymix\Framework\Config::get('locale.enabled_lang');
if (!in_array($vars->default_lang, $enabled_lang))
{
return $this->setError('msg_lang_is_not_enabled');
throw new Rhymix\Framework\Exception('msg_lang_is_not_enabled');
}
// Validate the default time zone.
$timezone_list = Rhymix\Framework\DateTime::getTimezoneList();
if (!isset($timezone_list[$vars->default_timezone]))
{
return $this->setError('msg_invalid_timezone');
throw new Rhymix\Framework\Exception('msg_invalid_timezone');
}
// Clean up the header and footer scripts.
@ -1160,16 +1160,16 @@ class adminAdminController extends admin
$domain_srl = strval(Context::get('domain_srl'));
if ($domain_srl === '')
{
return $this->setError('msg_domain_not_found');
throw new Rhymix\Framework\Exception('msg_domain_not_found');
}
$domain_info = getModel('module')->getSiteInfo($domain_srl);
if ($domain_info->domain_srl != $domain_srl)
{
return $this->setError('msg_domain_not_found');
throw new Rhymix\Framework\Exception('msg_domain_not_found');
}
if ($domain_info->is_default_domain === 'Y')
{
return $this->setError('msg_cannot_delete_default_domain');
throw new Rhymix\Framework\Exception('msg_cannot_delete_default_domain');
}
// Delete the domain.
@ -1202,19 +1202,19 @@ class adminAdminController extends admin
{
if (!($conn = @ftp_connect($vars->ftp_host, $vars->ftp_port, 3)))
{
return $this->setError('msg_ftp_not_connected');
throw new Rhymix\Framework\Exception('msg_ftp_not_connected');
}
if (!@ftp_login($conn, $vars->ftp_user, $vars->ftp_pass))
{
return $this->setError('msg_ftp_invalid_auth_info');
throw new Rhymix\Framework\Exception('msg_ftp_invalid_auth_info');
}
if (!@ftp_pasv($conn, $vars->ftp_pasv === 'Y'))
{
return $this->setError('msg_ftp_cannot_set_passive_mode');
throw new Rhymix\Framework\Exception('msg_ftp_cannot_set_passive_mode');
}
if (!@ftp_chdir($conn, $vars->ftp_path))
{
return $this->setError('msg_ftp_invalid_path');
throw new Rhymix\Framework\Exception('msg_ftp_invalid_path');
}
ftp_close($conn);
}
@ -1222,23 +1222,23 @@ class adminAdminController extends admin
{
if (!function_exists('ssh2_connect'))
{
return $this->setError('disable_sftp_support');
throw new Rhymix\Framework\Exception('disable_sftp_support');
}
if (!($conn = ssh2_connect($vars->ftp_host, $vars->ftp_port)))
{
return $this->setError('msg_ftp_not_connected');
throw new Rhymix\Framework\Exception('msg_ftp_not_connected');
}
if (!@ssh2_auth_password($conn, $vars->ftp_user, $vars->ftp_pass))
{
return $this->setError('msg_ftp_invalid_auth_info');
throw new Rhymix\Framework\Exception('msg_ftp_invalid_auth_info');
}
if (!@($sftp = ssh2_sftp($conn)))
{
return $this->setError('msg_ftp_sftp_error');
throw new Rhymix\Framework\Exception('msg_ftp_sftp_error');
}
if (!@ssh2_sftp_stat($sftp, $vars->ftp_path . 'common/defaults/config.php'))
{
return $this->setError('msg_ftp_invalid_path');
throw new Rhymix\Framework\Exception('msg_ftp_invalid_path');
}
unset($sftp, $conn);
}
@ -1253,7 +1253,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set('ftp.sftp', $vars->ftp_sftp === 'Y');
if (!Rhymix\Framework\Config::save())
{
return $this->setError('msg_failed_to_save_config');
throw new Rhymix\Framework\Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
@ -1274,7 +1274,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set('ftp.sftp', false);
if (!Rhymix\Framework\Config::save())
{
return $this->setError('msg_failed_to_save_config');
throw new Rhymix\Framework\Exception('msg_failed_to_save_config');
}
$this->setMessage('success_deleted');

View file

@ -629,7 +629,7 @@ class adminAdminView extends admin
$domain_info = getModel('module')->getSiteInfo($domain_srl);
if ($domain_info->domain_srl != $domain_srl)
{
return $this->setError('msg_domain_not_found');
throw new Rhymix\Framework\Exception('msg_domain_not_found');
}
}
Context::set('domain_info', $domain_info);

View file

@ -168,7 +168,7 @@ class boardAdminController extends board {
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if($module_info->mid != $mid)
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exception('msg_invalid_request');
}
$module_info->hide_category = Context::get('hide_category') == 'Y' ? 'Y' : 'N';

View file

@ -24,7 +24,7 @@ class boardController extends board
// check grant
if(!$this->grant->write_document)
{
return $this->setError('msg_not_permitted');
throw new Rhymix\Framework\Exception('msg_not_permitted');
}
// setup variables
@ -35,14 +35,14 @@ class boardController extends board
// Return error if content is empty.
if (is_empty_html_content($obj->content))
{
return $this->setError('msg_empty_content');
throw new Rhymix\Framework\Exception('msg_empty_content');
}
// Return error if content is too large.
$document_length_limit = ($this->module_info->document_length_limit ?: 1024) * 1024;
if (strlen($obj->content) > $document_length_limit && !$this->grant->manager)
{
return $this->setError('msg_content_too_long');
throw new Rhymix\Framework\Exception('msg_content_too_long');
}
// unset document style if not manager
@ -107,14 +107,14 @@ class boardController extends board
{
if(!$oDocument->isGranted())
{
return $this->setError('msg_not_permitted');
throw new Rhymix\Framework\Exception('msg_not_permitted');
}
// Protect admin document
$member_info = getModel('member')->getMemberInfoByMemberSrl($oDocument->get('member_srl'));
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
return $this->setError('msg_admin_document_no_modify');
throw new Rhymix\Framework\Exception('msg_admin_document_no_modify');
}
// if document status is temp
@ -138,7 +138,7 @@ class boardController extends board
{
if($oDocument->get('comment_count') > 0 && !$this->grant->manager)
{
return $this->setError('msg_protect_update_content');
throw new Rhymix\Framework\Exception('msg_protect_update_content');
}
}
@ -147,7 +147,7 @@ class boardController extends board
{
if($oDocument->get('regdate') < date('YmdHis', strtotime('-' . $this->module_info->protect_document_regdate . ' day')))
{
return $this->setError(sprintf(lang('msg_protect_regdate_document'), $this->module_info->protect_document_regdate));
throw new Rhymix\Framework\Exception(sprintf(lang('msg_protect_regdate_document'), $this->module_info->protect_document_regdate));
}
}
@ -235,7 +235,7 @@ class boardController extends board
$logged_info = Context::get('logged_info');
if(!$update_id)
{
return $this->setError('msg_no_update_id');
throw new Rhymix\Framework\Exception('msg_no_update_id');
}
$oDocumentModel = getModel('document');
@ -247,13 +247,13 @@ class boardController extends board
$Exists_log = $oDocumentModel->getUpdateLogAdminisExists($update_log->document_srl);
if($Exists_log === true)
{
return $this->setError('msg_admin_update_log');
throw new Rhymix\Framework\Exception('msg_admin_update_log');
}
}
if(!$update_log)
{
return $this->setError('msg_no_update_log');
throw new Rhymix\Framework\Exception('msg_no_update_log');
}
$oDocument = $oDocumentModel->getDocument($update_log->document_srl);
@ -282,7 +282,7 @@ class boardController extends board
// if the document is not existed
if(!$document_srl)
{
return $this->setError('msg_invalid_document');
throw new Rhymix\Framework\Exception('msg_invalid_document');
}
$oDocumentModel = &getModel('document');
@ -292,7 +292,7 @@ class boardController extends board
{
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{
return $this->setError('msg_protect_delete_content');
throw new Rhymix\Framework\Exception('msg_protect_delete_content');
}
}
@ -302,7 +302,7 @@ class boardController extends board
{
$format = lang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($massage);
}
}
// generate document module controller object
@ -356,7 +356,7 @@ class boardController extends board
// check grant
if(!$this->grant->write_comment)
{
return $this->setError('msg_not_permitted');
throw new Rhymix\Framework\Exception('msg_not_permitted');
}
$logged_info = Context::get('logged_info');
@ -367,14 +367,14 @@ class boardController extends board
// Return error if content is empty.
if (is_empty_html_content($obj->content))
{
return $this->setError('msg_empty_content');
throw new Rhymix\Framework\Exception('msg_empty_content');
}
// Return error if content is too large.
$comment_length_limit = ($this->module_info->comment_length_limit ?: 128) * 1024;
if (strlen($obj->content) > $comment_length_limit && !$this->grant->manager)
{
return $this->setError('msg_content_too_long');
throw new Rhymix\Framework\Exception('msg_content_too_long');
}
if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC';
@ -398,7 +398,7 @@ class boardController extends board
$oDocument = $oDocumentModel->getDocument($obj->document_srl);
if(!$oDocument->isExists())
{
return $this->setError('msg_not_founded');
throw new Rhymix\Framework\Exception('msg_not_founded');
}
// For anonymous use, remove writer's information and notifying information
@ -436,7 +436,7 @@ class boardController extends board
$childs = $oCommentModel->getChildComments($obj->comment_srl);
if(count($childs) > 0)
{
return $this->setError('msg_board_update_protect_comment');
throw new Rhymix\Framework\Exception('msg_board_update_protect_comment');
}
}
}
@ -446,7 +446,7 @@ class boardController extends board
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
return $this->setError('msg_admin_comment_no_modify');
throw new Rhymix\Framework\Exception('msg_admin_comment_no_modify');
}
// INSERT if comment_srl does not exist.
@ -461,7 +461,7 @@ class boardController extends board
$parent_comment = $oCommentModel->getComment($obj->parent_srl);
if(!$parent_comment->comment_srl)
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exception('msg_invalid_request');
}
if($parent_comment->isSecret() && $this->module_info->secret === 'Y')
{
@ -490,13 +490,13 @@ class boardController extends board
{
$format = lang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($massage);
}
}
// check the grant
if(!$comment->isGranted())
{
return $this->setError('msg_not_permitted');
throw new Rhymix\Framework\Exception('msg_not_permitted');
}
$obj->parent_srl = $comment->parent_srl;
$output = $oCommentController->updateComment($obj, $this->grant->manager);
@ -530,7 +530,7 @@ class boardController extends board
if(!$comment_srl)
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exception('msg_invalid_request');
}
$oCommentModel = getModel('comment');
@ -540,7 +540,7 @@ class boardController extends board
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return $this->setError('msg_board_delete_protect_comment');
throw new Rhymix\Framework\Exception('msg_board_delete_protect_comment');
}
}
$comment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
@ -550,7 +550,7 @@ class boardController extends board
{
$format = lang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($massage);
}
}
// generate comment controller object
@ -662,13 +662,13 @@ class boardController extends board
$oComment = $oCommentModel->getComment($comment_srl);
if(!$oComment->isExists())
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exception('msg_invalid_request');
}
// compare the comment password and the user input password
if(!$oMemberModel->isValidPassword($oComment->get('password'),$password))
{
return $this->setError('msg_invalid_password');
throw new Rhymix\Framework\Exception('msg_invalid_password');
}
$oComment->setGrantForSession();
@ -678,13 +678,13 @@ class boardController extends board
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists())
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exception('msg_invalid_request');
}
// compare the document password and the user input password
if(!$oMemberModel->isValidPassword($oDocument->get('password'),$password))
{
return $this->setError('msg_invalid_password');
throw new Rhymix\Framework\Exception('msg_invalid_password');
}
$oDocument->setGrantForSession();

View file

@ -672,18 +672,18 @@ class boardView extends board
$document_srl = Context::get('document_srl');
if(!$document_srl)
{
return $this->setError("msg_invalid_request");
throw new Rhymix\Framework\Exception("msg_invalid_request");
}
if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read))
{
return $this->setError("msg_not_permitted");
throw new Rhymix\Framework\Exception("msg_not_permitted");
}
$oDocument = getModel('document')->getDocument($document_srl);
if(!$oDocument->isExists())
{
return $this->setError("msg_invalid_request");
throw new Rhymix\Framework\Exception("msg_invalid_request");
}
Context::set('oDocument', $oDocument);
@ -780,20 +780,20 @@ class boardView extends board
{
$format = lang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($massage);
}
}
if($this->module_info->protect_content == "Y" || $this->module_info->protect_update_content == 'Y')
{
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{
return $this->setError('msg_protect_update_content');
throw new Rhymix\Framework\Exception('msg_protect_update_content');
}
}
}
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
return $this->setError('msg_admin_document_no_modify');
throw new Rhymix\Framework\Exception('msg_admin_document_no_modify');
}
// if the document is not granted, then back to the password input form
@ -913,7 +913,7 @@ class boardView extends board
{
$format = lang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($massage);
}
}
@ -921,7 +921,7 @@ class boardView extends board
{
if($oDocument->get('comment_count')>0 && $this->grant->manager == false)
{
return $this->setError('msg_protect_delete_content');
throw new Rhymix\Framework\Exception('msg_protect_delete_content');
}
}
@ -998,7 +998,7 @@ class boardView extends board
// if the parent comment is not existed
if(!$parent_srl)
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exception('msg_invalid_request');
}
// get the comment
@ -1060,7 +1060,7 @@ class boardView extends board
// if the comment is not existed
if(!$comment_srl)
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exception('msg_invalid_request');
}
// get comment information
@ -1075,7 +1075,7 @@ class boardView extends board
{
$format = lang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($massage);
}
}
if($this->module_info->protect_update_comment === 'Y' && $this->grant->manager == false)
@ -1083,13 +1083,13 @@ class boardView extends board
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return $this->setError('msg_board_update_protect_comment');
throw new Rhymix\Framework\Exception('msg_board_update_protect_comment');
}
}
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
return $this->setError('msg_admin_comment_no_modify');
throw new Rhymix\Framework\Exception('msg_admin_comment_no_modify');
}
// if the comment is not exited, alert an error message
@ -1143,7 +1143,7 @@ class boardView extends board
{
$format = lang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($massage);
}
}
@ -1153,7 +1153,7 @@ class boardView extends board
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return $this->setError('msg_board_delete_protect_comment');
throw new Rhymix\Framework\Exception('msg_board_delete_protect_comment');
}
}
@ -1233,7 +1233,7 @@ class boardView extends board
if($this->grant->update_view !== true)
{
return $this->setError('msg_not_permitted');
throw new Rhymix\Framework\Exception('msg_not_permitted');
}
$updatelog = $oDocumentModel->getDocumentUpdateLog($document_srl);
@ -1253,7 +1253,7 @@ class boardView extends board
if($this->grant->update_view !== true)
{
return $this->setError('msg_not_permitted');
throw new Rhymix\Framework\Exception('msg_not_permitted');
}
$update_log = $oDocumentModel->getUpdateLog($update_id);
@ -1289,7 +1289,7 @@ class boardView extends board
{
iF($this->grant->vote_log_view !== true)
{
return $this->setError('msg_not_permitted');
throw new Rhymix\Framework\Exception('msg_not_permitted');
}
$oMemberModel = getModel('member');
@ -1310,7 +1310,7 @@ class boardView extends board
}
else
{
return $this->setError('msg_not_target');
throw new Rhymix\Framework\Exception('msg_not_target');
}
$output = executeQueryArray($queryId, $args);

View file

@ -124,7 +124,7 @@ class extract
// If local file
if(strncasecmp('http://', $this->filename, 7) !== 0)
{
if(!file_exists($this->filename)) return $this->setError('msg_no_xml_file');
if(!file_exists($this->filename)) return new BaseObject(-1, 'msg_no_xml_file');
$this->fd = fopen($this->filename,"r");
// If remote file
}
@ -135,7 +135,7 @@ class extract
if(!$url_info['path']) $url_info['path'] = '/';
$this->fd = @fsockopen($url_info['host'], $url_info['port']);
if(!$this->fd) return $this->setError('msg_no_xml_file');
if(!$this->fd) return new BaseObject(-1, 'msg_no_xml_file');
// If the file name contains Korean, do urlencode(iconv required)
$path = $url_info['path'];
if(preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path)&&function_exists('iconv'))
@ -157,7 +157,7 @@ class extract
$buff .= $str = fgets($this->fd, 1024);
if(!trim($str)) break;
}
if(preg_match('/404 Not Found/i',$buff)) return $this->setError('msg_no_xml_file');
if(preg_match('/404 Not Found/i',$buff)) return new BaseObject(-1, 'msg_no_xml_file');
}
if($this->startTag)

View file

@ -292,12 +292,12 @@ class importerAdminController extends importer
$this->unit_count = Context::get('unit_count');
// Check if an index file exists
$index_file = './files/cache/importer/'.$key.'/index';
if(!file_exists($index_file)) return $this->setError('msg_invalid_xml_file');
if(!file_exists($index_file)) throw new Rhymix\Framework\Exception('msg_invalid_xml_file');
switch($type)
{
case 'ttxml' :
if(!$target_module) return $this->setError('msg_invalid_request');
if(!$target_module) throw new Rhymix\Framework\Exception('msg_invalid_request');
$oModuleModel = getModel('module');
$columnList = array('module_srl', 'module');
@ -317,7 +317,7 @@ class importerAdminController extends importer
break;
case 'module' :
// Check if the target module exists
if(!$target_module) return $this->setError('msg_invalid_request');
if(!$target_module) throw new Rhymix\Framework\Exception('msg_invalid_request');
$cur = $this->importModule($key, $cur, $index_file, $target_module);
break;
}

View file

@ -20,7 +20,7 @@ class installAdminController extends install
function procInstallAdminInstall()
{
$module_name = Context::get('module_name');
if(!$module_name) return $this->setError('invalid_request');
if(!$module_name) throw new Rhymix\Framework\Exception('invalid_request');
$oInstallController = getController('install');
$oInstallController->installModule($module_name, './modules/'.$module_name);
@ -35,10 +35,10 @@ class installAdminController extends install
{
@set_time_limit(0);
$module_name = Context::get('module_name');
if(!$module_name) return $this->setError('invalid_request');
if(!$module_name) throw new Rhymix\Framework\Exception('invalid_request');
$oModule = getModule($module_name, 'class');
if(!$oModule) return $this->setError('invalid_request');
if(!$oModule) throw new Rhymix\Framework\Exception('invalid_request');
$output = $oModule->moduleUpdate();
if($output instanceof BaseObject && !$output->toBool())

View file

@ -76,7 +76,7 @@ class installController extends install
{
if ($oDB->isTableExists($table_name))
{
return $this->setError('msg_table_already_exists');
throw new Rhymix\Framework\Exception('msg_table_already_exists');
}
}
@ -99,7 +99,7 @@ class installController extends install
// Check if it is already installed
if (Context::isInstalled())
{
return $this->setError('msg_already_installed');
throw new Rhymix\Framework\Exception('msg_already_installed');
}
// Get install parameters.
@ -227,7 +227,7 @@ class installController extends install
catch(Exception $e)
{
$oDB->rollback();
return $this->setError($e->getMessage());
throw new Rhymix\Framework\Exception($e->getMessage());
}
// Execute the install script.
@ -411,7 +411,7 @@ class installController extends install
else
{
FileHandler::removeFile($this->flagLicenseAgreement);
return $this->setError('msg_must_accept_license_agreement');
throw new Rhymix\Framework\Exception('msg_must_accept_license_agreement');
}
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))

View file

@ -49,7 +49,7 @@ class integration_searchView extends integration_search
}
// Check permissions
if(!$this->grant->access) return $this->setError('msg_not_permitted');
if(!$this->grant->access) throw new Rhymix\Framework\Exception('msg_not_permitted');
$config = $oModuleModel->getModuleConfig('integration_search');
if(!$config) $config = new stdClass;

View file

@ -198,7 +198,7 @@ class pointAdminController extends point
function procPointAdminInsertPointModuleConfig()
{
$module_srl = Context::get('target_module_srl');
if(!$module_srl) return $this->setError('msg_invalid_request');
if(!$module_srl) throw new Rhymix\Framework\Exception('msg_invalid_request');
// In case of batch configuration of several modules
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);
@ -375,7 +375,7 @@ class pointAdminController extends point
$position = (int)Context::get('position');
$total = (int)Context::get('total');
if(!file_exists('./files/cache/pointRecal.txt')) return $this->setError('msg_invalid_request');
if(!file_exists('./files/cache/pointRecal.txt')) throw new Rhymix\Framework\Exception('msg_invalid_request');
$idx = 0;
$f = fopen("./files/cache/pointRecal.txt","r");
@ -418,7 +418,7 @@ class pointAdminController extends point
function procPointAdminReset()
{
$module_srl = Context::get('module_srls');
if(!$module_srl) return $this->setError('msg_invalid_request');
if(!$module_srl) throw new Rhymix\Framework\Exception('msg_invalid_request');
// In case of batch configuration of several modules
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);

View file

@ -151,7 +151,7 @@ class spamfilterAdminController extends spamfilter
if (mb_strlen($word, 'UTF-8') < 2 || mb_strlen($word, 'UTF-8') > 180)
{
return $this->setError('msg_invalid_word');
throw new Rhymix\Framework\Exception('msg_invalid_word');
}
$args = new stdClass;