/** * Validate e-mail addresses in the comma separated list * * @param mixed * @param \DataContainer * * @return mixed * @throws \Exception */ public function validateSmsSender($varValue, \DataContainer $dc) { if ($varValue != '') { if (strpos($varValue, '##') !== false || strpos($varValue, '{{') !== false) { return $varValue; } if (!\Validator::isAlphanumeric($varValue) && !\Clockwork::is_valid_msisdn($varValue) || \Validator::isAlphanumeric($varValue) && strlen($varValue) > 11) { throw new \Exception($GLOBALS['TL_LANG']['ERR']['invalidClockworkSmsSender']); } } return $varValue; }
/** * @return array */ public function getRecipients() { // Replaces tokens first so that tokens can contain a list of recipients. $strRecipients = StringUtil::recursiveReplaceTokensAndTags($this->objLanguage->sms_recipients, $this->arrTokens, StringUtil::NO_TAGS | StringUtil::NO_EMAILS | StringUtil::NO_BREAKS); $arrRecipients = array(); foreach ((array) trimsplit(',', $strRecipients) as $strRecipient) { if ($strRecipient != '') { $strRecipient = StringUtil::recursiveReplaceTokensAndTags($strRecipient, $this->arrTokens, StringUtil::NO_TAGS | StringUtil::NO_EMAILS | StringUtil::NO_BREAKS); $strRecipient = $this->normalizePhoneNumber($strRecipient); // Address could become empty through invalid insert tag if ($strRecipient === false || !\Clockwork::is_valid_msisdn($strRecipient)) { \System::log(sprintf('Recipient "%s" for message ID %s was skipped as it was no valid MSISDN.', $strRecipient, $this->objMessage->id), __METHOD__, TL_ERROR); continue; } $arrRecipients[] = $strRecipient; } } return $arrRecipients; }