/upload/includes/topic_templates/audiobooks.php

http://torrentpier2.googlecode.com/ · PHP · 66 lines · 54 code · 10 blank · 2 comment · 9 complexity · dda950bedd6e6634ad3b1bf8a0c23dac MD5 · raw file

  1. <?php
  2. if (!defined('IN_PHPBB')) die(basename(__FILE__));
  3. if (!$topic_tpl) die('$topic_tpl missing');
  4. $img_align = '=right';
  5. $title_font_size = 24;
  6. if (@$_REQUEST['preview'] && is_array($_POST['msg']))
  7. {
  8. $tpl_items = array(
  9. 'release_name',
  10. 'picture',
  11. 'year',
  12. 'author',
  13. 'performer',
  14. 'genre',
  15. 'publisher',
  16. 'audiobook_type',
  17. 'audio_codec',
  18. 'audio_bitrate',
  19. 'description',
  20. 'moreinfo',
  21. );
  22. $tpl_sprintf = array(
  23. 'picture' => "[img{$img_align}]%s[/img]",
  24. 'release_name' => "[size=$title_font_size]%s[/size]\n\n",
  25. );
  26. $message = $subject = '';
  27. $msg = $sbj_ext = array();
  28. foreach ($tpl_items as $item)
  29. {
  30. $msg[$item] = @$_POST['msg'][$item];
  31. }
  32. array_deep($msg, 'trim');
  33. if ($msg)
  34. {
  35. // Subject
  36. $subject = $msg['release_name'];
  37. if ($msg['author'])
  38. {
  39. $subject = $msg['author'] .' - '. $subject;
  40. }
  41. if ($msg['performer'])
  42. {
  43. $sbj_ext[] = $msg['performer'];
  44. }
  45. if ($msg['year'])
  46. {
  47. $sbj_ext[] = $msg['year'];
  48. }
  49. if ($sbj_ext)
  50. {
  51. $subject .= ' ['. join(', ', $sbj_ext) .']';
  52. }
  53. // Message
  54. $message = tpl_build_message($msg);
  55. }
  56. }