/**
  * send email
  */
 function sendMailMessage($title, $message, $recipientName, $recipientEmailAddress, $senderName, $senderEmailAddress)
 {
     $oMail = new Mail();
     $oMail->setTitle($title);
     $oMail->setContent($message);
     $oMail->setSender($senderName, $senderEmailAddress);
     $oMail->setReceiptor($recipientName, $recipientEmailAddress);
     $oMail->send();
 }
Ejemplo n.º 2
0
	function sendMessages($content, $mail_content, $title, $sender, $config) 
	{
		$oTextmessageController = &getController('textmessage');
		$oPaynotyModel = &getModel('paynoty');

		if (in_array($config->sending_method,array('1','2'))&&$oTextmessageController) 
		{
			$args->recipient_no = explode(',',$config->admin_phones);
			//$args->sender_no = $receiver->recipient_no;
			$args->content = $content;
			$output = $oTextmessageController->sendMessage($args);
			if (!$output->toBool()) return $output;
		}

		if (in_array($config->sending_method,array('1','3'))) 
		{
			if ($config->sender_email)
			{
				$sender_email_address = $config->sender_email;
			}
			else
			{
				$sender_email_address = $sender->email_address;
			}
			if ($config->sender_name)
			{
				$sender_name = $config->sender_name;
			}
			else
			{
				$sender_name = $sender->nick_name;
			}
			$oMail = new Mail();
			$oMail->setTitle($title);
			$oMail->setContent($mail_content);
			$oMail->setSender($sender_name, $sender_email_address);
			$target_email = explode(',',$config->admin_emails);
			foreach ($target_email as $email_address) 
			{
				$email_address = trim($email_address);
				if (!$email_address) continue;
				$oMail->setReceiptor($email_address, $email_address);
				$oMail->send();
			}
		}
		return new Object();
	}
Ejemplo n.º 3
0
 /**
  * Send a message
  * @return Object
  **/
 function procCommunicationSendMessage()
 {
     // Check login information
     if (!Context::get('is_logged')) {
         return new Object(-1, 'msg_not_logged');
     }
     $logged_info = Context::get('logged_info');
     // Check variables
     $receiver_srl = Context::get('receiver_srl');
     if (!$receiver_srl) {
         return new Object(-1, 'msg_not_exists_member');
     }
     $title = trim(Context::get('title'));
     if (!$title) {
         return new Object(-1, 'msg_title_is_null');
     }
     $content = trim(Context::get('content'));
     if (!$content) {
         return new Object(-1, 'msg_content_is_null');
     }
     $send_mail = Context::get('send_mail');
     if ($send_mail != 'Y') {
         $send_mail = 'N';
     }
     // Check if there is a member to receive a message
     $oMemberModel =& getModel('member');
     $oCommunicationModel =& getModel('communication');
     $receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
     if ($receiver_member_info->member_srl != $receiver_srl) {
         return new Object(-1, 'msg_not_exists_member');
     }
     // check whether to allow to receive the message(pass if a top-administrator)
     if ($logged_info->is_admin != 'Y') {
         if ($receiver_member_info->allow_message == 'F') {
             if (!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) {
                 return new object(-1, 'msg_allow_message_to_friend');
             }
         } elseif ($receiver_member_info->allow_message == 'N') {
             return new object(-1, 'msg_disallow_message');
         }
     }
     // send a message
     $output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
     // send an e-mail
     if ($output->toBool() && $send_mail == 'Y') {
         $view_url = Context::getRequestUri();
         $content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>", $content, $view_url, $view_url);
         $oMail = new Mail();
         $oMail->setTitle($title);
         $oMail->setContent($content);
         $oMail->setSender($logged_info->nick_name, $logged_info->email_address);
         $oMail->setReceiptor($receiver_member_info->nick_name, $receiver_member_info->email_address);
         $oMail->send();
     }
     if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) {
         global $lang;
         htmlHeader();
         alertScript($lang->success_sended);
         closePopupScript();
         htmlFooter();
         Context::close();
         exit;
     }
     return $output;
 }
 /**
  * Import member information
  * @param int $key
  * @param int $cur
  * @param string $index_file
  * @return int
  */
 function importMember($key, $cur, $index_file)
 {
     if (!$cur) {
         $cur = 0;
     }
     // Create the xmlParser object
     $oXmlParser = new XmlParser();
     // Create objects for importing member information
     $this->oMemberController = getController('member');
     $this->oMemberModel = getModel('member');
     // Get a default member group
     $default_group = $this->oMemberModel->getDefaultGroup();
     $default_group_srl = $default_group->group_srl;
     // Get information of the Webmaster
     $oModuleModel = getModel('module');
     $member_config = $oModuleModel->getModuleConfig('member');
     // Open an index file
     $f = fopen($index_file, "r");
     // Pass if already read
     for ($i = 0; $i < $cur; $i++) {
         fgets($f, 1024);
     }
     // Read by each line until the condition meets
     for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) {
         if (feof($f)) {
             break;
         }
         // Find a given location
         $target_file = trim(fgets($f, 1024));
         // Load and parse the file
         $xmlObj = $oXmlParser->loadXmlFile($target_file);
         FileHandler::removeFile($target_file);
         if (!$xmlObj) {
             continue;
         }
         // List Objects
         $obj = null;
         $obj->user_id = base64_decode($xmlObj->member->user_id->body);
         $obj->password = base64_decode($xmlObj->member->password->body);
         $obj->user_name = base64_decode($xmlObj->member->user_name->body);
         $obj->nick_name = base64_decode($xmlObj->member->nick_name->body);
         if (!$obj->user_name) {
             $obj->user_name = $obj->nick_name;
         }
         $obj->email = base64_decode($xmlObj->member->email->body);
         $obj->homepage = base64_decode($xmlObj->member->homepage->body);
         $obj->blog = base64_decode($xmlObj->member->blog->body);
         $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body), 0, 8);
         $obj->allow_mailing = base64_decode($xmlObj->member->allow_mailing->body);
         $obj->point = base64_decode($xmlObj->member->point->body);
         $obj->image_nickname = base64_decode($xmlObj->member->image_nickname->buff->body);
         $obj->image_mark = base64_decode($xmlObj->member->image_mark->buff->body);
         $obj->profile_image = base64_decode($xmlObj->member->profile_image->buff->body);
         $obj->signature = base64_decode($xmlObj->member->signature->body);
         $obj->regdate = base64_decode($xmlObj->member->regdate->body);
         $obj->last_login = base64_decode($xmlObj->member->last_login->body);
         if ($xmlObj->member->extra_vars) {
             foreach ($xmlObj->member->extra_vars as $key => $val) {
                 if (in_array($key, array('node_name', 'attrs', 'body'))) {
                     continue;
                 }
                 $obj->extra_vars->{$key} = base64_decode($val->body);
             }
         }
         // Create url for homepage and blog
         if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) {
             $obj->homepage = 'http://' . $obj->homepage;
         }
         // email address column
         $obj->email_address = $obj->email;
         list($obj->email_id, $obj->email_host) = explode('@', $obj->email);
         // Set the mailing option
         if ($obj->allow_mailing != 'Y') {
             $obj->allow_mailing = 'N';
         }
         // Set the message option
         $obj->allow_message = 'Y';
         if (!in_array($obj->allow_message, array('Y', 'N', 'F'))) {
             $obj->allow_message = 'Y';
         }
         // Get member-join date if the last login time is not found
         if (!$obj->last_login) {
             $obj->last_login = $obj->regdate;
         }
         // Get a member_srl
         $obj->member_srl = getNextSequence();
         $obj->list_order = -1 * $obj->member_srl;
         // List extra vars
         $extra_vars = $obj->extra_vars;
         unset($obj->extra_vars);
         $obj->extra_vars = serialize($extra_vars);
         // Check if the same nickname is existing
         $nick_args = new stdClass();
         $nick_args->nick_name = $obj->nick_name;
         $nick_output = executeQuery('member.getMemberSrl', $nick_args);
         if (!$nick_output->toBool()) {
             $obj->nick_name .= '_' . $obj->member_srl;
         }
         // Add a member
         $output = executeQuery('member.insertMember', $obj);
         if ($output->toBool() && !$obj->password) {
             // Send a mail telling the user to reset his password.
             $oMail = new Mail();
             $oMail->setTitle("Password update for your " . getFullSiteUrl() . " account");
             $webmaster_name = $member_config->webmaster_name ? $member_config->webmaster_name : 'Webmaster';
             $oMail->setContent("Dear {$obj->user_name}, <br /><br />\n\t\t\t\t\t\tWe recently migrated our phpBB forum to XpressEngine. Since you password was encrypted we could not migrate it too, so please reset it by following this link:\n\t\t\t\t\t\t<a href='" . getFullSiteUrl() . "/?act=dispMemberFindAccount' >" . getFullSiteUrl() . "?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br />\n\n\t\t\t\t\t\tThank you for your understanding,<br />\n\t\t\t\t\t\t{$webmaster_name}");
             $oMail->setSender($webmaster_name, $member_config->webmaster_email);
             $oMail->setReceiptor($obj->user_name, $obj->email);
             $oMail->send();
         }
         // add group join/image name-mark-signiture and so on if a new member successfully added
         if ($output->toBool()) {
             // Join to the default group
             $obj->group_srl = $default_group_srl;
             executeQuery('member.addMemberToGroup', $obj);
             // Image name
             if ($obj->image_nickname) {
                 $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl));
                 $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
                 FileHandler::writeFile($target_filename, $obj->image_nickname);
             }
             // Image mark
             if ($obj->image_mark && file_exists($obj->image_mark)) {
                 $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl));
                 $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
                 FileHandler::writeFile($target_filename, $obj->image_mark);
             }
             // Profile image
             if ($obj->profile_image) {
                 $target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl));
                 $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
                 FileHandler::writeFile($target_filename, $obj->profile_image);
             }
             // Signiture
             if ($obj->signature) {
                 $signature = removeHackTag($obj->signature);
                 $signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature);
                 $target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl));
                 if (!is_dir($target_path)) {
                     FileHandler::makeDir($target_path);
                 }
                 $target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl);
                 FileHandler::writeFile($target_filename, $signature_buff);
             }
         }
     }
     fclose($f);
     return $idx - 1;
 }
 /**
  * Change comment status
  * @return void|object
  */
 function procCommentAdminChangeStatus()
 {
     $will_publish = Context::get('will_publish');
     // Error display if none is selected
     $cart = Context::get('cart');
     if (!$cart) {
         return $this->stop('msg_cart_is_null');
     }
     if (!is_array($cart)) {
         $comment_srl_list = explode('|@|', $cart);
     } else {
         $comment_srl_list = $cart;
     }
     $args = new stdClass();
     $args->status = $will_publish;
     $args->comment_srls_list = $comment_srl_list;
     $output = executeQuery('comment.updatePublishedStatus', $args);
     if (!$output->toBool()) {
         return $output;
     } else {
         //update comment count for document
         $updated_documents_arr = array();
         // create the controller object of the document
         $oDocumentController = getController('document');
         // create the model object of the document
         $oDocumentModel = getModel('document');
         // create the comment model object
         $oCommentModel = getModel('comment');
         //get admin info
         $logged_info = Context::get('logged_info');
         //$oMemberModule = getModel("member");
         //$logged_info = $oMemberModule->getMemberInfoByMemberSrl($logged_member_srl);
         $new_status = $will_publish ? "published" : "unpublished";
         foreach ($comment_srl_list as $comment_srl) {
             // check if comment already exists
             $comment = $oCommentModel->getComment($comment_srl);
             if ($comment->comment_srl != $comment_srl) {
                 return new Object(-1, 'msg_invalid_request');
             }
             $document_srl = $comment->document_srl;
             if (!in_array($document_srl, $updated_documents_arr)) {
                 $updated_documents_arr[] = $document_srl;
                 // update the number of comments
                 $comment_count = $oCommentModel->getCommentCount($document_srl);
                 // update comment count of the article posting
                 $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, NULL, FALSE);
                 $oDocument = $oDocumentModel->getDocument($document_srl);
                 $author_email = $oDocument->variables['email_address'];
                 $oModuleModel = getModel("module");
                 $module_info = $oModuleModel->getModuleInfoByModuleSrl($comment->module_srl);
                 $already_sent = array();
                 // send email to comment's author, all admins and thread(document) subscribers - START
                 // -------------------------------------------------------
                 $oMail = new Mail();
                 $mail_title = "[XE - " . $module_info->mid . "] comment(s) status changed to " . $new_status . " on document: \"" . $oDocument->getTitleText() . "\"";
                 $oMail->setTitle($mail_title);
                 $mail_content = "\n\t\t\t\t\t\tThe comment #" . $comment_srl . " on document \"" . $oDocument->getTitleText() . "\" has been " . $new_status . " by admin of <strong><i>" . strtoupper($module_info->mid) . "</i></strong> module.\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<br />Comment content:\n\t\t\t\t\t\t" . $comment->content . "\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t";
                 $oMail->setContent($mail_content);
                 $oMail->setSender($logged_info->user_name, $logged_info->email_address);
                 $document_author_email = $oDocument->variables['email_address'];
                 //mail to author of thread - START
                 /**
                  * @todo Removed code send email to document author.
                  */
                 /*
                 if($document_author_email != $comment->email_address && $logged_info->email_address != $document_author_email)
                 {
                 	$oMail->setReceiptor($document_author_email, $document_author_email);
                 	$oMail->send();
                 	$already_sent[] = $document_author_email;
                 }
                 */
                 //mail to author of thread - STOP
                 //mail to all emails set for administrators - START
                 if ($module_info->admin_mail) {
                     $target_mail = explode(',', $module_info->admin_mail);
                     for ($i = 0; $i < count($target_mail); $i++) {
                         $email_address = trim($target_mail[$i]);
                         if (!$email_address) {
                             continue;
                         }
                         if ($author_email != $email_address) {
                             $oMail->setReceiptor($email_address, $email_address);
                             $oMail->send();
                         }
                     }
                 }
                 //mail to all emails set for administrators - STOP
             }
             // ----------------------------------------------------------
             // send email to comment's author, all admins and thread(document) subscribers - STOP
         }
         // call a trigger for calling "send mail to subscribers" (for moment just for forum)
         ModuleHandler::triggerCall("comment.procCommentAdminChangeStatus", "after", $comment_srl_list);
     }
     // for message send - start
     $message_content = Context::get('message_content');
     if ($message_content) {
         $message_content = nl2br($message_content);
     }
     if ($message_content) {
         $this->_sendMessageForComment($message_content, $comment_srl_list);
     }
     // for message send - end
 }
 function procIssuetrackerInsertIssue()
 {
     // 권한 체크
     if (!$this->grant->ticket_write) {
         return new Object(-1, 'msg_not_permitted');
     }
     // 글작성시 필요한 변수를 세팅
     $obj = Context::getRequestVars();
     $obj->module_srl = $this->module_srl;
     if (!$obj->title) {
         $obj->title = cut_str(strip_tags($obj->content), 20, '...');
     }
     // 관리자가 아니라면 게시글 색상/굵기 제거
     if (!$this->grant->manager) {
         unset($obj->title_color);
         unset($obj->title_bold);
     }
     // 커미터가 아니라면 마일스톤(계획), 우선순위, 소유자 설정 제거
     // (이슈 상태는 여기서 건드릴수없음 / 종류, 컴포넌트, 패키지 설정은 ticket_write권한이면 가능)
     if (!$this->grant->commiter) {
         unset($obj->assignee_srl);
         unset($obj->milestone_srl);
         unset($obj->priority_srl);
     }
     if ($obj->release_srl) {
         $obj->occured_version_srl = $obj->release_srl;
     }
     if ($obj->occured_version_srl == 0) {
         unset($obj->occured_version_srl);
     }
     // document module의 model 객체 생성
     $oDocumentModel =& getModel('document');
     // document module의 controller 객체 생성
     $oDocumentController =& getController('document');
     // 이미 존재하는 글인지 체크
     $oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
     // 이미 존재하는 경우 수정
     if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) {
         $output = $oDocumentController->updateDocument($oDocument, $obj);
         $msg_code = 'success_updated';
         if (!$output->toBool()) {
             return $output;
         }
         // 그렇지 않으면 신규 등록
     } else {
         // assignee name
         $oMemberModel =& getModel('member');
         $member_info = $oMemberModel->getMemberInfoByMemberSrl($obj->assignee_srl);
         $obj->assignee_name = $member_info->nick_name;
         // transaction start
         $oDB =& DB::getInstance();
         $oDB->begin();
         $output = executeQuery("issuetracker.insertIssue", $obj);
         if (!$output->toBool()) {
             $oDB->rollback();
             return $output;
         }
         $output = $oDocumentController->insertDocument($obj);
         $msg_code = 'success_registed';
         $obj->document_srl = $output->get('document_srl');
         if (!$output->toBool()) {
             $oDB->rollback();
             return $output;
         }
         $oDB->commit();
         // 문제가 없고 모듈 설정에 관리자 메일이 등록되어 있으면 메일 발송
         if ($output->toBool() && $this->module_info->admin_mail) {
             $oMail = new Mail();
             $oMail->setTitle($obj->title);
             $oMail->setContent(sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getUrl('', 'document_srl', $obj->document_srl), getUrl('', 'document_srl', $obj->document_srl), $obj->content));
             $oMail->setSender($obj->user_name, $obj->email_address);
             $target_mail = explode(',', $this->module_info->admin_mail);
             for ($i = 0; $i < count($target_mail); $i++) {
                 $email_address = trim($target_mail[$i]);
                 if (!$email_address) {
                     continue;
                 }
                 $oMail->setReceiptor($email_address, $email_address);
                 $oMail->send();
             }
         }
     }
     // 오류 발생시 멈춤
     if (!$output->toBool()) {
         return $output;
     }
     // 결과를 리턴
     $this->add('mid', Context::get('mid'));
     $this->add('document_srl', $output->get('document_srl'));
     // 성공 메세지 등록
     $this->setMessage($msg_code);
 }
Ejemplo n.º 7
0
 function procMemberModifyEmailAddress()
 {
     if (!Context::get('is_logged')) {
         return $this->stop('msg_not_logged');
     }
     $member_info = Context::get('logged_info');
     $newEmail = Context::get('email_address');
     if (!$newEmail) {
         return $this->stop('msg_invalid_request');
     }
     $oMemberModel = getModel('member');
     // Check managed Email Host
     if ($oMemberModel->isDeniedEmailHost($newEmail)) {
         $config = $oMemberModel->getMemberConfig();
         $emailhost_check = $config->emailhost_check;
         $managed_email_host = lang('managed_email_host');
         $email_hosts = $oMemberModel->getManagedEmailHosts();
         foreach ($email_hosts as $host) {
             $hosts[] = $host->email_host;
         }
         $message = sprintf($managed_email_host[$emailhost_check], implode(', ', $hosts), 'id@' . implode(', id@', $hosts));
         return new Object(-1, $message);
     }
     // Check if the e-mail address is already registered
     $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail);
     if ($member_srl) {
         return new Object(-1, 'msg_exists_email_address');
     }
     if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') {
         return $this->stop('msg_invalid_request');
     }
     unset($_SESSION['rechecked_password_step']);
     $auth_args = new stdClass();
     $auth_args->user_id = $newEmail;
     $auth_args->member_srl = $member_info->member_srl;
     $auth_args->auth_key = Rhymix\Framework\Security::getRandom(40, 'hex');
     $auth_args->new_password = '******';
     $oDB =& DB::getInstance();
     $oDB->begin();
     $output = executeQuery('member.insertAuthMail', $auth_args);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     $oModuleModel = getModel('module');
     $member_config = $oModuleModel->getModuleConfig('member');
     $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
     if (!is_dir($tpl_path)) {
         $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
     }
     global $lang;
     $memberInfo = array();
     $memberInfo[$lang->email_address] = $member_info->email_address;
     $memberInfo[$lang->nick_name] = $member_info->nick_name;
     Context::set('memberInfo', $memberInfo);
     Context::set('newEmail', $newEmail);
     $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key);
     Context::set('auth_url', $auth_url);
     $oTemplate =& TemplateHandler::getInstance();
     $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email');
     $oMail = new Mail();
     $oMail->setTitle(lang('title_modify_email_address'));
     $oMail->setContent($content);
     $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
     $oMail->setReceiptor($member_info->nick_name, $newEmail);
     $result = $oMail->send();
     $msg = sprintf(lang('msg_confirm_mail_sent'), $newEmail);
     $this->setMessage($msg);
     $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '');
     $this->setRedirectUrl($returnUrl);
 }
Ejemplo n.º 8
0
 /**
  * @brief 쪽지 발송
  **/
 function procMobileexSendMessage()
 {
     // 로그인 정보 체크
     if (!Context::get('is_logged')) {
         return new Object(-1, 'msg_not_logged');
     }
     $logged_info = Context::get('logged_info');
     // 변수 검사
     $receiver_srl = Context::get('receiver_srl');
     $receiver_user_id = Context::get('receiver_user_id');
     $oMemberModel =& getModel('member');
     if ($receiver_user_id) {
         if ($this->xe_ver > 4) {
             $columnList = array('member_srl');
             $receiver_info = $oMemberModel->getMemberInfoByUserID($receiver_user_id, $columnList);
         } else {
             $receiver_info = $oMemberModel->getMemberInfoByUserID($receiver_user_id);
         }
     }
     if (!$receiver_srl) {
         $receiver_srl = $receiver_info->member_srl;
     }
     // 마지막으로 받는이가 없으면..에러출력..
     if (!$receiver_srl) {
         return new Object(-1, 'msg_not_exists_member');
     }
     $title = trim(Context::get('title'));
     if (!$title) {
         return new Object(-1, 'msg_title_is_null');
     }
     $content = Context::get('content');
     $content = str_replace("\r\n", "\n", $content);
     $content = str_replace("\r", "\n", $content);
     $content = trim($content);
     if (!$content) {
         return new Object(-1, 'msg_content_is_null');
     }
     $send_mail = Context::get('send_mail');
     if ($send_mail != 'Y') {
         $send_mail = 'N';
     }
     // 받을 회원이 있는지에 대한 검사
     $oCommunicationModel =& getModel('communication');
     $receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
     if ($receiver_member_info->member_srl != $receiver_srl) {
         return new Object(-1, 'msg_not_exists_member');
     }
     // 받을 회원의 쪽지 수신여부 검사 (최고관리자이면 패스)
     if ($logged_info->is_admin != 'Y') {
         if ($receiver_member_info->allow_message == 'F') {
             if (!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) {
                 return new object(-1, 'msg_allow_message_to_friend');
             }
         } elseif ($receiver_member_info->allow_messge == 'N') {
             return new object(-1, 'msg_disallow_message');
         }
     }
     $oCommunicationController =& getController('communication');
     // 쪽지 발송
     $output = $oCommunicationController->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
     // 메일로도 발송
     if ($output->toBool() && $send_mail == 'Y') {
         $view_url = Context::getRequestUri();
         $content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>", $content, $view_url, $view_url);
         $oMail = new Mail();
         $oMail->setTitle($title);
         $oMail->setContent($content);
         $oMail->setSender($logged_info->user_name, $logged_info->email_address);
         $oMail->setReceiptor($receiver_member_info->user_name, $receiver_member_info->email_address);
         $oMail->send();
     }
     return $output;
 }
Ejemplo n.º 9
0
        /**
         * comment insert
         **/
        function procShopInsertComment() {
            $oDocumentModel = &getModel('document');
            $oCommentModel = &getModel('comment');
            $oCommentController = &getController('comment');

            if(!$this->grant->write_comment) return new Object(-1, 'msg_not_permitted');

            $obj = Context::gets('document_srl','comment_srl','parent_srl','content','password','nick_name','member_srl','email_address','homepage','is_secret','notify_message');
            $obj->module_srl = $this->module_srl;

            $oDocument = $oDocumentModel->getDocument($obj->document_srl);
            if(!$oDocument->isExists()) return new Object(-1,'msg_not_permitted');

            if(!$obj->comment_srl) $obj->comment_srl = getNextSequence();
            else $comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager);

            if($comment->comment_srl != $obj->comment_srl) {
                if($obj->parent_srl) {
                    $parent_comment = $oCommentModel->getComment($obj->parent_srl);
                    if(!$parent_comment->comment_srl) return new Object(-1, 'msg_invalid_request');

                    $output = $oCommentController->insertComment($obj);

                } else {
                    $output = $oCommentController->insertComment($obj);
                }

                if($output->toBool() && $this->module_info->admin_mail) {
                    $oMail = new Mail();
                    $oMail->setTitle($oDocument->getTitleText());
                    $oMail->setContent( sprintf("From : <a href=\"%s#comment_%d\">%s#comment_%d</a><br/>\r\n%s", $oDocument->getPermanentUrl(), $obj->comment_srl, $oDocument->getPermanentUrl(), $obj->comment_srl, $obj->content));
                    $oMail->setSender($obj->nick_name, $obj->email_address);

                    $target_mail = explode(',',$this->module_info->admin_mail);
                    for($i=0;$i<count($target_mail);$i++) {
                        $email_address = trim($target_mail[$i]);
                        if(!$email_address) continue;
                        $oMail->setReceiptor($email_address, $email_address);
                        $oMail->send();
                    }
                }

            } else {
                $obj->parent_srl = $comment->parent_srl;
                $output = $oCommentController->updateComment($obj, $this->grant->manager);
                $comment_srl = $obj->comment_srl;
            }
            if(!$output->toBool()) return $output;

			$this->setRedirectUrl($_SERVER['HTTP_REFERER']);
        }
 /**
  * 휴면 안내메일을 발송하는 메소드.
  */
 public function sendEmail($member_srl, $config = null, $resend = true, $use_transaction = true)
 {
     // 회원 오브젝트를 통째로 받은 경우 member_srl을 추출한다.
     if (is_object($member_srl) && isset($member_srl->member_srl)) {
         $member = $member_srl;
         $member_srl = $member_srl->member_srl;
     } else {
         $args = new stdClass();
         $args->member_srl = $member_srl;
         $member_query = executeQuery('member.getMemberInfoByMemberSrl', $args);
         if (!$member_query->toBool() || !$member_query->data) {
             return -41;
         }
         $member = is_object($member_query->data) ? $member_query->data : reset($member_query->data);
         if (!$member) {
             return -42;
         }
         $member_srl = $member->member_srl;
     }
     // 모듈 설정이 로딩되지 않은 경우 지금 로딩한다.
     if (!$config) {
         $config = $this->getConfig();
     }
     // 이미 발송한 경우, $resend = true가 아니라면 재발송하지 않는다.
     $args = new stdClass();
     $args->member_srl = $member_srl;
     $output = executeQuery('member_expire.getNotifiedDates', $args);
     if (!$output->toBool()) {
         return -43;
     }
     if (count($output->data) && !$resend) {
         return 2;
     }
     // 정리 예정일을 계산한다.
     $start_date = strtotime($config->auto_start) + zgap();
     $base_date = $member->last_login ? $member->last_login : $member->regdate;
     $base_date = $base_date ? ztime($base_date) : 0;
     $expire_date = $base_date + 86400 * $config->expire_threshold;
     if ($expire_date < $start_date) {
         $expire_date = $start_date;
     }
     $member->expire_date = date('YmdHis', $expire_date);
     // 매크로를 변환한다.
     $site_title = Context::getSiteTitle();
     $macros = array('{SITE_NAME}' => htmlspecialchars($site_title, ENT_QUOTES, 'UTF-8', false), '{USER_ID}' => htmlspecialchars($member->user_id, ENT_QUOTES, 'UTF-8', false), '{USER_NAME}' => htmlspecialchars($member->user_name, ENT_QUOTES, 'UTF-8', false), '{NICK_NAME}' => htmlspecialchars($member->nick_name, ENT_QUOTES, 'UTF-8', false), '{EMAIL}' => htmlspecialchars($member->email_address, ENT_QUOTES, 'UTF-8', false), '{LOGIN_DATE}' => $base_date ? date('Y년 n월 j일', $base_date) : '(로그인 기록 없음)', '{EXPIRE_DATE}' => date('Y년 n월 j일', $expire_date), '{TIME_LIMIT}' => $this->translateThreshold($config->expire_threshold), '{CLEAN_METHOD}' => $config->expire_method === 'delete' ? '삭제' : '별도의 저장공간으로 이동');
     // 메일을 작성하여 발송한다.
     $subject = htmlspecialchars_decode(str_replace(array_keys($macros), array_values($macros), $config->email_subject));
     $content = str_replace(array_keys($macros), array_values($macros), $config->email_content);
     $recipient_name = $member->user_name ? $member->user_name : ($member->nick_name ? $member->nick_name : 'member');
     static $sender_name = null;
     static $sender_email = null;
     if ($sender_name === null) {
         $member_config = getModel('module')->getModuleConfig('member');
         $sender_name = $member_config->webmaster_name ? $member_config->webmaster_name : ($site_title ? $site_title : 'webmaster');
         $sender_email = $member_config->webmaster_email;
     }
     $oMail = new Mail();
     $oMail->setTitle($subject);
     $oMail->setContent($content);
     $oMail->setSender($sender_name, $sender_email);
     $oMail->setReceiptor($recipient_name, $member->email_address);
     $oMail->send();
     // 트랜잭션을 시작한다.
     if ($use_transaction) {
         $this->oDB->begin();
     }
     // 발송한 메일을 기록한다.
     $output = executeQuery('member_expire.deleteNotifiedDate', $member);
     if (!$output->toBool()) {
         if ($use_transaction) {
             $this->oDB->rollback();
         }
         return -44;
     }
     $output = executeQuery('member_expire.insertNotifiedDate', $member);
     if (!$output->toBool()) {
         if ($use_transaction) {
             $this->oDB->rollback();
         }
         return -45;
     }
     // 트랜잭션을 커밋한다.
     if ($use_transaction) {
         $this->oDB->commit();
     }
     return 1;
 }
 /**
  * send email to subscribers
  * @param Newsletter $newsletter
  * @param $site_srl
  */
 public function sendEmailsToSubscribers(Newsletter $newsletter, $site_srl)
 {
     $shopModel = getModel('shop');
     $customerRepository = $shopModel->getCustomerRepository();
     $output = $customerRepository->getNewsletterCustomers($site_srl, 'Y');
     $emails_list = "";
     foreach ($output->customers as $customer) {
         //add unsubscribe link to $newsletter->content;
         $newsletter_content = $newsletter->content . "</br></br>" . sprintf(Context::getLang('unsubscribe_message'), getUrl('', 'act', 'procShopUnsignToNewsletter', 'member_srl', $customer->member_srl, 'email_address', $customer->email_address));
         $oMail = new Mail();
         $oMail->setTitle($newsletter->subject);
         $oMail->setContent($newsletter_content);
         $oMail->setSender($newsletter->sender_name, $newsletter->sender_email);
         $oMail->setReceiptor(false, $customer->email_address);
         $oMail->send();
     }
 }
Ejemplo n.º 12
0
 private static function sendNewOrderMailToAdministrator($shop, $order)
 {
     // Don't send anything if admin email is not configured
     if (!$shop->getEmail()) {
         ShopLogger::log("Failed to send order email to admin for order #{$order->order_srl}; Admin email is not configured");
         return;
     }
     global $lang;
     $admin_email_subject = sprintf($lang->admin_order_email_subject, $order->client_name, ShopDisplay::priceFormat($order->total, $shop->getCurrencySymbol()));
     Context::set('email_order', $order);
     $oTemplateHandler = TemplateHandler::getInstance();
     $order_content = $oTemplateHandler->compile('./modules/shop/tpl', 'order_email.html');
     $admin_email_content = sprintf($lang->admin_order_email_content, getFullSiteUrl('', 'act', 'dispShopToolViewOrder', 'order_srl', $order->order_srl), $order->order_srl, $order_content);
     $oMail = new Mail();
     $oMail->setTitle($admin_email_subject);
     $oMail->setContent($admin_email_content);
     $oMail->setSender($shop->getShopTitle(), $shop->getShopEmail());
     $oMail->setReceiptor(false, $shop->getEmail());
     $oMail->send();
 }
 /**
  * @brief insert document
  **/
 function procBoardInsertDocument()
 {
     // check grant
     if ($this->module_info->module != "board") {
         return new Object(-1, "msg_invalid_request");
     }
     if (!$this->grant->write_document) {
         return new Object(-1, 'msg_not_permitted');
     }
     $logged_info = Context::get('logged_info');
     // setup variables
     $obj = Context::getRequestVars();
     $obj->module_srl = $this->module_srl;
     if ($obj->is_notice != 'Y' || !$this->grant->manager) {
         $obj->is_notice = 'N';
     }
     $obj->commentStatus = $obj->comment_status;
     settype($obj->title, "string");
     if ($obj->title == '') {
         $obj->title = cut_str(strip_tags($obj->content), 20, '...');
     }
     //setup dpcument title tp 'Untitled'
     if ($obj->title == '') {
         $obj->title = 'Untitled';
     }
     // unset document style if the user is not the document manager
     if (!$this->grant->manager) {
         unset($obj->title_color);
         unset($obj->title_bold);
     }
     // generate document module model object
     $oDocumentModel =& getModel('document');
     // generate document module의 controller object
     $oDocumentController =& getController('document');
     // check if the document is existed
     $oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
     // if use anonymous is true
     if ($this->module_info->use_anonymous == 'Y') {
         $obj->notify_message = 'N';
         $this->module_info->admin_mail = '';
         $obj->member_srl = -1 * $logged_info->member_srl;
         $obj->email_address = $obj->homepage = $obj->user_id = '';
         $obj->user_name = $obj->nick_name = 'anonymous';
         $bAnonymous = true;
         $oDocument->add('member_srl', $obj->member_srl);
     } else {
         $bAnonymous = false;
     }
     // update the document if it is existed
     if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) {
         if (!$oDocument->isGranted()) {
             return new Object(-1, 'msg_not_permitted');
         }
         if (!$this->grant->manager) {
             // notice & document style same as before if not manager
             $obj->is_notice = $oDocument->get('is_notice');
             $obj->title_color = $oDocument->get('title_color');
             $obj->title_bold = $oDocument->get('title_bold');
         }
         $output = $oDocumentController->updateDocument($oDocument, $obj);
         $msg_code = 'success_updated';
         // insert a new document otherwise
     } else {
         $output = $oDocumentController->insertDocument($obj, $bAnonymous);
         $msg_code = 'success_registed';
         $obj->document_srl = $output->get('document_srl');
         // send an email to admin user
         if ($output->toBool() && $this->module_info->admin_mail) {
             $oMail = new Mail();
             $oMail->setTitle($obj->title);
             $oMail->setContent(sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('', 'document_srl', $obj->document_srl), getFullUrl('', 'document_srl', $obj->document_srl), $obj->content));
             $oMail->setSender($obj->user_name, $obj->email_address);
             $target_mail = explode(',', $this->module_info->admin_mail);
             for ($i = 0; $i < count($target_mail); $i++) {
                 $email_address = trim($target_mail[$i]);
                 if (!$email_address) {
                     continue;
                 }
                 $oMail->setReceiptor($email_address, $email_address);
                 $oMail->send();
             }
         }
     }
     // if there is an error
     if (!$output->toBool()) {
         return $output;
     }
     // return the results
     $this->add('mid', Context::get('mid'));
     $this->add('document_srl', $output->get('document_srl'));
     // alert a message
     $this->setMessage($msg_code);
 }
