mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 16:22:41 +09:00
Update member and module module to throw exceptions
This commit is contained in:
parent
be1ce69073
commit
c4a4528e1b
7 changed files with 180 additions and 158 deletions
|
|
@ -108,7 +108,7 @@ class moduleAdminController extends module
|
|||
{
|
||||
$mid = trim($args->{"mid_".$i});
|
||||
if(!$mid) continue;
|
||||
if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return $this->setError('msg_limit_mid');
|
||||
if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) throw new Rhymix\Framework\Exception('msg_limit_mid');
|
||||
$browser_title = $args->{"browser_title_".$i};
|
||||
if(!$mid) continue;
|
||||
if($mid && !$browser_title) $browser_title = $mid;
|
||||
|
|
@ -282,7 +282,7 @@ class moduleAdminController extends module
|
|||
// Get information of the module
|
||||
$columnList = array('module_srl', 'module');
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
|
||||
if(!$module_info) return $this->setError('msg_invalid_request');
|
||||
if(!$module_info) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
// Register Admin ID
|
||||
$oModuleController->deleteAdminId($module_srl);
|
||||
$admin_member = Context::get('admin_member');
|
||||
|
|
@ -509,10 +509,10 @@ class moduleAdminController extends module
|
|||
{
|
||||
$vars = Context::getRequestVars();
|
||||
|
||||
if(!$vars->module_srls) return $this->setError('msg_invalid_request');
|
||||
if(!$vars->module_srls) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$module_srls = explode(',',$vars->module_srls);
|
||||
if(count($module_srls) < 1) return $this->setError('msg_invalid_request');
|
||||
if(count($module_srls) < 1) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$oModuleController= getController('module');
|
||||
|
|
@ -564,10 +564,10 @@ class moduleAdminController extends module
|
|||
function procModuleAdminModuleGrantSetup()
|
||||
{
|
||||
$module_srls = Context::get('module_srls');
|
||||
if(!$module_srls) return $this->setError('msg_invalid_request');
|
||||
if(!$module_srls) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$modules = explode(',',$module_srls);
|
||||
if(count($modules) < 1) return $this->setError('msg_invalid_request');
|
||||
if(count($modules) < 1) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oModuleController = getController('module');
|
||||
$oModuleModel = getModel('module');
|
||||
|
|
@ -676,7 +676,7 @@ class moduleAdminController extends module
|
|||
// if args->name is empty, random generate for user define language
|
||||
if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
|
||||
|
||||
if(!$args->name) return $this->setError('msg_invalid_request');
|
||||
if(!$args->name) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
// Check whether a language code exists
|
||||
$output = executeQueryArray('module.getLang', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
|
@ -723,7 +723,7 @@ class moduleAdminController extends module
|
|||
$args->name = str_replace(' ','_',Context::get('name'));
|
||||
$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
|
||||
if(!empty($args->lang_name)) $args->name = $args->lang_name;
|
||||
if(!$args->name) return $this->setError('msg_invalid_request');
|
||||
if(!$args->name) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$output = executeQuery('module.deleteLang', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
|
@ -737,7 +737,7 @@ class moduleAdminController extends module
|
|||
|
||||
function procModuleAdminGetList()
|
||||
{
|
||||
if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
|
||||
if(!Context::get('is_logged')) throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
|
||||
$oModuleController = getController('module');
|
||||
$oModuleModel = getModel('module');
|
||||
|
|
@ -939,7 +939,7 @@ class moduleAdminController extends module
|
|||
{
|
||||
if(!$moduleSrl && !$mid)
|
||||
{
|
||||
return $this->stop(-1, 'msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
|
|
@ -955,7 +955,7 @@ class moduleAdminController extends module
|
|||
|
||||
if(!$moduleInfo)
|
||||
{
|
||||
return $this->stop(-1, 'msg_module_not_exists');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$skinTargetValue = ($skinType == 'M') ? 'mskin' : 'skin';
|
||||
|
|
@ -1004,7 +1004,7 @@ class moduleAdminController extends module
|
|||
|
||||
if(!$menuItemSrl)
|
||||
{
|
||||
return $this->stop(-1, 'msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ class moduleAdminView extends module
|
|||
$module_srls = Context::get('module_srls');
|
||||
|
||||
$modules = explode(',',$module_srls);
|
||||
if(!count($modules)) if(!$module_srls) return $this->setError('msg_invalid_request');
|
||||
if(!count($modules)) if(!$module_srls) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$columnList = array('module_srl', 'module');
|
||||
|
|
@ -201,7 +201,7 @@ class moduleAdminView extends module
|
|||
$module_srls = Context::get('module_srls');
|
||||
|
||||
$modules = explode(',',$module_srls);
|
||||
if(!count($modules)) if(!$module_srls) return $this->setError('msg_invalid_request');
|
||||
if(!count($modules)) if(!$module_srls) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
// pre-define variables because you can get contents from other module (call by reference)
|
||||
$content = '';
|
||||
// Call a trigger for additional settings
|
||||
|
|
@ -224,7 +224,7 @@ class moduleAdminView extends module
|
|||
$module_srls = Context::get('module_srls');
|
||||
|
||||
$modules = explode(',',$module_srls);
|
||||
if(!count($modules)) if(!$module_srls) return $this->setError('msg_invalid_request');
|
||||
if(!count($modules)) if(!$module_srls) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$columnList = array('module_srl', 'module', 'site_srl');
|
||||
|
|
|
|||
|
|
@ -1078,7 +1078,10 @@ class moduleController extends module
|
|||
if ($ajax) Context::setRequestMethod('JSON');
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return $this->setError('msg_not_permitted');
|
||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$vars = Context::gets('addfile','filter');
|
||||
$attributeNames = Context::get('attribute_name');
|
||||
|
|
@ -1107,7 +1110,7 @@ class moduleController extends module
|
|||
$filter = array_map('trim', explode(',',$vars->filter));
|
||||
if (!in_array($ext, $filter))
|
||||
{
|
||||
return $this->setError('msg_error_occured');
|
||||
throw new Rhymix\Framework\Exception('msg_error_occured');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1122,10 +1125,10 @@ class moduleController extends module
|
|||
// insert
|
||||
else
|
||||
{
|
||||
if(!Context::isUploaded()) return $this->setError('msg_error_occured');
|
||||
if(!Context::isUploaded()) throw new Rhymix\Framework\Exception('msg_error_occured');
|
||||
$addfile = Context::get('addfile');
|
||||
if(!is_uploaded_file($addfile['tmp_name'])) return $this->setError('msg_error_occured');
|
||||
if($vars->addfile['error'] != 0) return $this->setError('msg_error_occured');
|
||||
if(!is_uploaded_file($addfile['tmp_name'])) throw new Rhymix\Framework\Exception('msg_error_occured');
|
||||
if($vars->addfile['error'] != 0) throw new Rhymix\Framework\Exception('msg_error_occured');
|
||||
$output = $this->insertModuleFileBox($vars);
|
||||
}
|
||||
|
||||
|
|
@ -1224,10 +1227,17 @@ class moduleController extends module
|
|||
function procModuleFileBoxDelete()
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return $this->setError('msg_not_permitted');
|
||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$module_filebox_srl = Context::get('module_filebox_srl');
|
||||
if(!$module_filebox_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$module_filebox_srl)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$vars = new stdClass();
|
||||
$vars->module_filebox_srl = $module_filebox_srl;
|
||||
$output = $this->deleteModuleFileBox($vars);
|
||||
|
|
|
|||
|
|
@ -123,15 +123,16 @@ class moduleView extends module
|
|||
function dispModuleFileBox()
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return $this->setError('msg_not_permitted');
|
||||
|
||||
$input_name = Context::get('input');
|
||||
if(!preg_match('/^[a-z0-9_]+$/i', $input_name))
|
||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
if(!$input_name) return $this->setError('msg_not_permitted');
|
||||
$input_name = Context::get('input');
|
||||
if(!$input_name || !preg_match('/^[a-z0-9_]+$/i', $input_name))
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$addscript = sprintf('<script>//<![CDATA[
|
||||
var selected_filebox_input_name = "%s";
|
||||
|
|
@ -154,7 +155,10 @@ class moduleView extends module
|
|||
function dispModuleFileBoxAdd()
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return $this->setError('msg_not_permitted');
|
||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$filter = Context::get('filter');
|
||||
if($filter) Context::set('arrfilter',explode(',',$filter));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue