コード例 #1
0
ファイル: Admin.php プロジェクト: romnvll/FileZ
 /**
  * Notify the owner of the file passed as parameter that its file is going
  * to be deleted
  *
  * @param App_Model_File $file
  */
 private function notifyDeletionByEmail(App_Model_File $file)
 {
     try {
         option('translate')->setLocale(fz_config_get('app', 'default_locale'));
         option('locale')->setLocale(fz_config_get('app', 'default_locale'));
         $mail = $this->createMail();
         $user = $file->getUploader();
         $subject = __r('[FileZ] Your file "%file_name%" is going to be deleted', array('file_name' => $file->file_name));
         $msg = __r('email_delete_notif (%file_name%, %file_url%, %filez_url%, %available_until%)', array('file_name' => $file->file_name, 'file_url' => $file->getDownloadUrl(), 'filez_url' => url_for('/'), 'available_until' => $file->getAvailableUntil()->toString(Zend_Date::DATE_FULL)));
         $mail->setBodyText($msg);
         $mail->setSubject($subject);
         $mail->addTo($user->email);
         $mail->send();
         fz_log('Delete notification sent to ' . $user->email, FZ_LOG_CRON);
     } catch (Exception $e) {
         fz_log('Can\'t send email to ' . $user->email . ' file_id:' . $file->id, FZ_LOG_CRON_ERROR);
     }
 }