Ejemplo n.º 14
0
 function procMemberModifyEmailAddress()
 {
     if (!Context::get('is_logged')) {
         return $this->stop('msg_not_logged');
     }
     $member_info = Context::get('logged_info');
     $newEmail = Context::get('email_address');
     if (!$newEmail) {
         return $this->stop('msg_invalid_request');
     }
     $oMemberModel = getModel('member');
     $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail);
     if ($member_srl) {
         return new Object(-1, 'msg_exists_email_address');
     }
     if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') {
         return $this->stop('msg_invalid_request');
     }
     unset($_SESSION['rechecked_password_step']);
     $auth_args = new stdClass();
     $auth_args->user_id = $newEmail;
     $auth_args->member_srl = $member_info->member_srl;
     $auth_args->auth_key = md5(rand(0, 999999));
     $auth_args->new_password = '******';
     $output = executeQuery('member.insertAuthMail', $auth_args);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     $oModuleModel = getModel('module');
     $member_config = $oModuleModel->getModuleConfig('member');
     $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
     if (!is_dir($tpl_path)) {
         $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
     }
     global $lang;
     $memberInfo = array();
     $memberInfo[$lang->email_address] = $member_info->email_address;
     $memberInfo[$lang->nick_name] = $member_info->nick_name;
     Context::set('memberInfo', $memberInfo);
     Context::set('newEmail', $newEmail);
     $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key);
     Context::set('auth_url', $auth_url);
     $oTemplate =& TemplateHandler::getInstance();
     $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email');
     $oMail = new Mail();
     $oMail->setTitle(Context::getLang('title_modify_email_address'));
     $oMail->setContent($content);
     $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
     $oMail->setReceiptor($member_info->nick_name, $newEmail);
     $result = $oMail->send();
     $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail);
     $this->setMessage($msg);
     $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '');
     $this->setRedirectUrl($returnUrl);
 }
Ejemplo n.º 15
0
 /**
  * @brief 코멘트 추가
  **/
 function procBoardInsertComment()
 {
     // 권한 체크
     if (!$this->grant->write_comment) {
         return new Object(-1, 'msg_not_permitted');
     }
     // 댓글 입력에 필요한 데이터 추출
     $obj = Context::gets('document_srl', 'comment_srl', 'parent_srl', 'content', 'password', 'nick_name', 'nick_name', 'member_srl', 'email_address', 'homepage', 'is_secret', 'notify_message');
     $obj->module_srl = $this->module_srl;
     // 원글이 존재하는지 체크
     $oDocumentModel =& getModel('document');
     $oDocument = $oDocumentModel->getDocument($obj->document_srl);
     if (!$oDocument->isExists()) {
         return new Object(-1, 'msg_not_permitted');
     }
     // 익명 설정일 경우 여러가지 요소를 미리 제거 (알림용 정보들 제거)
     if ($this->module_info->use_anonymous == 'Y') {
         $obj->notify_message = 'N';
         $this->module_info->admin_mail = '';
     }
     // comment 모듈의 model 객체 생성
     $oCommentModel =& getModel('comment');
     // comment 모듈의 controller 객체 생성
     $oCommentController =& getController('comment');
     // comment_srl이 존재하는지 체크
     // 만일 comment_srl이 n/a라면 getNextSequence()로 값을 얻어온다.
     if (!$obj->comment_srl) {
         $obj->comment_srl = getNextSequence();
     } else {
         $comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager);
     }
     // comment_srl이 없을 경우 신규 입력
     if ($comment->comment_srl != $obj->comment_srl) {
         // parent_srl이 있으면 답변으로
         if ($obj->parent_srl) {
             $parent_comment = $oCommentModel->getComment($obj->parent_srl);
             if (!$parent_comment->comment_srl) {
                 return new Object(-1, 'msg_invalid_request');
             }
             $output = $oCommentController->insertComment($obj);
             // 없으면 신규
         } else {
             $output = $oCommentController->insertComment($obj);
         }
         // 문제가 없고 모듈 설정에 관리자 메일이 등록되어 있으면 메일 발송
         if ($output->toBool() && $this->module_info->admin_mail) {
             $oMail = new Mail();
             $oMail->setTitle($oDocument->getTitleText());
             $oMail->setContent(sprintf("From : <a href=\"%s#comment_%d\">%s#comment_%d</a><br/>\r\n%s", $oDocument->getPermanentUrl(), $obj->comment_srl, $oDocument->getPermanentUrl(), $obj->comment_srl, $obj->content));
             $oMail->setSender($obj->user_name, $obj->email_address);
             $target_mail = explode(',', $this->module_info->admin_mail);
             for ($i = 0; $i < count($target_mail); $i++) {
                 $email_address = trim($target_mail[$i]);
                 if (!$email_address) {
                     continue;
                 }
                 $oMail->setReceiptor($email_address, $email_address);
                 $oMail->send();
             }
         }
         // comment_srl이 있으면 수정으로
     } else {
         $obj->parent_srl = $comment->parent_srl;
         $output = $oCommentController->updateComment($obj, $this->grant->manager);
         $comment_srl = $obj->comment_srl;
     }
     if (!$output->toBool()) {
         return $output;
     }
     // 익명 사용시 글의 글쓴이 정보를 모두 제거
     if ($this->module_info->use_anonymous == 'Y' && Context::get('is_logged')) {
         $logged_info = Context::get('logged_info');
         $comment = $oCommentModel->getComment($output->get('comment_srl'), $this->grant->manager);
         $obj = $comment->getObjectVars();
         $obj->member_srl = -1 * $logged_info->member_srl;
         $obj->email_address = $obj->homepage = $obj->user_id = '';
         $obj->user_name = $obj->nick_name = 'anonymous';
         $output = executeQuery('comment.updateComment', $obj);
         if (!$output->toBool()) {
             return $output;
         }
     }
     $this->setMessage('success_registed');
     $this->add('mid', Context::get('mid'));
     $this->add('document_srl', $obj->document_srl);
     $this->add('comment_srl', $obj->comment_srl);
 }
