/** * @param string $type * @param string $uumpId * @param bool|string $email * @param bool|string $url * @param bool $isConsult */ protected static function callET($type, $uumpId, $email = false, $url = false, $isConsult = false) { switch($type) { case "MailServiceResetPasswordTemplateId": ExactTarget::resetPassword($uumpId, $email, $url, $isConsult); break; case "MailServiceSuccessTemplateId": ExactTarget::passwordConfirmation($uumpId, $email, $isConsult); break; } }
/** * @return array */ public function stc() { if( !self::user() ) { return false; } $http = BlockDefault::http(); //get current user infos $serviceUser = ServiceUser::getInstance(); $parameters = $serviceUser->getFormParameters(); $userInfos = $serviceUser->callWSHandler( $serviceUser->getEsbInterface( 'read' ), $parameters ); $appname = $http->hasPostVariable( 'appname' ) ? stripslashes( $http->postVariable( 'appname' ) ) : ''; $sender = $userInfos['Data']['Params']['Firstname'] . $userInfos['Data']['Params']['Lastname']; $senderName = $userInfos['Data']['Params']['Firstname'] . $userInfos['Data']['Params']['Lastname']; $senderEmail = $userInfos['Data']['Params']['Email_address']; //get comment if(!$http->hasPostVariable( 'token' ) || !SecurityTool::isUserTokenValid($http->postVariable( 'token' ))) { return array( 'Error' => 'Invalid token', ); } $message = $http->hasPostVariable( 'comment' ) ? stripslashes( $http->postVariable( 'comment' ) ) : ''; //get recipient email $recipient = $http->hasPostVariable( 'Recipient_email' ) ? stripslashes( preg_replace( '/\s/', '', $http->postVariable( 'Recipient_email' ) ) ) : ''; $recipients = array_unique( explode( ';', $recipient ) ); //get Article nodeID $extract = $title = ''; $articleRemoteID = $http->hasPostVariable( 'remote_id' ) ? $http->postVariable( 'remote_id' ) : null; if(!is_null($articleRemoteID)) { $fieldsQuery = array ( '(meta_remote_id_ms:' . $articleRemoteID . ')', '(meta_class_identifier_ms:article)' ); $fields = array ( 'attr_promo_description_t', 'attr_headline_t', ); //fetch solr $params = array( 'indent' => 'on', 'q' => '*:*', 'start' => 0, 'rows' => 1, 'fq' => implode(' AND ', $fieldsQuery), 'fl' => implode(',', $fields), 'qt' => '', 'explainOther' => '', 'hl.fl' => '', ); $raw = SolrTool::rawSearch($params); $article = $raw['response']['docs'][0]; if(strlen($article['attr_promo_description_t']) > 150) { $extract = mb_substr($article['attr_promo_description_t'], 0, 150, 'utf-8') . '...'; } else { $extract = $article['attr_promo_description_t']; } $title = $article['attr_headline_t']; } $destUrl = $http->hasPostVariable( 'destURL' ) ? stripslashes( filter_var($http->postVariable( 'destURL' ), FILTER_VALIDATE_URL) ) : ''; $preparedMessage = $this->prepareMessage( $sender, htmlentities( $message ), $extract, $destUrl ); if( SolrSafeOperatorHelper::featureIsActive( 'ExactTarget' ) && SolrSafeOperatorHelper::featureIsActive( 'UUMP' ) ) { $message = nl2br($message); foreach( $recipients as $recipient ) { ExactTarget::sendToAColleague( self::user()->attribute( 'uuid' ), $recipient, $message, $appname, $destUrl, $extract, $title ); } } else { // Below code is no longer used, since all clusters are using ExactTarget feature. $email = new MailTool( $title, $senderName, array(), $preparedMessage, 'sendtocolleague_email.log'); foreach ( $recipients as $recipient ) { $to = filter_var( $recipient, FILTER_VALIDATE_EMAIL ); if ( $to === false ) { continue; } $email->setRecipients( $to ); $email->sendMail(); } } return array( 'redirect_url' => $this->redirectUrl ); }