개인정보 이메일 보호 (메일주소 가리기, 친구만 메일 보내기)

This commit is contained in:
conory 2016-03-03 23:03:22 +09:00
parent 929a694ee1
commit f3916c9535
2 changed files with 10 additions and 6 deletions

View file

@ -155,12 +155,16 @@ class memberModel extends member
} }
// Send an email only if email address is public // Send an email only if email address is public
if(($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address) if($email_config->isPublic == 'Y' && $member_info->email_address)
{
$oCommunicationModel = getModel('communication');
if($logged_info->is_admin == 'Y' || $oCommunicationModel->isFriend($member_info->member_srl))
{ {
$url = 'mailto:'.htmlspecialchars($member_info->email_address, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); $url = 'mailto:'.htmlspecialchars($member_info->email_address, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
$oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path); $oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path);
} }
} }
}
// View homepage info // View homepage info
if($member_info->homepage) if($member_info->homepage)
$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank'); $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank');

View file

@ -84,9 +84,9 @@ class memberView extends member
if($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl)) if($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl))
{ {
$start = strpos($member_info->email_address, '@')+1; list($email_id, $email_host) = explode('@', $member_info->email_address);
$replaceStr = str_repeat('*', (strlen($member_info->email_address) - $start)); $protect_id = substr($email_id, 0, 2) . str_repeat('*', strlen($email_id)-2);
$member_info->email_address = substr_replace($member_info->email_address, $replaceStr, $start); $member_info->email_address = sprintf('%s@%s', $protect_id, $email_host);
} }
if(!$member_info->member_srl) return $this->dispMemberSignUpForm(); if(!$member_info->member_srl) return $this->dispMemberSignUpForm();