Ejemplo n.º 16
0
 /**
  * @brief send email 
  **/
 function procContactSendEmail()
 {
     $logged_info = Context::get('logged_info');
     if ($this->module_info->send_grant_all != 'Y' && !$logged_info) {
         return new Object(-1, 'msg_logged_can_send_mail');
     }
     if (!$this->module_info->admin_mail) {
         return new Object(-1, 'msg_do_set_admin_mail');
     }
     $oMail = new Mail();
     $oMail->setContentType("plain");
     // get form variables submitted
     $obj = Context::getRequestVars();
     if ($obj->enable_terms == 'Y' && !$obj->check_agree) {
         return new Object(-1, 'msg_terms_of_license_agreement');
     }
     $obj->email = $obj->Email;
     $obj->subject = $obj->Subject;
     $obj->comment = $obj->Comment;
     $oDocumentModel =& getModel('document');
     $extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl);
     $mail_content = array();
     $filter_lang = Context::getLang('filter');
     $content = '';
     if (count($extra_keys)) {
         $oModuleController =& getController('module');
         foreach ($extra_keys as $idx => $extra_item) {
             $value = '';
             if (isset($obj->{'extra_vars' . $idx})) {
                 $value = $obj->{'extra_vars' . $idx};
             } elseif (isset($obj->{$extra_item->eid})) {
                 $value = $obj->{$extra_item->eid};
             }
             if (!is_array($value)) {
                 $value = trim($value);
             }
             if (!isset($value)) {
                 continue;
             }
             //check if extra item is required
             $oModuleController->replaceDefinedLangCode($extra_item->name);
             if ($extra_item->is_required == 'Y' && $value == "") {
                 return new Object(-1, sprintf($filter_lang->invalid, $extra_item->name));
             }
             //if the type of form component is email address
             if ($extra_item->type == 'email_address' && !$oMail->isVaildMailAddress($value)) {
                 return new Object(-1, sprintf($filter_lang->invalid_email, $extra_item->name));
             }
             if ($extra_item->type == "tel") {
                 $mail_content[$extra_item->eid] = $obj->{'extra_vars' . $idx}[2];
                 $content .= $extra_item->name . ':  ' . $obj->{'extra_vars' . $idx}[2] . "\r\n";
             } elseif (is_array($obj->{'extra_vars' . $idx})) {
                 $mail_content[$extra_item->eid] = implode(",", $obj->{'extra_vars' . $idx});
                 $content .= $extra_item->name . ':  ' . implode(",", $obj->{'extra_vars' . $idx}) . "\r\n";
             } else {
                 $mail_content[$extra_item->eid] = $value;
                 $content .= $extra_item->name . ':  ' . $value . "\r\n";
             }
             $mail_title[$extra_item->eid] = htmlspecialchars($extra_item->name);
         }
     }
     if (!$oMail->isVaildMailAddress($obj->email)) {
         return new Object(-1, sprintf($filter_lang->invalid_email, Context::getLang('email_address')));
     }
     $oMail->setTitle($obj->subject);
     $content_all = $content . "\r\nComments:\r\n" . htmlspecialchars($obj->comment);
     $mail_content['Comments'] = $obj->comment;
     $oMail->setContent(htmlspecialchars($content_all));
     //$oMail->setSender("XE Contact Us", $obj->email);
     $oMail->setSender($obj->email . "(" . $_SERVER['REMOTE_ADDR'] . ")", $obj->email);
     $target_mail = explode(',', $this->module_info->admin_mail);
     for ($i = 0; $i < count($target_mail); $i++) {
         $email_address = trim($target_mail[$i]);
         if (!$email_address || !$oMail->isVaildMailAddress($email_address)) {
             continue;
         }
         $oMail->setReceiptor($email_address, $email_address);
         if ($logged_info->is_admin != 'Y') {
             if ($this->module_info->module_srl) {
                 $oModuleModel =& getModel('module');
                 $moduleExtraVars = $oModuleModel->getModuleExtraVars($this->module_info->module_srl);
                 if ($moduleExtraVars[$this->module_info->module_srl]->interval) {
                     $interval = $moduleExtraVars[$this->module_info->module_srl]->interval;
                     //transfer interval to mins
                     $interval = $interval * 60;
                     $oContactModel =& getModel('contact');
                     $output = $oContactModel->checkLimited($interval);
                     if (!$output->toBool()) {
                         return $output;
                     }
                 }
             }
         }
         $oMail->send();
     }
     if (isset($_SESSION['mail_content'])) {
         unset($_SESSION['mail_content']);
     }
     if (isset($_SESSION['mail_title'])) {
         unset($_SESSION['mail_title']);
     }
     $_SESSION['mail_content'] = $mail_content;
     $_SESSION['mail_title'] = $mail_title;
     if ($logged_info->is_admin != 'Y') {
         $oSpamController =& getController('spamfilter');
         $oSpamController->insertLog();
     }
     $this->add('mid', Context::get('mid'));
     $this->setMessage('msg_email_send_successfully');
     if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) {
         $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispCompleteSendMail', 'mid', $obj->mid);
         header('location:' . $returnUrl);
         return;
     }
 }
Ejemplo n.º 17
0
 /**
  * Send a message
  * @return Object
  */
 function procCommunicationSendMessage()
 {
     // Check login information
     if (!Context::get('is_logged')) {
         return new Object(-1, 'msg_not_logged');
     }
     $logged_info = Context::get('logged_info');
     // Check variables
     $receiver_srl = Context::get('receiver_srl');
     if (!$receiver_srl) {
         return new Object(-1, 'msg_not_exists_member');
     }
     $title = trim(Context::get('title'));
     if (!$title) {
         return new Object(-1, 'msg_title_is_null');
     }
     $content = trim(Context::get('content'));
     if (!$content) {
         return new Object(-1, 'msg_content_is_null');
     }
     $send_mail = Context::get('send_mail');
     if ($send_mail != 'Y') {
         $send_mail = 'N';
     }
     // Check if there is a member to receive a message
     $oMemberModel = getModel('member');
     $oCommunicationModel = getModel('communication');
     $config = $oCommunicationModel->getConfig();
     if (!$oCommunicationModel->checkGrant($config->grant_write)) {
         return new Object(-1, 'msg_not_permitted');
     }
     $receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
     if ($receiver_member_info->member_srl != $receiver_srl) {
         return new Object(-1, 'msg_not_exists_member');
     }
     // check whether to allow to receive the message(pass if a top-administrator)
     if ($logged_info->is_admin != 'Y') {
         if ($receiver_member_info->allow_message == 'F') {
             if (!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) {
                 return new object(-1, 'msg_allow_message_to_friend');
             }
         } else {
             if ($receiver_member_info->allow_message == 'N') {
                 return new object(-1, 'msg_disallow_message');
             }
         }
     }
     // send a message
     $output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
     if (!$output->toBool()) {
         return $output;
     }
     // send an e-mail
     if ($send_mail == 'Y') {
         $view_url = Context::getRequestUri();
         $content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>", $content, $view_url, $view_url);
         $oMail = new Mail();
         $oMail->setTitle(htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
         $oMail->setContent(removeHackTag($content));
         $oMail->setSender($logged_info->nick_name, $logged_info->email_address);
         $oMail->setReceiptor($receiver_member_info->nick_name, $receiver_member_info->email_address);
         $oMail->send();
     }
     if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) {
         if (Context::get('is_popup') != 'Y') {
             global $lang;
             htmlHeader();
             alertScript($lang->success_sended);
             closePopupScript();
             htmlFooter();
             Context::close();
             exit;
         } else {
             $this->setMessage('success_sended');
             $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispCommunicationMessages', 'message_type', 'S', 'receiver_srl', $receiver_srl, 'message_srl', '');
             $this->setRedirectUrl($returnUrl);
         }
     }
     return $output;
 }
