diff --git a/modules/board/board.mobile.php b/modules/board/board.mobile.php index b89c7d6fa..402e57f73 100644 --- a/modules/board/board.mobile.php +++ b/modules/board/board.mobile.php @@ -1,89 +1,25 @@ - */ - -class boardMobile extends boardView -{ - function init() - { - $oSecurity = new Security(); - $oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl'); - - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count; - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count; - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; - $this->except_notice = $this->module_info->except_notice == 'N' ? false : true; - - // $this->_getStatusNameListecret option backward compatibility - $oDocumentModel = getModel('document'); - - $statusList = $this->_getStatusNameList($oDocumentModel); - if(isset($statusList['SECRET'])) - { - $this->module_info->secret = 'Y'; - } - - // use_category <=1.5.x, hide_category >=1.7.x - $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); - if($count_category) - { - if($this->module_info->hide_category) - { - $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; - } - else if($this->module_info->use_category) - { - $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; - } - else - { - $this->module_info->hide_category = 'N'; - $this->module_info->use_category = 'Y'; - } - } - else - { - $this->module_info->hide_category = 'Y'; - $this->module_info->use_category = 'N'; - } - - /** - * check the consultation function, if the user is admin then swich off consultation function - * if the user is not logged, then disppear write document/write comment./ view document - **/ - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) - { - $this->consultation = true; - if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; - } else { - $this->consultation = false; - } - - $extra_keys = $oDocumentModel->getExtraKeys($this->module_info->module_srl); - Context::set('extra_keys', $extra_keys); + */ - Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml'); - } - - function getBoardCommentPage() +class boardMobile extends boardView +{ + function getBoardCommentPage() { - $this->dispBoardCommentPage(); + $this->dispBoardCommentPage(); $oTemplate = TemplateHandler::getInstance(); $html = $oTemplate->compile($this->getTemplatePath(), 'comment.html'); $this->add('html', $html); - } - - function dispBoardMessage($msg_code) - { - $msg = lang($msg_code); - $oMessageObject = &ModuleHandler::getModuleInstance('message','mobile'); - $oMessageObject->setError(-1); - $oMessageObject->setMessage($msg); - $oMessageObject->dispMessage(); - - $this->setTemplatePath($oMessageObject->getTemplatePath()); - $this->setTemplateFile($oMessageObject->getTemplateFile()); - } -} + } + + function dispBoardMessage($msg_code) + { + $msg = lang($msg_code); + $oMessageObject = &ModuleHandler::getModuleInstance('message','mobile'); + $oMessageObject->setError(-1); + $oMessageObject->setMessage($msg); + $oMessageObject->dispMessage(); + + $this->setTemplatePath($oMessageObject->getTemplatePath()); + $this->setTemplateFile($oMessageObject->getTemplateFile()); + } +} diff --git a/modules/member/member.controller.php b/modules/member/member.controller.php index 7a4de3a09..172bce446 100644 --- a/modules/member/member.controller.php +++ b/modules/member/member.controller.php @@ -747,40 +747,18 @@ class memberController extends member } $accept_agreement_rearranged[$i] = $accept_agreement[$i] === 'Y' ? 'Y' : 'N'; } - - // Check phone number - if ($config->phone_number_verify_by_sms === 'Y') - { - if (!isset($_SESSION['verify_by_sms']) || !$_SESSION['verify_by_sms']['status']) - { - throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); - } - $phone_country = Context::get('phone_country'); - if ($config->phone_number_default_country && (!$phone_country || $config->phone_number_hide_country === 'Y')) - { - $phone_country = $config->phone_number_default_country; - } - if ($phone_country && !preg_match('/^[A-Z]{3}$/', $phone_country)) - { - $phone_country = Rhymix\Framework\i18n::getCountryCodeByCallingCode($phone_country); - } - if ($phone_country !== $_SESSION['verify_by_sms']['country']) - { - throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); - } - $phone_number = Context::get('phone_number'); - if ($phone_number !== $_SESSION['verify_by_sms']['number']) - { - throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); - } - } // Extract the necessary information in advance $getVars = array(); + $use_phone = false; if($config->signupForm) { foreach($config->signupForm as $formInfo) { + if($formInfo->name === 'phone_number' && $formInfo->isUse) + { + $use_phone = true; + } if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) { $getVars[] = $formInfo->name; @@ -824,6 +802,31 @@ class memberController extends member $args->allow_message = Context::get('allow_message'); if($args->password1) $args->password = $args->password1; + + // Check phone number + if ($config->phone_number_verify_by_sms === 'Y' && $use_phone) + { + if (!isset($_SESSION['verify_by_sms']) || !$_SESSION['verify_by_sms']['status']) + { + throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); + } + if ($config->phone_number_default_country && (!$args->phone_country || $config->phone_number_hide_country === 'Y')) + { + $args->phone_country = $config->phone_number_default_country; + } + if ($args->phone_country && !preg_match('/^[A-Z]{3}$/', $args->phone_country)) + { + $args->phone_country = Rhymix\Framework\i18n::getCountryCodeByCallingCode($args->phone_country); + } + if ($args->phone_country !== $_SESSION['verify_by_sms']['country']) + { + throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); + } + if ($args->phone_number !== $_SESSION['verify_by_sms']['number']) + { + throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); + } + } // check password strength if(!MemberModel::checkPasswordStrength($args->password, $config->password_strength)) @@ -1041,51 +1044,17 @@ class memberController extends member $config = MemberModel::getMemberConfig(); $logged_info = Context::get('logged_info'); - // Check phone number - if ($config->phone_number_verify_by_sms === 'Y') - { - $phone_verify_needed = false; - $phone_country = Context::get('phone_country'); - $phone_number = Context::get('phone_number'); - if ($config->phone_number_default_country && (!$phone_country || $config->phone_number_hide_country === 'Y')) - { - $phone_country = $config->phone_number_default_country; - } - if ($phone_country && !preg_match('/^[A-Z]{3}$/', $phone_country)) - { - $phone_country = Rhymix\Framework\i18n::getCountryCodeByCallingCode($phone_country); - } - if ($phone_country !== $logged_info->phone_country) - { - $phone_verify_needed = true; - } - if (preg_replace('/[^0-9]/', '', $phone_number) !== $logged_info->phone_number) - { - $phone_verify_needed = true; - } - if ($phone_verify_needed) - { - if (!isset($_SESSION['verify_by_sms']) || !$_SESSION['verify_by_sms']['status']) - { - throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); - } - if ($phone_country !== $_SESSION['verify_by_sms']['country']) - { - throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); - } - if ($phone_number !== $_SESSION['verify_by_sms']['number']) - { - throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); - } - } - } - // Extract the necessary information in advance $getVars = array('allow_mailing','allow_message'); + $use_phone = false; if($config->signupForm) { foreach($config->signupForm as $formInfo) { + if($formInfo->name === 'phone_number' && $formInfo->isUse) + { + $use_phone = true; + } if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) { $getVars[] = $formInfo->name; @@ -1125,6 +1094,43 @@ class memberController extends member $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); } + // Check phone number + if ($config->phone_number_verify_by_sms === 'Y' && $use_phone) + { + $phone_verify_needed = false; + if ($config->phone_number_default_country && (!$args->phone_country || $config->phone_number_hide_country === 'Y')) + { + $args->phone_country = $config->phone_number_default_country; + } + if ($args->phone_country && !preg_match('/^[A-Z]{3}$/', $args->phone_country)) + { + $args->phone_country = Rhymix\Framework\i18n::getCountryCodeByCallingCode($args->phone_country); + } + if ($args->phone_country !== $logged_info->phone_country) + { + $phone_verify_needed = true; + } + if (preg_replace('/[^0-9]/', '', $args->phone_number) !== $logged_info->phone_number) + { + $phone_verify_needed = true; + } + if ($phone_verify_needed) + { + if (!isset($_SESSION['verify_by_sms']) || !$_SESSION['verify_by_sms']['status']) + { + throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); + } + if ($args->phone_country !== $_SESSION['verify_by_sms']['country']) + { + throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); + } + if ($args->phone_number !== $_SESSION['verify_by_sms']['number']) + { + throw new Rhymix\Framework\Exception('verify_by_sms_incomplete'); + } + } + } + $args->member_srl = $logged_info->member_srl; // Remove some unnecessary variables from all the vars