Пример #1
0
 /**
  * @return array {key == lang code, value == array {key == timeOffset, value == array of recipients}}
  */
 private function getRecipients()
 {
     $recipients = array();
     $emailValidator = new Gpf_Rpc_Form_Validator_EmailValidator();
     foreach ($this->recipients as $email => $recipient) {
         if (!$emailValidator->validate($email)) {
             Gpf_Log::warning('Email will not be sent to the address "' . $email . '". Address is not valid.');
             continue;
         }
         try {
             $authuser = new Gpf_Db_AuthUser();
             $authuser->setNotificationEmail($email);
             $authuser->loadFromData(array(Gpf_Db_Table_AuthUsers::NOTIFICATION_EMAIL));
             $recipients = $this->insertRecipient($recipients, $recipient, $this->getAccountUser($authuser->getId()));
         } catch (Gpf_Exception $e) {
             try {
                 $authuser->setUsername($email);
                 $authuser->loadFromUsername();
                 $recipients = $this->insertRecipient($recipients, $recipient, $this->getAccountUser($authuser->getId()));
             } catch (Gpf_DbEngine_NoRowException $e) {
                 $recipients = $this->insertRecipient($recipients, $recipient);
             }
         }
     }
     return $recipients;
 }