Add list of reserved words #763

This commit is contained in:
Kijin Sung 2017-03-23 19:43:49 +09:00
parent fae2a05b6f
commit 97047d1279
6 changed files with 83 additions and 7 deletions

View file

@ -65,7 +65,7 @@ $lang->cmd_find_module = 'Find Module';
$lang->cmd_find_langcode = 'Find lang code';
$lang->msg_new_module = 'Create new module';
$lang->msg_update_module = 'Modify module';
$lang->msg_module_name_exists = 'The name already exists. Please try another name.';
$lang->msg_module_name_exists = 'The name already exists or is not usable. Please try another name.';
$lang->msg_module_not_exists = 'Module matching the name is not found.';
$lang->msg_category_is_null = 'There is no registered category.';
$lang->msg_grant_is_null = 'There is no permission list.';

View file

@ -65,7 +65,7 @@ $lang->cmd_find_module = '모듈 찾기';
$lang->cmd_find_langcode = '언어 코드 찾기';
$lang->msg_new_module = '모듈 생성';
$lang->msg_update_module = '모듈 수정';
$lang->msg_module_name_exists = '이미 존재하는 모듈 이름입니다. 다른 이름을 입력해주세요.';
$lang->msg_module_name_exists = '이미 존재하거나 사용할 수 없는 모듈 이름입니다. 다른 이름을 입력해 주세요.';
$lang->msg_module_not_exists = '해당 모듈이 존재하지 않습니다.';
$lang->msg_category_is_null = '등록된 분류가 없습니다.';
$lang->msg_grant_is_null = '등록된 권한 대상이 없습니다.';

View file

@ -19,20 +19,31 @@ class moduleModel extends module
*/
function isIDExists($id, $site_srl = 0)
{
if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
// directory and rss/atom/api reserved checking, etc.
$dirs = FileHandler::readDir(_XE_PATH_);
if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id))
{
return true;
}
if (Context::isReservedWord(strtolower($id)))
{
return true;
}
$dirs = array_map('strtolower', FileHandler::readDir(_XE_PATH_));
$dirs[] = 'rss';
$dirs[] = 'atom';
$dirs[] = 'api';
$dirs[] = 'admin';
if(in_array($id, $dirs)) return true;
if (in_array(strtolower($id), $dirs))
{
return true;
}
// mid test
$args = new stdClass();
$args->mid = $id;
$args->site_srl = $site_srl;
$output = executeQuery('module.isExistsModuleName', $args);
if($output->data->count) return true;
// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
if(!$site_srl)
{