Ejemplo n.º 18
0
 /**
  * Send email to module's admins after a new comment was interted successfully
  * if Comments Approval System is used 
  * @param object $obj 
  * @return void
  */
 function sendEmailToAdminAfterInsertComment($obj)
 {
     $using_validation = $this->isModuleUsingPublishValidation($obj->module_srl);
     $oDocumentModel = getModel('document');
     $oDocument = $oDocumentModel->getDocument($obj->document_srl);
     $oMemberModel = getModel("member");
     if (isset($obj->member_srl) && !is_null($obj->member_srl)) {
         $member_info = $oMemberModel->getMemberInfoByMemberSrl($obj->member_srl);
     } else {
         $member_info = new stdClass();
         $member_info->is_admin = "N";
         $member_info->nick_name = $obj->nick_name;
         $member_info->user_name = $obj->user_name;
         $member_info->email_address = $obj->email_address;
     }
     $oCommentModel = getModel("comment");
     $nr_comments_not_approved = $oCommentModel->getCommentAllCount(NULL, FALSE);
     $oModuleModel = getModel("module");
     $module_info = $oModuleModel->getModuleInfoByDocumentSrl($obj->document_srl);
     // If there is no problem to register comment then send an email to all admin were set in module admin panel
     if ($module_info->admin_mail && $member_info->is_admin != 'Y') {
         $oMail = new Mail();
         $oMail->setSender($obj->email_address, $obj->email_address);
         $mail_title = "[XE - " . Context::get('mid') . "] A new comment was posted on document: \"" . $oDocument->getTitleText() . "\"";
         $oMail->setTitle($mail_title);
         $url_comment = getFullUrl('', 'document_srl', $obj->document_srl) . '#comment_' . $obj->comment_srl;
         if ($using_validation) {
             $url_approve = getFullUrl('', 'module', 'admin', 'act', 'procCommentAdminChangePublishedStatusChecked', 'cart[]', $obj->comment_srl, 'will_publish', '1', 'search_target', 'is_published', 'search_keyword', 'N');
             $url_trash = getFullUrl('', 'module', 'admin', 'act', 'procCommentAdminDeleteChecked', 'cart[]', $obj->comment_srl, 'search_target', 'is_trash', 'search_keyword', 'true');
             $mail_content = "\n\t\t\t\t\tA new comment on the document \"" . $oDocument->getTitleText() . "\" is waiting for your approval.\n\t\t\t\t\t<br />\n\t\t\t\t\t<br />\n\t\t\t\t\tAuthor: " . $member_info->nick_name . "\n\t\t\t\t\t<br />Author e-mail: " . $member_info->email_address . "\n\t\t\t\t\t<br />From : <a href=\"" . $url_comment . "\">" . $url_comment . "</a>\n\t\t\t\t\t<br />Comment:\n\t\t\t\t\t<br />\"" . $obj->content . "\"\n\t\t\t\t\t<br />Document:\n\t\t\t\t\t<br />\"" . $oDocument->getContentText() . "\"\n\t\t\t\t\t<br />\n\t\t\t\t\t<br />\n\t\t\t\t\tApprove it: <a href=\"" . $url_approve . "\">" . $url_approve . "</a>\n\t\t\t\t\t<br />Trash it: <a href=\"" . $url_trash . "\">" . $url_trash . "</a>\n\t\t\t\t\t<br />Currently " . $nr_comments_not_approved . " comments on \"" . Context::get('mid') . "\" module are waiting for approval. Please visit the moderation panel:\n\t\t\t\t\t<br /><a href=\"" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "\">" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "</a>\n\t\t\t\t\t";
             $oMail->setContent($mail_content);
         } else {
             $mail_content = "\n\t\t\t\t\tAuthor: " . $member_info->nick_name . "\n\t\t\t\t\t<br />Author e-mail: " . $member_info->email_address . "\n\t\t\t\t\t<br />From : <a href=\"" . $url_comment . "\">" . $url_comment . "</a>\n\t\t\t\t\t<br />Comment:\n\t\t\t\t\t<br />\"" . $obj->content . "\"\n\t\t\t\t\t<br />Document:\n\t\t\t\t\t<br />\"" . $oDocument->getContentText() . "\"\n\t\t\t\t\t";
             $oMail->setContent($mail_content);
             // get email of thread's author
             $document_author_email = $oDocument->variables['email_address'];
             //get admin info
             $logged_info = Context::get('logged_info');
             //mail to author of thread - START
             /**
              * @todo Removed code send email to document author.
              */
             /*
             if($document_author_email != $obj->email_address && $logged_info->email_address != $document_author_email)
             {
             	$oMail->setReceiptor($document_author_email, $document_author_email);
             	$oMail->send();
             }
             */
             // mail to author of thread - STOP
         }
         // get all admins emails
         $admins_emails = $module_info->admin_mail;
         $target_mail = explode(',', $admins_emails);
         // send email to all admins - START
         for ($i = 0; $i < count($target_mail); $i++) {
             $email_address = trim($target_mail[$i]);
             if (!$email_address) {
                 continue;
             }
             $oMail->setReceiptor($email_address, $email_address);
             $oMail->send();
         }
         //  send email to all admins - STOP
     }
     $comment_srl_list = array(0 => $obj->comment_srl);
     // call a trigger for calling "send mail to subscribers" (for moment just for forum)
     ModuleHandler::triggerCall("comment.sendEmailToAdminAfterInsertComment", "after", $comment_srl_list);
     /*
      // send email to author - START
      $oMail = new Mail();
      $mail_title = "[XE - ".Context::get('mid')."] your comment on document: \"".$oDocument->getTitleText()."\" have to be approved";
      $oMail->setTitle($mail_title);
      //$mail_content = sprintf("From : <a href=\"%s?document_srl=%s&comment_srl=%s#comment_%d\">%s?document_srl=%s&comment_srl=%s#comment_%d</a><br/>\r\n%s  ", getFullUrl(''),$comment->document_srl,$comment->comment_srl,$comment->comment_srl, getFullUrl(''),$comment->document_srl,$comment->comment_srl,$comment->comment_srl,$comment>content);
      $mail_content = "
      Your comment #".$obj->comment_srl." on document \"".$oDocument->getTitleText()."\" have to be approved by admin of <strong><i>".  strtoupper($module_info->mid)."</i></strong> module before to be publish.
      <br />
      <br />Comment content:
      ".$obj->content."
      <br />
      ";
      $oMail->setContent($mail_content);
      $oMail->setSender($obj->email_address, $obj->email_address);
      $oMail->setReceiptor($obj->email_address, $obj->email_address);
      $oMail->send();
      // send email to author - START
     */
     return;
 }
Ejemplo n.º 19
0
 /**
  * @brief member 테이블에 사용자 추가
  **/
 function insertMember(&$args, $password_is_hashed = false)
 {
     // trigger 호출 (before)
     $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args);
     if (!$output->toBool()) {
         return $output;
     }
     // 멤버 설정 정보에서 가입약관 부분을 재확인
     $oModuleModel =& getModel('module');
     $config = $oModuleModel->getModuleConfig('member');
     $logged_info = Context::get('logged_info');
     // 임시 제한 일자가 있을 경우 제한 일자에 내용 추가
     if ($config->limit_day) {
         $args->limit_date = date("YmdHis", time() + $config->limit_day * 60 * 60 * 24);
     }
     // 입력할 사용자의 아이디를 소문자로 변경
     $args->user_id = strtolower($args->user_id);
     // 필수 변수들의 조절
     if ($args->allow_mailing != 'Y') {
         $args->allow_mailing = 'N';
     }
     if ($args->denied != 'Y') {
         $args->denied = 'N';
     }
     $args->allow_message = 'Y';
     if ($logged_info->is_admin == 'Y') {
         if ($args->is_admin != 'Y') {
             $args->is_admin = 'N';
         }
     } else {
         unset($args->is_admin);
     }
     list($args->email_id, $args->email_host) = explode('@', $args->email_address);
     // 홈페이지, 블로그의 주소 검사
     if ($args->homepage && !preg_match("/^[a-z]+:\\/\\//i", $args->homepage)) {
         $args->homepage = 'http://' . $args->homepage;
     }
     if ($args->blog && !preg_match("/^[a-z]+:\\/\\//i", $args->blog)) {
         $args->blog = 'http://' . $args->blog;
     }
     // 모델 객체 생성
     $oMemberModel =& getModel('member');
     // 금지 아이디인지 체크
     if ($oMemberModel->isDeniedID($args->user_id)) {
         return new Object(-1, 'denied_user_id');
     }
     // 아이디, 닉네임, email address 의 중복 체크
     $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id);
     if ($member_srl) {
         return new Object(-1, 'msg_exists_user_id');
     }
     $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name);
     if ($member_srl) {
         return new Object(-1, 'msg_exists_nick_name');
     }
     $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address);
     if ($member_srl) {
         return new Object(-1, 'msg_exists_email_address');
     }
     $oDB =& DB::getInstance();
     $oDB->begin();
     // DB에 입력
     $args->member_srl = getNextSequence();
     if ($args->password && !$password_is_hashed) {
         $args->password = md5($args->password);
     } elseif (!$args->password) {
         unset($args->password);
     }
     $output = executeQuery('member.insertMember', $args);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     // 입력된 그룹 값이 없으면 기본 그룹의 값을 등록
     if (!$args->group_srl_list) {
         $default_group = $oMemberModel->getDefaultGroup(0);
         // 기본 그룹에 추가
         $output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl);
         if (!$output->toBool()) {
             $oDB->rollback();
             return $output;
         }
         // 입력된 그룹 값이 있으면 해당 그룹의 값을 등록
     } else {
         $group_srl_list = explode('|@|', $args->group_srl_list);
         for ($i = 0; $i < count($group_srl_list); $i++) {
             $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]);
             if (!$output->toBool()) {
                 $oDB->rollback();
                 return $output;
             }
         }
     }
     // 메일 인증 모드 사용시(가입된 회원이 denied일 때) 인증 메일 발송
     if ($args->denied == 'Y') {
         // 인증 DB에 데이터를 넣음
         $auth_args->user_id = $args->user_id;
         $auth_args->member_srl = $args->member_srl;
         $auth_args->new_password = $args->password;
         $auth_args->auth_key = md5(rand(0, 999999));
         $auth_args->is_register = 'Y';
         $output = executeQuery('member.insertAuthMail', $auth_args);
         if (!$output->toBool()) {
             $oDB->rollback();
             return $output;
         }
         // 메일 내용을 구함
         Context::set('auth_args', $auth_args);
         Context::set('member_info', $args);
         $member_config = $oModuleModel->getModuleConfig('member');
         if (!$member_config->skin) {
             $this->member_config->skin = "default";
         }
         if (!$member_config->colorset) {
             $this->member_config->colorset = "white";
         }
         Context::set('member_config', $member_config);
         $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
         if (!is_dir($tpl_path)) {
             $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
         }
         $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $args->member_srl, 'auth_key', $auth_args->auth_key);
         Context::set('auth_url', $auth_url);
         $oTemplate =& TemplateHandler::getInstance();
         $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail');
         // 사이트 웹마스터 정보를 구함
         $oModuleModel =& getModel('module');
         $member_config = $oModuleModel->getModuleConfig('member');
         // 메일 발송
         $oMail = new Mail();
         $oMail->setTitle(Context::getLang('msg_confirm_account_title'));
         $oMail->setContent($content);
         $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email);
         $oMail->setReceiptor($args->user_name, $args->email_address);
         $oMail->send();
     }
     // trigger 호출 (after)
     if ($output->toBool()) {
         $trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args);
         if (!$trigger_output->toBool()) {
             $oDB->rollback();
             return $trigger_output;
         }
     }
     $oDB->commit(true);
     $output->add('member_srl', $args->member_srl);
     return $output;
 }
