/upload/includes/topic_templates/books.php

http://torrentpier2.googlecode.com/ · PHP · 67 lines · 55 code · 10 blank · 2 comment · 9 complexity · ce9e46fc627fcb12b9ec883f9a9278bb 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. 'genre',
  14. 'publisher',
  15. 'edition',
  16. 'isbn',
  17. 'format',
  18. 'quality',
  19. 'pages_count',
  20. 'description',
  21. 'moreinfo',
  22. );
  23. $tpl_sprintf = array(
  24. 'picture' => "[img{$img_align}]%s[/img]\n\n",
  25. 'release_name' => "[size=$title_font_size]%s[/size]\n\n",
  26. );
  27. $message = $subject = '';
  28. $msg = $sbj_ext = array();
  29. foreach ($tpl_items as $item)
  30. {
  31. $msg[$item] = @$_POST['msg'][$item];
  32. }
  33. array_deep($msg, 'trim');
  34. if ($msg)
  35. {
  36. // Subject
  37. $subject = $msg['release_name'];
  38. if ($msg['author'])
  39. {
  40. $subject = $msg['author'] .' - '. $subject;
  41. }
  42. if ($msg['year'])
  43. {
  44. $sbj_ext[] = $msg['year'];
  45. }
  46. if ($msg['format'])
  47. {
  48. $sbj_ext[] = $msg['format'];
  49. }
  50. if ($sbj_ext)
  51. {
  52. $subject .= ' ['. join(', ', $sbj_ext) .']';
  53. }
  54. // Message
  55. $message = tpl_build_message($msg);
  56. }
  57. }