示例#1
0
 /**
  * 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 {
         $mail = $this->createMail();
         $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($file->uploader_email);
         $mail->send();
         fz_log('Delete notification sent to ' . $file->uploader_email, FZ_LOG_CRON);
     } catch (Exception $e) {
         fz_log('Can\'t send email to ' . $file->uploader_email . ' file_id:' . $file->id, FZ_LOG_CRON_ERROR);
     }
 }
示例#2
0
 /**
  * Notify the user by email that its file has been uploaded
  *
  * @param App_Model_File $file
  */
 private function sendFileUploadedMail(App_Model_File $file)
 {
     if (!$file->notify_uploader) {
         return;
     }
     $user = $this->getUser();
     $subject = __r('[FileZ] "%file_name%" uploaded successfully', array('file_name' => $file->file_name));
     $msg = __r('email_upload_success (%file_name%, %file_url%, %filez_url%, %available_from%, %available_until%)', array('file_name' => $file->file_name, 'available_from' => $file->getAvailableFrom()->toString(Zend_Date::DATE_LONG), 'available_until' => $file->getAvailableUntil()->toString(Zend_Date::DATE_LONG), 'file_url' => $file->getDownloadUrl(), 'filez_url' => fz_url_for('/', fz_config_get('app', 'https') == 'always')));
     $mail = $this->createMail();
     $mail->setBodyText($msg);
     $mail->setSubject($subject);
     $mail->addTo($user->email, $user->firstname . ' ' . $user->lastname);
     try {
         $mail->send();
     } catch (Exception $e) {
         fz_log('Can\'t send email "File Uploaded" : ' . $e, FZ_LOG_ERROR);
     }
 }