Ejemplo n.º 20
0
 /**
  * @brief insert document
  **/
 function procBoardInsertDocument()
 {
     // check grant
     if ($this->module_info->module != "board") {
         return new Object(-1, "msg_invalid_request");
     }
     if (!$this->grant->write_document) {
         return new Object(-1, 'msg_not_permitted');
     }
     $logged_info = Context::get('logged_info');
     // setup variables
     $obj = Context::getRequestVars();
     $obj->module_srl = $this->module_srl;
     if ($obj->is_notice != 'Y' || !$this->grant->manager) {
         $obj->is_notice = 'N';
     }
     $obj->commentStatus = $obj->comment_status;
     settype($obj->title, "string");
     if ($obj->title == '') {
         $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))), 20, '...');
     }
     //setup dpcument title tp 'Untitled'
     if ($obj->title == '') {
         $obj->title = 'Untitled';
     }
     // unset document style if the user is not the document manager
     if (!$this->grant->manager) {
         unset($obj->title_color);
         unset($obj->title_bold);
     }
     // generate document module model object
     $oDocumentModel = getModel('document');
     // generate document module의 controller object
     $oDocumentController = getController('document');
     // check if the document is existed
     $oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
     // update the document if it is existed
     $is_update = false;
     if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) {
         $is_update = true;
     }
     $oMemberModel = getModel('member');
     $member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl'));
     if ($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') {
         return new Object(-1, 'msg_admin_document_no_modify');
     }
     // if use anonymous is true
     if ($this->module_info->use_anonymous == 'Y') {
         $this->module_info->admin_mail = '';
         $obj->notify_message = 'N';
         if ($is_update === false) {
             $obj->member_srl = -1 * $logged_info->member_srl;
         }
         $obj->email_address = $obj->homepage = $obj->user_id = '';
         $obj->user_name = $obj->nick_name = 'anonymous';
         $bAnonymous = true;
         if ($is_update === false) {
             $oDocument->add('member_srl', $obj->member_srl);
         }
     } else {
         $bAnonymous = false;
     }
     if ($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET')) {
         $use_status = explode('|@|', $this->module_info->use_status);
         if (!is_array($use_status) || !in_array('SECRET', $use_status)) {
             unset($obj->is_secret);
             $obj->status = 'PUBLIC';
         }
     }
     // update the document if it is existed
     if ($is_update) {
         if (!$oDocument->isGranted()) {
             return new Object(-1, 'msg_not_permitted');
         }
         if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) {
             return new Object(-1, 'msg_protect_content');
         }
         if (!$this->grant->manager) {
             // notice & document style same as before if not manager
             $obj->is_notice = $oDocument->get('is_notice');
             $obj->title_color = $oDocument->get('title_color');
             $obj->title_bold = $oDocument->get('title_bold');
         }
         // modify list_order if document status is temp
         if ($oDocument->get('status') == 'TEMP') {
             $obj->last_update = $obj->regdate = date('YmdHis');
             $obj->update_order = $obj->list_order = getNextSequence() * -1;
         }
         $output = $oDocumentController->updateDocument($oDocument, $obj);
         $msg_code = 'success_updated';
         // insert a new document otherwise
     } else {
         $output = $oDocumentController->insertDocument($obj, $bAnonymous);
         $msg_code = 'success_registed';
         $obj->document_srl = $output->get('document_srl');
         // send an email to admin user
         if ($output->toBool() && $this->module_info->admin_mail) {
             $oModuleModel = getModel('module');
             $member_config = $oModuleModel->getModuleConfig('member');
             $is_logged = Context::get('is_logged');
             if (!$is_logged && !$member_config->webmaster_email) {
                 $obj->email_address = $this->module_info->admin_mail;
             }
             $oMail = new Mail();
             $oMail->setTitle($obj->title);
             $oMail->setContent(sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('', 'document_srl', $obj->document_srl), getFullUrl('', 'document_srl', $obj->document_srl), $obj->content));
             $oMail->setSender($obj->user_name ? $obj->user_name : 'anonymous', $obj->email_address ? $obj->email_address : $member_config->webmaster_email);
             $target_mail = explode(',', $this->module_info->admin_mail);
             for ($i = 0; $i < count($target_mail); $i++) {
                 $email_address = trim($target_mail[$i]);
                 if (!$email_address) {
                     continue;
                 }
                 $oMail->setReceiptor($email_address, $email_address);
                 $oMail->send();
             }
         }
     }
     // if there is an error
     if (!$output->toBool()) {
         return $output;
     }
     // return the results
     $this->add('mid', Context::get('mid'));
     $this->add('document_srl', $output->get('document_srl'));
     // alert a message
     $this->setMessage($msg_code);
 }
Ejemplo n.º 21
0
 function triggerCompletePayment(&$obj)
 {
     $oPaynotyModel = getModel('paynoty');
     $oTextmessageController = getController('textmessage');
     $config = $oPaynotyModel->getConfig();
     if ($config->use != 'Y') {
         return new Object();
     }
     $order_info = getModel('ncart')->getOrderInfo($obj->order_srl);
     $extra_vars = unserialize($order_info->extra_vars);
     $product_name = $order_info->title;
     if (preg_match('/^\\$user_lang->[a-zA-Z0-9]+$/', $product_name)) {
         $product_name = preg_replace_callback('!\\$user_lang->([a-z0-9\\_]+)!is', array($this, '_replaceLangCode'), $product_name);
     }
     $args = new stdClass();
     $args->module_srl = $obj->module_srl;
     $output = executeQuery('module.getMidInfo', $args);
     $module_info = $output->data;
     $logged_info = Context::get('logged_info');
     if (Context::get('is_logged')) {
         $obj->p_name = $logged_info->nick_name;
         $obj->email_address = $logged_info->email_address;
     } else {
         $obj->p_name = $obj->vact_name;
     }
     $obj->order_title = $product_name;
     $sms_message = paynoty::mergeKeywords($config->content, $obj);
     $sms_message = paynoty::mergeKeywords($sms_message, $module_info);
     $sms_message = str_replace("&nbsp;", "", strip_tags($sms_message));
     $mail_content = paynoty::mergeKeywords($config->mail_content, $obj);
     $mail_content = paynoty::mergeKeywords($mail_content, $module_info);
     $tmp_obj = new stdClass();
     $tmp_obj->article_url = getFullUrl('', 'document_srl', $obj->document_srl);
     $mail_content = $this->mergeKeywords($mail_content, $tmp_obj);
     $sms_message = $this->mergeKeywords($sms_message, $tmp_obj);
     if (isset($config->sending_method['cta']) || isset($config->sending_method['sms']) && $oTextmessageController) {
         $args = new stdClass();
         $args->product_name = $product_name;
         $args->content = $sms_message;
         if ($config->phone_number_type == 'logged') {
             if (!Context::get('is_logged') || !$config->variable_name) {
                 $args->recipient_no = $extra_vars->tel1[0] . $extra_vars->tel1[1] . $extra_vars->tel1[2];
             } else {
                 $args->recipient_no = $logged_info->{$config->variable_name}[0] . $logged_info->{$config->variable_name}[1] . $logged_info->{$config->variable_name}[2];
             }
         } else {
             $args->recipient_no = $extra_vars->tel1[0] . $extra_vars->tel1[1] . $extra_vars->tel1[2];
         }
         $args->sender_no = $config->sender_no;
         if (isset($config->sending_method['cta']) || isset($config->sending_method['sms']) && isset($config->sending_method['cta'])) {
             $args->type = 'cta';
             if ($config->sender_key) {
                 $args->sender_key = $config->sender_key;
             }
             $json_args = new stdClass();
             $json_args->type = 'cta';
             $json_args->to = $args->recipient_no;
             $json_args->text = $args->content;
             $extension = array($json_args);
             $args->extension = json_encode($extension);
         } elseif (isset($config->sending_method['sms'])) {
             $args->type = 'sms';
         }
         $output = $oTextmessageController->sendmessage($args);
         if (!$output->toBool()) {
             return $output;
         }
     }
     if (isset($config->sending_method['email'])) {
         if ($config->sender_email) {
             $sender_email_address = $config->sender_email;
         }
         if ($config->sender_name) {
             $sender_name = $config->sender_name;
         }
         $oMail = new Mail();
         $oMail->setTitle($product_name);
         $oMail->setContent($mail_content);
         $oMail->setSender($sender_name, $sender_email_address);
         $target_email = explode(',', $config->admin_emails);
         $oMail->setReceiptor($obj->email_address, $obj->email_address);
         $oMail->send();
         foreach ($target_email as $email_address) {
             $email_address = trim($email_address);
             if (!$email_address) {
                 continue;
             }
             $oMail->setReceiptor($email_address, $email_address);
             $oMail->send();
         }
     }
 }